Integrating with TripPay
This article contains an end-to-end example of how to integrate with TripPay.
It’s recommended that you’ve already read:
- Payment > Mapping.
- Payment > Integration.
- Payment Web Component.
- Payment API. Read the section on
Create payable contracts
Here are the steps to successfully use TripPay to pay for a booking:
- Make sure the beneficiaries you mention in the booking contract have been mapped.
- Let the traveler choose the inventory they want to book and have them get ready to pay.
- Create a
payable contract
with TripPay that contains the items to be booked. - Let the traveler pay using the TripPay Web Component.
We assume you have already completed Step 1
and Step 2
and are ready to let TripPay know about the booking.
Create payable contract
Request
Here is a JSON sample request that includes everything you need to create for your first payable contract.
Explanation:
We won’t be explaining every data point here as they are already covered in the API docs.
- Lines: 2 - 7 is the user responsible for booking. There are two types of bookers:
- Traveler.
- Travel agent.
- Lines: 8 - 9 is the TripPay account facilitating the booking. It can be:
- Your TripPay integrator account.
- If you run an affiliate network, it can be your affiliate.
- Use a
traceId
to group multiple bookings across multiple suppliers. This way you can cancel a group booking. redirectUrl
lets TripPay know which page to redirect to after the payment is complete.sourceUrl
is the site / app the booking occurred on.
The contractList
array contains the item(s) the traveler wants to purchase from multiple suppliers. Each item contain:
- The
identifier
is a valid UUID you generate. - The supplier you want to book inventory from.
- The inventory you want to book from that supplier. These are all specified in the nested array
contractItemList
. - Every entry under
contractItemList
contains:- Guest user This is the user that will be arriving on the premises.
- Name in English The name of the inventory in the English language.
- Description in English A longer description of the inventory in the English language.
- Price The price of the item.
- Itinerary When this item should be booked.
- Pricing type How the price was calculated.
- Inventory type What type of inventory this is.
- Payable When the traveler should be charged. We currently only support immediate payment options.
- Policy Include cancellation policy rules.
- Daily rate list If the item being booked is a room, you can choose to include how much that room cost for each night the guest stays.
- Beneficiaries Include which TripPay account(s) should be allocated what amount(s) of the price of the item. Fixed / Percent amounts are supported.
Response
When TripPay responds to your request, it will look something like this:
Save the id
on line 3. You will use this to inject into the TripPay web component.
Embed TripPay
At this point, you are ready to embed the Payment Web Component
into your website and show it to the user.
As far as integration goes, that’s all you need to do. All the heavy work is done by TripPay from hereon out.