Payment and booking
Pay for the order by card, handle 3DS and follow the booking.
1. Confirm the card payment
Send the card, the billing address and the browser details to POST /{order_id}/confirm_card_payment.
This request goes through PCI Proxy
This is the only request you do not send straight to Dohop. Send it to the PCI Proxy URL instead, with the same path, apikey header and JSON body as any other call. PCI Proxy replaces card_number and card_cvc with tokens and forwards the request to Dohop, so Dohop never receives the card number.
- Test environment:
https://sandbox.pci-proxy.com/v1/push/050b74ecab821aa3/v1/{order_id}/confirm_card_payment - Production: not available yet.
The reference page of this endpoint calls Dohop directly, so it cannot be used to send a card.
card_info holds the card:
card_numberandcard_cvc: the real card number and CVC. PCI Proxy turns them into tokens on the way.card_type: the type of the card, such asVI.card_expiration: the expiry date asMM/YY.bin: the first 6 digits of the card number.last_four: the last 4 digits of the card number.name_on_card: the name of the cardholder.
bin and last_four are needed because Dohop only sees the tokens. Each has to be digits of exactly that length.
curl -X POST 'https://sandbox.pci-proxy.com/v1/push/050b74ecab821aa3/v1/ORDER_ID/confirm_card_payment' \
-H 'apikey: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"payment": {
"billing_address": {
"address": "Katrinartun 4",
"city": "Reykjavik",
"country": "IS",
"postal_code": "105",
"province": ""
},
"browser_info": {
"accept_header": "text/html,application/xhtml+xml",
"browser_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
"browser_url": "https://partner.example.com/checkout",
"color_depth": 24,
"java_enabled": false,
"screen_height": 1080,
"screen_width": 1920,
"time_zone_offset": 0
},
"card_info": {
"card_number": "4444333322221111",
"card_cvc": "737",
"card_type": "VI",
"card_expiration": "03/30",
"bin": "444433",
"last_four": "1111",
"name_on_card": "Test Traveller"
}
}
}'The card in this example is a test card that works in the test environment.
Sent straight to Dohop, a request with the card number and CVC as digits is rejected with 422.
The result in the response has one of three statuses:
in_progress: the card was authenticated and the booking has started in the background. Go on to poll the order.challenge_required: the traveller has to complete a 3DS challenge first.failed: authentication was refused. Whenretriableis true, you can callconfirm_card_paymentagain with another card.
2. Complete the 3DS challenge
A challenge_required result carries a challenge with a challenge_id and the details the 3DS component needs. Run the challenge in the traveller's browser.
When the component reports its result, forward it to POST /{order_id}/challenge_callback. Send the details the component returned, or the client_exception if it raised an error. The booking then resumes.
The call answers 409 when no challenge is waiting for a result, or when the result was not accepted.
3. Poll the order
Call GET /{order_id}/poll until keep_polling is false.
Each response lists the bookings of the order with their status. An order has one travel booking per fare and a Dohop service booking that carries the Dohop fee. The statuses are:
awaiting_paymentprice_check_in_progressbooking_in_progresspendingsuccessfailedabandoned
A poll response can also carry an error, with an error_code and an is_recoverable flag. A price mismatch error also carries the initial and the new price.