Skip to main content

Create Card Setup Token

POST 

/api/customers/:customer/payment-methods/setup-token

Starts saving a card for the customer.

Required scope: customers:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

  • Stripe (processor: stripe): returns a Stripe SetupIntent client secret plus the keys Stripe.js needs (the publishable key and the connected account it acts on). Collect the card with Stripe Elements and confirm the SetupIntent in the browser, then call Confirm Card Setup with the setup_intent_id. The customer's existing Stripe customer on that account is reused; otherwise, when the customer has an email address, one is found or created.
  • Authorize.net (processor: authorize_net): returns accept_js — the configuration for Authorize.net's hosted card form (Accept.js / AcceptUI): script_url, api_login_id, public_client_key, environment. Open the hosted form in the browser; it returns single-use opaque card data (valid 15 minutes) to send to Confirm Card Setup.

The card number never reaches SKU.io.

Authentication: Requires Bearer token (PAT). Permission: customers.update.

Request body fields:

  • processor (string, nullable: stripe | authorize_net) — which processor to save the card with. Defaults to the default card processor (Payment Collection settings).
  • integration_instance_id (integer, nullable) — which connected account to save the card on, when there is more than one. Defaults to the first connected account that can take payments.

Response fields: processor, integration_instance_id, client_secret and setup_intent_id (Stripe; empty strings for Authorize.net), publishable_key (Stripe publishable key; for Authorize.net the account's Public Client Key), connected_account_id (Stripe connected account; for Authorize.net the gateway id) and accept_js (Authorize.net: environment (sandbox | production), script_url (hosted AcceptUI form), accept_js_url (Accept.js library), api_login_id, public_client_key; null for Stripe).

Returns 422 when no account of that processor can take payments, the Authorize.net account has no Public Client Key (card entry is off until one is generated), or the processor refuses the request.

Request​

Responses​

OK

Response Headers
    Content-Type