BillKit/DocsConsole
Checkout

Create one-shot payment

Charge an existing customer once, with no subscription and no stored mandate.

POST/v1/checkout/one_shot
Operation create_one_shot·Scope checkout_sessions:write·OpenAPI v1.1.0

Parameters

ParameterDescription
amount_centsintegerrequiredAmount in minor units of currency. Gross or net according to tax_behavior; the response's amount_cents is what is actually charged. Maximum 99999999.
currencystringrequiredThree-letter ISO 4217 currency code. Case-insensitive; stored uppercase. At most 3 characters.
customer_idstringrequiredId of the customer being charged. At most 64 characters.
success_urlstring (uri)requiredWhere the payer is sent after the payment. Must be an absolute URL. At most 2083 characters.
cancel_urlstring (uri) | nulloptionalWhere the payer is sent if they leave without paying. Optional. Must be an absolute URL. At most 2083 characters.
descriptionstring | nulloptionalWhat is being paid for. Shown on the payment page and the payer's bank statement, and used as the invoice line. At most 255 characters.
metadataobject | nulloptionalKey-value pairs stored on the payment and echoed on it and its events. At most 50 keys.
payment_methodenum | nulloptionalThe payment method to charge with, checked against the methods your account can accept in this currency. Required when ui_mode is hosted; must be omitted when it is embedded, where the buyer picks the method. One of creditcard, ideal, bancontact, eps, applepay, paypal, banktransfer.
refund_window_daysinteger | nulloptionalDays after the payment settles during which it can be refunded. Null uses the default of 30 days; 0 disables refunds. Between 0 and 365.
tax_behaviorenum | nulloptionalinclusive: amount_cents includes VAT. exclusive: VAT is added on top of amount_cents. Null uses the default of the tax rate for the customer's country. One of inclusive, exclusive.
ui_modeenumoptionalhosted creates the payment now and returns a redirect_url for the payer. embedded creates no payment yet and returns a client_secret for the embedded payment element. One of hosted, embedded. Defaults to "hosted".

Returns

Returns an OneShotPaymentResponse object.

Errors

StatusCause
400The request was refused (type: invalid_request_error): a required parameter is missing (parameter_missing), one failed validation (parameter_invalid) or is not one the operation takes (parameter_unknown), and param names it.
401No credential, or one that does not authenticate.
402The account is suspended (tenant_suspended), or the payment provider refused a charge or refund the call made (type: payment_error, code: payment_refused).
403Authenticated, but not allowed: missing scope (insufficient_scope), a key of the wrong mode (mode_mismatch), or a refused origin. Needs the checkout_sessions:write scope.
404No such object in this account and mode.
409Conflicts with the object's current state (state_conflict, or a more specific code), or an operation still in flight (operation_pending).
413The request body is larger than the API accepts.
429Rate limited. Retry-After says when to try again.
500Something failed on BillKit's side (type: api_error). Retry with the same Idempotency-Key.
502The payment provider failed or did not answer.
503Temporarily unable to serve. reason says whether the request was attempted.
Request · curl
curl -X POST https://api.billkit.eu/v1/checkout/one_shot \
  -H "Authorization: Bearer $BILLKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount_cents":1900,"currency":"EUR","customer_id":"cus_9XKp2vQ1","success_url":"https://acme.example/welcome"}'
Request body · every field
{
  "amount_cents": 1900,
  "cancel_url": "https://acme.example/welcome",
  "currency": "EUR",
  "customer_id": "cus_9XKp2vQ1",
  "description": "string",
  "metadata": {
    "key": "value"
  },
  "payment_method": "creditcard",
  "refund_window_days": 0,
  "success_url": "https://acme.example/welcome",
  "tax_behavior": "inclusive",
  "ui_mode": "hosted"
}
Response · 200 OK
{
  "amount_cents": 1900,
  "amount_disputed_cents": 1900,
  "amount_refundable_cents": 1900,
  "amount_refunded_cents": 1900,
  "cancel_url": "https://acme.example/welcome",
  "client_secret": "string",
  "created": 1789392000,
  "currency": "EUR",
  "customer_id": "cus_9XKp2vQ1",
  "description": "string",
  "expires_at": 1789392000,
  "failure_reason": "string",
  "id": "osp_9XKp2vQ1",
  "livemode": false,
  "metadata": {},
  "net_cents": 1900,
  "object": "one_shot_payment",
  "paid_at": 1789392000,
  "payment_method": "creditcard",
  "redirect_url": "https://acme.example/welcome",
  "status": "open",
  "success_url": "https://acme.example/welcome",
  "tax_cents": 1900,
  "tax_reverse_charged": false,
  "ui_mode": "hosted"
}