Session reference

Complete field reference for the VINR Checkout session API — request, response, statuses, and errors.

View as MarkdownInstall skills

Every field accepted by POST /checkout/session. Only amount, currency, successUrl, and cancelUrl are required. The rest unlock cart UI, promo codes, delivery, and branding.

Endpoint summaryAsk

MethodPOST
Path/checkout/session
Base URLhttps://api.vinr.com
AuthenticationX-Api-Key: <merchant-api-key> header
Content-Typeapplication/json
IdempotencyPass Idempotency-Key: <uuid> to safely retry on network failure

Top-level fieldsAsk

Prop

Type

Customer objectAsk

Prop

Type

Cart itemAsk

Prop

Type

MetadataAsk

The metadata object controls optional checkout behaviors. All fields are optional.

Mode and branding

FieldTypeDescription
mode"payment" | "subscription"Displays payment or subscription UI language. Defaults to "payment".
merchantNamestringOverrides the merchant display name shown on the checkout page.

Shipping address

FieldTypeDescription
shippingAddressHandling"Collect" | "Skip""Collect" shows a shipping address form. "Skip" omits it.

Promo codes

Prop

Type

Each entry in availableCodes:

FieldTypeDescription
codestringThe code the customer enters, e.g. "SAVE20".
discountnumberDiscount value. Interpret with discountType.
discountType"percentage" | "fixed""percentage": 0–100. "fixed": minor units.
descriptionstringHuman-readable label shown after the code is applied.

Delivery

Prop

Type

Each ShippingMethod:

FieldTypeDescription
idstringYour internal method identifier.
namestringDisplay name, e.g. "UPS Standard".
priceintegerCost in minor units.
currencystringISO 4217 code for the shipping cost.
estimatedDays.minintegerMinimum estimated delivery days.
estimatedDays.maxintegerMaximum estimated delivery days.

Full example payloadAsk

{
  "amount": 5000,
  "currency": "EUR",
  "successUrl": "https://yoursite.com/order/success",
  "cancelUrl": "https://yoursite.com/cart",
  "customer": {
    "customerId": "cust_abc123",
    "email": "jane@example.com",
    "name": "Jane Smith",
    "phone": "+12125551234"
  },
  "cartItems": [
    {
      "id": "item_001",
      "name": "Wireless headphones",
      "description": "Over-ear, noise cancelling",
      "price": 5000,
      "quantity": 1,
      "image": "https://yoursite.com/images/headphones.jpg",
      "maxQuantity": 5
    }
  ],
  "supportedCurrencies": ["EUR", "USD", "GBP"],
  "configId": "default-config",
  "metadata": {
    "mode": "payment",
    "merchantName": "Demo Store",
    "shippingAddressHandling": "Collect",
    "promoCode": {
      "enabled": true,
      "availableCodes": [
        {
          "code": "SAVE20",
          "discount": 20,
          "discountType": "percentage",
          "description": "20% off your order"
        }
      ]
    },
    "delivery": {
      "enabled": true,
      "options": {
        "shipping": {
          "methods": [
            {
              "id": "ups_standard",
              "name": "UPS Standard",
              "price": 599,
              "currency": "EUR",
              "estimatedDays": { "min": 3, "max": 5 }
            },
            {
              "id": "ups_express",
              "name": "UPS Express",
              "price": 1299,
              "currency": "EUR",
              "estimatedDays": { "min": 1, "max": 2 }
            }
          ]
        },
        "pickup": {
          "locations": [
            { "id": "loc_berlin_mitte", "name": "Berlin Mitte Store" }
          ]
        }
      }
    }
  }
}

Response objectAsk

The response from POST /checkout/session:

Prop

Type

Verify a session resultAsk

Use this endpoint after the customer returns to successUrl to confirm the payment status before fulfilling an order.

GET /checkout/session/{sessionId}/result — same X-Api-Key header.

interface SessionResult {
  sessionId: string;
  status:
    | 'pending'
    | 'authentication_required'
    | 'completed'
    | 'failed'
    | 'canceled'
    | 'expired';
  amount: number;
  currency: string;
  customer?: {
    customerId?: string;
    email?: string;
    name?: string;
  };
}

async function verifySession(sessionId: string): Promise<SessionResult> {
  const res = await fetch(
    `${process.env.INTENT_API_URL}/checkout/session/${sessionId}/result`,
    { headers: { 'X-Api-Key': process.env.VINR_API_KEY! } }
  );
  if (!res.ok) throw new Error(`Unexpected status ${res.status}`);
  return res.json();
}

const result = await verifySession(sessionId);

if (result.status === 'completed') {
  await fulfillOrder(result);
} else if (result.status === 'failed') {
  await notifyCustomerOfFailure(result);
} else if (result.status === 'expired') {
  await redirectToNewSession();
} else if (result.status === 'canceled') {
  await redirectToCart();
} else if (result.status === 'authentication_required') {
  // 3DS is still in progress — poll again shortly or wait for the webhook
}

Status referenceAsk

StatusMeaningRecommended action
pendingSession created; customer has not completed payment.Wait or poll.
authentication_required3DS challenge in progress.Poll until status changes.
completedPayment captured successfully.Fulfill the order.
failedPayment declined or error during processing.Prompt the customer to retry with a new session.
canceledCustomer clicked Cancel on the hosted page.Return the customer to their cart.
expiredSession was not completed within the 5-minute window.Create a new session.

ErrorsAsk

HTTP statusMeaning
400Invalid request parameters — check field types and required fields.
401Missing or invalid X-Api-Key.
404Session ID not found.
410Session has expired. Create a new session.
429Rate limit exceeded — back off and retry with exponential delay.
Was this page helpful?
Edit on GitHub

Last updated on

On this page