Skip to content

Add Payment Method

POST
/v1/account/payment_methods

Add a payment method to a shopper's Bolt account Wallet. For security purposes, this request must come from your backend because authentication requires the use of your private key.

Note: Before using this API, the credit card details must be tokenized using Bolt's JavaScript library function, which is documented in Install the Bolt Tokenizer.

Authorization

OAuth bolt.account.manageX-API-Key
AuthorizationBearer <token>

Bolt utilizes the OAuth flow that developers can use to attain access to Bolt Account data via APIs. For all APIs that require authorization, please provide your access_token returned from /v1/oauth/token via the basic auth bearer header Authorization: bearer ${TOKEN}. Read more about the OAuth token endpoint.

In: header

Scope: bolt.account.manage

X-API-Key<token>

Admins and Developers can obtain their Bolt API key from the Bolt Merchant Dashboard.

In: header

Header Parameters

X-Publishable-Key?string

The publicly viewable identifier used to identify a merchant division. This key is found in the Developer > API section of the Bolt Merchant Dashboard [RECOMMENDED].

Idempotency-Key?string

A key created by merchants that ensures POST and PATCH requests are only performed once. Read more about Idempotent Requests here.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

The credit_card object is used to to pay for guest checkout transactions or save payment method details to an account. Once saved, you can reference the credit card with the associated credit_card_id for future transactions.

Response Body

application/json

curl -X POST "https://example.com/v1/account/payment_methods" \  -H "Content-Type: application/json" \  -d '{    "billing_address": {      "country_code": "US",      "email": "alan.watts@example.com",      "first_name": "Alan",      "last_name": "Watts",      "locality": "Brooklyn",      "postal_code": "10044",      "region": "NY",      "street_address1": "888 main street"    },    "expiration": "2025-11",    "token": "a1B2c3D4e5F6G7H8i9J0k1L2m3N4o5P6Q7r8S9t0"  }'
{  "billing_address": {    "company": "Bolt",    "country": "United States",    "country_code": "US",    "door_code": "123456",    "email_address": "alan.watts@example.com",    "first_name": "Alan",    "id": "string",    "last_name": "Watts",    "locality": "Brooklyn",    "name": "Alan Watts",    "phone_number": "+12125550199",    "postal_code": "10044",    "priority": "primary",    "region": "NY",    "region_code": "NY",    "street_address1": "888 main street",    "street_address2": "apt 3021",    "street_address3": "c/o Alicia Watts",    "street_address4": "Bridge Street Apartment Building B"  },  "id": "string",  "last4": "4021",  "exp_month": 11,  "exp_year": 2024,  "network": "visa",  "default": true,  "type": "card",  "description": "string",  "metadata": {    "customer_id": 234  }}