POST
/
v1
/
payments
/
customers
/
:customerId
/
payment-methods
curl https://api.geldstuck.com/v1/payments/customers/cus_01HX3ZR.../payment-methods \
  -H "x-api-key: $GELDSTUCK_PUBLIC_KEY" \
  -H "x-api-secret: $GELDSTUCK_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"paymentMethodId": "pm_01HX3ZS...", "setDefault": true}'
{
  "id": "pm_01HX3ZS...",
  "type": "card",
  "card": { "brand": "visa", "last4": "4242" },
  "isDefault": true
}
Typical flow: collect payment details in your client checkout flow, receive a paymentMethodId, then attach it here.

Path parameters

customerId
string
required

Body

paymentMethodId
string
required
The payment method ID returned by your client checkout flow.
setDefault
boolean
default:"false"

Returns

The attached payment method.
curl https://api.geldstuck.com/v1/payments/customers/cus_01HX3ZR.../payment-methods \
  -H "x-api-key: $GELDSTUCK_PUBLIC_KEY" \
  -H "x-api-secret: $GELDSTUCK_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"paymentMethodId": "pm_01HX3ZS...", "setDefault": true}'
{
  "id": "pm_01HX3ZS...",
  "type": "card",
  "card": { "brand": "visa", "last4": "4242" },
  "isDefault": true
}