Airline tickets
When selling airline tickets, you can specify the information about tickets, flights, and passengers, also known as airline addendum data. The addendum data is used only for bank card payments to prevent possible fraudulent transactions.
Creating a payment with addendum data
The information about passengers and tickets is specified in
airline
object during the payment creation process. The request must contain either the ticket number (ticket_number
) or the booking reference number (booking_reference
) if the ticket number isn’t available yet.Passenger information is specified in
passengers
object.Fight leg information is specified in
legs
object. A leg is a part of a trip, a flight from one airport to another. If a trip includes a transfer between flights, the trip consists of two legs.If a single payment is made for several tickets, it’s enough to specify the number of only one of them (
ticket_number
) or the booking reference for all of them (booking_reference
).Example of request for a payment for flight tickets
cURL
PHP
Python
curl https://api.yookassa.ru/v3/payments \ -X POST \ -u <Shop ID>:<Secret Key> \ -H 'Idempotence-Key: <Idempotence Key>' \ -H 'Content-Type: application/json' \ -d '{ "amount": { "value": "10000.00", "currency": "RUB" }, "payment_method_data": { "type": "bank_card" }, "confirmation": { "type": "redirect", "return_url": "https://www.example.com/return_url" }, "description": "Order No. 72", "airline": { "booking_reference": "IIIKRV", "passengers": [ { "first_name": "SERGEI", "last_name": "IVANOV" } ], "legs": [ { "departure_airport": "LED", "destination_airport": "AMS", "departure_date": "2018-06-20" } ] } }'
Capturing the payment
If you’re using two-stage payments, capture the payment after its status changes to
waiting_for_capture
. When capturing the payment, specify ticket number (ticket_number
) or the booking reference number (booking_reference
) if the ticket number isn’t available yet.Example of request for capturing the payment for flight tickets
cURL
PHP
Python
curl https://api.yookassa.ru/v3/{payment_id}/capture \ -X POST \ -u <Shop ID>:<Secret Key> \ -H 'Idempotence-Key: <Idempotence Key>' \ -H 'Content-Type: application/json' \ -d '{ "amount": { "value": "10000.00", "currency": "RUB" }, "airline": { "booking_reference": "IIIKRV", "ticket_number": "5554916004417", "passengers": [ { "first_name": "SERGEI", "last_name": "IVANOV" } ], "legs": [ { "departure_airport": "LED", "destination_airport": "AMS", "departure_date": "2018-06-20" } ] } }'
See also