POST
/
checkout
/
sessions
curl --request POST \
  --url https://api.{id}.gr4vy.app/checkout/sessions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "cart_items": [
    {
      "name": "GoPro HD",
      "quantity": 2,
      "unit_amount": 1299,
      "discount_amount": 0,
      "tax_amount": 0,
      "external_identifier": "goprohd",
      "sku": "GPHD1078",
      "product_url": "https://example.com/catalog/go-pro-hd",
      "image_url": "https://example.com/images/go-pro-hd.jpg",
      "categories": [
        "camera",
        "travel",
        "gear"
      ],
      "product_type": "physical",
      "seller_country": "US"
    }
  ],
  "metadata": {
    "cohort": "cohort-a",
    "order_id": "order-12345"
  },
  "buyer": {
    "display_name": "John Doe",
    "external_identifier": "buyer-12345",
    "billing_details": {
      "first_name": "John",
      "last_name": "Doe",
      "email_address": "john@example.com",
      "phone_number": "+1234567890",
      "address": {
        "city": "San Jose",
        "country": "US",
        "postal_code": "94560",
        "state": "California",
        "state_code": "US-CA",
        "house_number_or_name": "10",
        "line1": "Stafford Appartments",
        "line2": "29th Street",
        "organization": "Gr4vy"
      },
      "tax_id": {
        "value": "12345678931",
        "kind": "us.ein"
      }
    },
    "account_number": "<string>",
    "shipping_details": {
      "first_name": "John",
      "last_name": "Doe",
      "email_address": "john@example.com",
      "phone_number": "+1234567890",
      "address": {
        "city": "San Jose",
        "country": "US",
        "postal_code": "94560",
        "state": "California",
        "state_code": "US-CA",
        "house_number_or_name": "10",
        "line1": "Stafford Appartments",
        "line2": "29th Street",
        "organization": "Gr4vy"
      }
    }
  },
  "airline": {
    "booking_code": "X36Q9C",
    "issued_address": "123 Broadway, New York",
    "issued_at": "2013-07-16T19:23:00.000+00:00",
    "issuing_carrier_code": "A3",
    "legs": [
      {
        "arrival_airport": "LAX",
        "arrival_at": "2013-07-16T19:23:00.000+00:00",
        "arrival_city": "Los Angeles",
        "arrival_country": "US",
        "carrier_code": "BA",
        "coupon_number": "15885566",
        "departure_airport": "LHR",
        "departure_at": "2013-07-16T19:23:00.000+00:00",
        "departure_city": "London",
        "departure_country": "GB",
        "departure_tax_amount": 1200,
        "fare_amount": 129900,
        "fare_basis_code": "FY",
        "fee_amount": 1200,
        "flight_class": "E",
        "flight_number": "101",
        "route_type": "round_trip",
        "stop_over": false,
        "tax_amount": 1200
      }
    ],
    "passenger_name_record": "JOHN L",
    "passengers": [
      {
        "age_group": "adult",
        "date_of_birth": "2013-07-16",
        "email_address": "john@example.com",
        "first_name": "John",
        "frequent_flyer_number": "15885566",
        "last_name": "Luhn",
        "passport_number": "11117700225",
        "phone_number": "+1234567890",
        "ticket_number": "BA1236699999",
        "title": "Mr.",
        "country_code": "US"
      }
    ],
    "reservation_system": "Amadeus",
    "restricted_ticket": false,
    "ticket_delivery_method": "electronic",
    "ticket_number": "123-1234-151555",
    "travel_agency_code": "12345",
    "travel_agency_invoice_number": "EG15555155",
    "travel_agency_name": "ACME Agency",
    "travel_agency_plan_name": "B733"
  },
  "expires_in": 3600
}'
{
  "cart_items": [
    {
      "name": "GoPro HD",
      "quantity": 2,
      "unit_amount": 1299,
      "discount_amount": 0,
      "tax_amount": 0,
      "external_identifier": "goprohd",
      "sku": "GPHD1078",
      "product_url": "https://example.com/catalog/go-pro-hd",
      "image_url": "https://example.com/images/go-pro-hd.jpg",
      "categories": [
        "camera",
        "travel",
        "gear"
      ],
      "product_type": "physical",
      "seller_country": "US"
    }
  ],
  "metadata": {
    "cohort": "cohort-a",
    "order_id": "order-12345"
  },
  "buyer": {
    "display_name": "John Doe",
    "external_identifier": "buyer-12345",
    "billing_details": {
      "first_name": "John",
      "last_name": "Doe",
      "email_address": "john@example.com",
      "phone_number": "+1234567890",
      "address": {
        "city": "San Jose",
        "country": "US",
        "postal_code": "94560",
        "state": "California",
        "state_code": "US-CA",
        "house_number_or_name": "10",
        "line1": "Stafford Appartments",
        "line2": "29th Street",
        "organization": "Gr4vy"
      },
      "tax_id": {
        "value": "12345678931",
        "kind": "us.ein"
      }
    },
    "account_number": "<string>",
    "shipping_details": {
      "first_name": "John",
      "last_name": "Doe",
      "email_address": "john@example.com",
      "phone_number": "+1234567890",
      "address": {
        "city": "San Jose",
        "country": "US",
        "postal_code": "94560",
        "state": "California",
        "state_code": "US-CA",
        "house_number_or_name": "10",
        "line1": "Stafford Appartments",
        "line2": "29th Street",
        "organization": "Gr4vy"
      }
    }
  },
  "airline": {
    "booking_code": "X36Q9C",
    "issued_address": "123 Broadway, New York",
    "issued_at": "2013-07-16T19:23:00.000+00:00",
    "issuing_carrier_code": "A3",
    "legs": [
      {
        "arrival_airport": "LAX",
        "arrival_at": "2013-07-16T19:23:00.000+00:00",
        "arrival_city": "Los Angeles",
        "arrival_country": "US",
        "carrier_code": "BA",
        "coupon_number": "15885566",
        "departure_airport": "LHR",
        "departure_at": "2013-07-16T19:23:00.000+00:00",
        "departure_city": "London",
        "departure_country": "GB",
        "departure_tax_amount": 1200,
        "fare_amount": 129900,
        "fare_basis_code": "FY",
        "fee_amount": 1200,
        "flight_class": "E",
        "flight_number": "101",
        "route_type": "round_trip",
        "stop_over": false,
        "tax_amount": 1200
      }
    ],
    "passenger_name_record": "JOHN L",
    "passengers": [
      {
        "age_group": "adult",
        "date_of_birth": "2013-07-16",
        "email_address": "john@example.com",
        "first_name": "John",
        "frequent_flyer_number": "15885566",
        "last_name": "Luhn",
        "passport_number": "11117700225",
        "phone_number": "+1234567890",
        "ticket_number": "BA1236699999",
        "title": "Mr.",
        "country_code": "US"
      }
    ],
    "reservation_system": "Amadeus",
    "restricted_ticket": false,
    "ticket_delivery_method": "electronic",
    "ticket_number": "123-1234-151555",
    "travel_agency_code": "12345",
    "travel_agency_invoice_number": "EG15555155",
    "travel_agency_name": "ACME Agency",
    "travel_agency_plan_name": "B733"
  },
  "type": "checkout-session",
  "id": "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
  "expires_at": "2013-07-16T19:23:00.000+00:00",
  "payment_method": {
    "type": "payment-method",
    "id": "ef9496d8-53a5-4aad-8ca2-00eb68334389",
    "details": {
      "bin": "411111",
      "card_country": "US",
      "card_type": "credit",
      "card_issuer_name": "Bank of America NA"
    },
    "label": "1234",
    "method": "card",
    "scheme": "visa",
    "fingerprint": "a50b85c200ee0795d6fd33a5c66f37a4564f554355c5b46a756aac485dd168a4"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-gr4vy-merchant-account-id
string | null

The ID of the merchant account to use for this request.

Examples:

"default"

Query Parameters

timeout_in_seconds
number
default:1

Body

application/json

Response

201
application/json
Successful Response

The response is of type object.