POST
/
checkout
/
sessions
curl --request POST \
  --url https://api.{gr4vy_id}.gr4vy.app/checkout/sessions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "cart_items": [
    {
      "name": "GoPro HERO9 Camcorder",
      "quantity": 1,
      "unit_amount": 37999,
      "discount_amount": 49999999,
      "tax_amount": 49999999,
      "external_identifier": "item-789123",
      "sku": "sku-789123",
      "product_url": "https://example.com/items/gopro",
      "image_url": "https://example.com/images/items/gopro.png",
      "categories": [
        "<string>"
      ],
      "product_type": "physical"
    }
  ],
  "metadata": {
    "key": "value"
  }
}'
{
  "type": "checkout-session",
  "id": "8d3fe99b-1422-42e6-bbb3-932d95ae5f79",
  "expires_at": "2022-01-01T00:00:00+00:00",
  "cart_items": [
    {
      "name": "GoPro HERO9 Camcorder",
      "quantity": 1,
      "unit_amount": 37999,
      "discount_amount": 49999999,
      "tax_amount": 49999999,
      "external_identifier": "item-789123",
      "sku": "sku-789123",
      "product_url": "https://example.com/items/gopro",
      "image_url": "https://example.com/images/items/gopro.png",
      "categories": [
        "<string>"
      ],
      "product_type": "physical"
    }
  ],
  "metadata": {
    "key": "value"
  },
  "payment_method": {
    "type": "payment_method",
    "id": "<string>",
    "method": "card",
    "scheme": "visa",
    "label": "4242",
    "details": {
      "bin": "411111",
      "card_type": "credit",
      "card_country": "US"
    },
    "fingerprint": "20eb353620155d2b5fc864cc46a73ea77cb92c725238650839da1813fa987a17"
  }
}

This endpoint requires the checkout-sessions.write scope.

Authorizations

Authorization
string
headerrequired

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

Body

application/json
cart_items
object[] | null

An array of cart items that represents the line items of a transaction.

metadata
object | null

Any additional information about the transaction that you would like to store as key-value pairs. This data is passed to payment service providers that support it.

Response

201 - application/json
type
enum<string>

checkout-session.

Available options:
checkout-session
id
string

The ID of the Checkout Session.

expires_at
string

The date and time when the Checkout Session will expire. By default this will be set to 1 hour from the date of creation.

cart_items
object[] | null

An array of cart items that represents the line items of a transaction.

metadata
object | null

Any additional information about the transaction that you would like to store as key-value pairs. This data is passed to payment service providers that support it.

payment_method
object | null

Details about the payment method for card type only.