If you have an integration with BookingSync and you create bookings on your side according to the instant booking flow (i.e. a booking gets confirmed only when the credit card payment is executed successfully) and you don’t have PCI DSS compliant payment platform for collecting credit card payments, you can use our Secure Payments By BookingSync flow for this purpose.
To handle integration with Secure Payments By BookingSync you need to have an application with payments_write
or payments_write_owned
scope. We recommend using payments_write_owned
for this purpose to make sure the payment is not editable by anyone else - only by your application.
Also, the rental for which the booking will be created requires to be instantly bookable and it requires to have a payment gateway assigned (which will be used for executing the credit card payment) which supports rental’s currency.
For client-to-server integration you need to be at least PCI-DSS 3.1 + SAQ-A compliant and for server-to-server integration you need to be SAQ-D compliant.
The primary idea behind Instant Booking Flow is to require successful credit card payment to confirm the booking.
Here are the steps that we recommend to follow for this flow:
Let’s focus on each point separately.
Instant Booking flow requires payment to confirm the booking, so we recommend creating a tentative booking and leaving the confirmation to our PCI DSS compliant platform. The confirmation process should take up to few minutes, so we recommend to set tentative expire date to 5 or 10 minutes from now. To create a tentative booking you need to provide 2 params (besides the requires one):
false
You can find more about the bookings’ attributes and how to create them in the bookings endpoint documentation.
Another step would be creating a tentative payment (i.e. not confirmed payment) of instant-booking
kind for the given booking. This payment will get confirmed once the successful credit card payment is executed. Here the essential attributes you need to provide for such payment:
instant-booking
We also recommend including more details like fullname
, email
, zip
and other address related field.
You can find more about the payments’ attributes and how to create them in the payments endpoint documentation.
Once you have created a payment, you need to execute the payment using its id and the credit card data.
The URL of our PCI DSS compliant payment platform for executing credit card payments is the following: https://secure.bookingsync.com/api/bookingsync/instant_bookings
.
To execute the payment you need to provide the following attributes:
Here’s an example of the expected payload:
{
"card_number": 4111111111111111,
"cardholder_name": "John Doe",
"expires_at_month": "12",
"expires_at_year": "2020",
"security_code": 123,
"address1": "some address 1 / 10",
"zip": "12312",
"city": "San Francisco",
"state": "California",
"country_code": "US",
"gateway_id": "123",
"gateway_name": "payment_gateway_name",
"gateway_type": "PaymentGateway"
}
There are 3 possible responses:
Successful - with status code 200
and no response body - it means that the payment has been successfully authorized and has been enqueued to be captured asynchronously. Once the credit card payment is captured, it will be confirmed on the BookingSync side - the payment will be updated with transaction_id
and paid_at
values and the related booking will be confirmed - marked as booked.
Partial Success - with status code 202
and response body dependent on Payment Gateway. This status means that payment requires authentication.
BookingPay Gateway
{
"enrollmentId": "sample_enrollment_id_123",
"acsURL": "https://test-threedsecure.centralpay.net/acs",
"paReq": "paReq",
"gateway_name": "booking_pay",
"uuid": "lapw8u3k-9583-38l3-m5d9-51c0af5df8cb",
"order_id": "BS-123"
}
Ogone Gateway
{
"gateway_name": "ogone",
"HTML_ANSWER": "html_answer_that_is_Base64_encoded_form",
"uuid": "lapw8u3k-9583-38l3-m5d9-51c0af5df8cb"
}
Stripe Gateway
{
"gateway_name": "stripe",
"uuid": "0fc0476e-1267-49e7-a1f4-43c0df5dc8fd",
"next_action": {
"redirect_to_url": {
"return_url": "https://bookingsync.com?order_id=BS-123-1562441767",
"url": "https://hooks.stripe.com/..."
},
"type": "redirect_to_url"
}
}
After successful authentication a traveller will be redirected to BookingSync success page. There is no possibility to customize this redirection.
422
and validation errors inside response body. Here’s an example of possible validation errors:{
"tentative_payment_id": ["can't be blank"]
}
The essential validation includes presence validation of the required attributes, credit card data and ability to authorize the payment.
All credit card errors are handled inside credit_card
attribute, here’s an example:
{
"credit_card": ["number - is not a valid credit card number"]
}
To indicate problems with authorizing the payment we use payment
attribute, here’s an example:
{
"payment": ["authorization declined"]
}
There are 3 edgecases that shouldn’t happen too often, but are possible:
api
attribute.data
attribute.server
attribute.For testing the payment flow we recommend switching to Bogus gateway, which will prevent from executing a real payment and using one of the following credit card numbers:
4111 1111 1111 1111
- to Simulate an Approved Transaction4111 1111 1111 1112
- to Simulate a Declined Transaction4111 1111 1111 1113
- To Simulate a Gateway Failure