API ReferenceEndpointsCheckoutCreate payment intent

Create payment intent

Creates a payment intent with the store payment provider for a checkout and returns what the storefront needs to confirm it client-side (intent id, clientSecret, amount, currency, status, provider and clientSdk settings). Pass expectedTotal so a tax change since the buyer saw the total is refused instead of charged. Limited to 10 requests per minute per IP.

POST
/vc/{connectionId}/payment/intent
X-Sales-Channel-Origin<token>

For /api/vc/{connectionId}/* routes the connectionId (vc_*) is in the URL path — not a header. Live-mode requests must also send a matching Origin header.

In: header

Path Parameters

connectionIdstring

Sales channel ID (vc_*), the canonical salesChannelId. connectionId is the deprecated name of the same value and is still the literal path segment.

Header Parameters

originstring

Origin of the storefront page making the call, for example https://shop.example.com. Required: a request with no Origin header is refused with 403. On a LIVE channel its host must equal the channel's registered domain (or one of its subdomains) or match an allowed origin. A TEST channel with no domain accepts any origin; once a domain is set it is matched as on LIVE.

X-SDK-Version?string

Version of the calling SDK (the Brainerce SDK sends it automatically). Informational: it is recorded on the channel and never changes the response.

checkoutIdstring

Checkout to collect payment for.

Lengthlength <= 100
providerId?string

Route the charge to a specific installed provider — the id from a getPaymentProviders() entry. Omit to settle through the store’s primary card processor.

Lengthlength <= 100
successUrl?string

Where the provider returns the shopper on success.

Lengthlength <= 2048
cancelUrl?string

Where the provider returns the shopper on cancel.

Lengthlength <= 2048
saveCard?boolean

Whether to store the card for future purchases.

preferredRenderType?string

How the storefront would like the provider’s payment surface presented. Honoured when the provider lists that mode in its clientSdk.displayModes (see getPaymentProviders()); otherwise the provider’s default is returned and the response says renderModeResolution: "fallback". Never an error. Always branch on the clientSdk.renderType that comes BACK. Omit to take the provider default. Ignored on sandbox intents.

Value in"redirect" | "iframe"
expectedTotal?number

The checkout total (store base currency, major units) the buyer was last shown. Tax is re-verified against the current cart, address, shipping, discount and tax rates before any payment is created; if the total is not exactly this number the request is refused with HTTP 409 CHECKOUT_TOTAL_CHANGED and NOTHING is charged. The body carries previousTotal, newTotal, previousTax, newTax and currency: show the buyer the new total and retry with expectedTotal = newTotal once they accept it. Compared in the minor unit of the checkout currency. Omit it to keep the previous behaviour (the refreshed total is charged without asking).

Range0 <= value <= 1000000000000
curl -X POST "https://api.brainerce.com/api/vc/string/payment/intent" \  -H "origin: string" \  -H "X-SDK-Version: string" \  -H "Content-Type: application/json" \  -d '{    "checkoutId": "clcheckout_abc123"  }'
{
  "id": "pi_3ABC...",
  "clientSecret": "string",
  "amount": "46.96",
  "currency": "ILS",
  "status": "requires_payment_method",
  "provider": "stripe",
  "clientSdk": {
    "renderType": "sdk-widget",
    "initConfig": {},
    "renderArg": "string",
    "embeddedFieldsUrl": "string",
    "embeddedFieldsSessionId": "string",
    "embeddedFieldsProvider": "cardcom"
  },
  "renderModeResolution": "provider-default"
}

{
  "statusCode": 400,
  "code": "VALIDATION_FAILED",
  "message": "name should not be empty, price must be a positive number",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/vc/{connectionId}/payment/intent"
}

{
  "statusCode": 403,
  "code": "INSUFFICIENT_SCOPE",
  "message": "API key does not have the required scope: products:write",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/vc/{connectionId}/payment/intent"
}

{
  "statusCode": 404,
  "code": "RESOURCE_NOT_FOUND",
  "message": "Resource not found",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/vc/{connectionId}/payment/intent"
}

{
  "statusCode": 409,
  "code": "CONFLICT",
  "message": "The request conflicts with the current state of the resource",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/vc/{connectionId}/payment/intent"
}

{
  "statusCode": 429,
  "code": "RATE_LIMITED",
  "message": "Too many requests",
  "details": {
    "retryAfterSeconds": 12
  },
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/vc/{connectionId}/payment/intent"
}

{
  "statusCode": 503,
  "code": "INTERNAL_SERVER_ERROR",
  "message": "Internal server error",
  "timestamp": "2026-08-23T10:15:00.000Z",
  "path": "/api/vc/{connectionId}/payment/intent"
}