Skip to content
ajar.Get started

Checkout payment method

booking.checkout.payment_method

View connector

Attach a card to a prepared checkout with an explicit save preference

POST /v1/operations/booking.checkout.payment_method

Headers

Authorization: Bearer YOUR_CONNECTOR_TOKEN
x-booking-token: YOUR_BOOKING_TOKEN
x-idempotency-key: YOUR_UNIQUE_ATTEMPT_KEY
Content-Type: application/json

x-idempotency-key identifies one intended action. Generate a unique value, such as crypto.randomUUID(), before sending it. Use 1–128 letters, numbers, hyphens, underscores or periods. A duplicate attempt is rejected; it does not return a cached success. If a request times out, check the provider’s state before starting a new attempt with a new key. See the idempotency guide.

Use your connector bearer token and caller-held guest token in x-booking-token.

Inputs

ParameterExample typeExample value
checkout_refstring"fictional-checkout-ref"
cardobject{"card_number":"4242424242424242","cvc":"123","cardholder":"Alex Example","expiry_month":12,"expiry_year":2030}
save_cardbooleanfalse
confirm_attachbooleantrue

Example input

{
  "checkout_ref": "fictional-checkout-ref",
  "card": {
    "card_number": "4242424242424242",
    "cvc": "123",
    "cardholder": "Alex Example",
    "expiry_month": 12,
    "expiry_year": 2030
  },
  "save_card": false,
  "confirm_attach": true
}
Open JSON schema

Input schema

{
  "$id": "https://useajar.com/schemas/booking/checkout-payment-method.input.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "card": {
      "additionalProperties": false,
      "properties": {
        "card_number": {
          "pattern": "^[0-9]{12,19}$",
          "type": "string",
          "x-sensitive": true
        },
        "cardholder": {
          "maxLength": 120,
          "minLength": 1,
          "type": "string",
          "x-sensitive": true
        },
        "cvc": {
          "pattern": "^[0-9]{3,4}$",
          "type": "string",
          "x-sensitive": true
        },
        "expiry_month": {
          "maximum": 12,
          "minimum": 1,
          "type": "integer",
          "x-sensitive": true
        },
        "expiry_year": {
          "maximum": 2100,
          "minimum": 2026,
          "type": "integer",
          "x-sensitive": true
        }
      },
      "required": [
        "card_number",
        "cvc",
        "cardholder",
        "expiry_month",
        "expiry_year"
      ],
      "type": "object"
    },
    "checkout_ref": {
      "maxLength": 128,
      "minLength": 1,
      "type": "string"
    },
    "confirm_attach": {
      "const": true
    },
    "save_card": {
      "type": "boolean"
    }
  },
  "required": [
    "checkout_ref",
    "save_card",
    "confirm_attach",
    "card"
  ],
  "type": "object"
}