Skip to main content
POST
Attach a Payment Method to a PaymentIntent

Authorizations

Authorization
string
header
required

Use your secret API key. Example: Authorization: Bearer sk_test_xxx

Headers

Xerobi-Version
string
default:2026-01-01
required

API version header. Use '2026-01-01' for the latest version.

Idempotency-Key
string

Idempotency key for safely retrying POST requests.

Path Parameters

id
string
required

Body

application/json
payment_method
string
required
save_to_customer
boolean

If true and customer provided, save as default payment method

Response

Updated PaymentIntent

Represents an intent to collect payment from a customer. Use confirm to finalize.

id
string
required
Example:

"pi_1Hh1X2AbCdEf"

amount
integer
required

Amount in smallest currency unit

Example:

1500

currency
string
required
Example:

"BDT"

status
enum<string>
required
Available options:
requires_payment_method,
requires_confirmation,
processing,
succeeded,
requires_action,
canceled
Example:

"requires_payment_method"

client_secret
string
required

Client-side secret used by frontends

Example:

"cs_test_abc"

object
string
Example:

"payment_intent"

capture_method
enum<string>
Available options:
automatic,
manual
Example:

"automatic"

customer
string | null
Example:

"cus_123"

payment_method
string | null
Example:

"pm_card_abc"

metadata
object
created_at
string<date-time>
updated_at
string<date-time>
charges
object[]