# Add Payment Method

> 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](https://help.boltapp.com/developers/references/bolt-tokenizer).

Source: https://help.boltapp.com/api-reference/endpoints/account/addpaymentmethod

`POST /v1/account/payment_methods`

## OpenAPI definition

This endpoint as it appears in the OpenAPI document, with every schema it references included.

```json
{
  "openapi": "3.2.0",
  "info": {
    "version": "1.0.1",
    "title": "Bolt API Reference",
    "description": "Postman Collection:\n\n[![](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/9136127-55d2bde1-a248-473f-95b5-64cfd02fb445?action=collection%2Ffork&collection-url=entityId%3D9136127-55d2bde1-a248-473f-95b5-64cfd02fb445%26entityType%3Dcollection%26workspaceId%3D78beee89-4238-4c5f-bd1f-7e98978744b4#?env%5BBolt%20Sandbox%20Environment%5D=W3sia2V5IjoiYXBpX2Jhc2VfdXJsIiwidmFsdWUiOiJodHRwczovL2FwaS1zYW5kYm94LmJvbHQuY29tIiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6InRrX2Jhc2UiLCJ2YWx1ZSI6Imh0dHBzOi8vc2FuZGJveC5ib2x0dGsuY29tIiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfSx7ImtleSI6ImFwaV9rZXkiLCJ2YWx1ZSI6IjxyZXBsYWNlIHdpdGggeW91ciBCb2x0IFNhbmRib3ggQVBJIGtleT4iLCJ0eXBlIjoic2VjcmV0IiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJwdWJsaXNoYWJsZV9rZXkiLCJ2YWx1ZSI6IjxyZXBsYWNlIHdpdGggeW91ciBCb2x0IFNhbmRib3ggcHVibGlzaGFibGUga2V5PiIsInR5cGUiOiJkZWZhdWx0IiwiZW5hYmxlZCI6dHJ1ZX0seyJrZXkiOiJkaXZpc2lvbl9pZCIsInZhbHVlIjoiPHJlcGxhY2Ugd2l0aCB5b3VyIEJvbHQgU2FuZGJveCBwdWJsaWMgZGl2aXNpb24gSUQ+IiwidHlwZSI6ImRlZmF1bHQiLCJlbmFibGVkIjp0cnVlfV0=)\n\n## About\n A comprehensive Bolt API reference for interacting with Transactions, Orders, Product Catalog, Configuration, Testing, and much more.\n\n Note: You must also reference the [Merchant Callback API](/api-merchant) when building a managed checkout custom cart integration\n"
  },
  "servers": [
    {
      "url": "https://api.boltapp.com",
      "description": "The Production URL (Live Data)."
    },
    {
      "url": "https://api-sandbox.boltapp.com",
      "description": "The Sandbox URL (Test Data)."
    },
    {
      "url": "https://api-staging.boltapp.com",
      "description": "The Staging URL (Staged Data)."
    }
  ],
  "security": [
    {
      "X-API-Key": []
    },
    {
      "OAuth": [
        "bolt.account.manage",
        "bolt.account.view"
      ]
    }
  ],
  "paths": {
    "/v1/account/payment_methods": {
      "post": {
        "description": "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.\n\n**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](https://help.boltapp.com/developers/references/bolt-tokenizer).\n",
        "operationId": "addPaymentMethod",
        "parameters": [
          {
            "$ref": "#/components/parameters/x-publishable-key"
          },
          {
            "$ref": "#/components/parameters/idempotency_key"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/credit_card_account"
                  },
                  {
                    "properties": {
                      "currency": {
                        "description": "This can be left empty. A 3-digit ISO code for currency that will be used in the credit card authorization.",
                        "type": "string",
                        "examples": [
                          "USD"
                        ]
                      }
                    },
                    "type": "object"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/saved_credit_card_view"
                }
              }
            },
            "description": "Payment Method Added"
          }
        },
        "security": [
          {
            "OAuth": [
              "bolt.account.manage"
            ],
            "X-API-Key": []
          }
        ],
        "summary": "Add Payment Method",
        "tags": [
          "Account"
        ]
      }
    }
  },
  "components": {
    "parameters": {
      "x-publishable-key": {
        "description": "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].",
        "in": "header",
        "name": "X-Publishable-Key",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "idempotency_key": {
        "description": "A key created by merchants that ensures `POST` and `PATCH` requests are only performed once. [Read more about Idempotent Requests here](/developers/references/idempotency/).",
        "in": "header",
        "name": "Idempotency-Key",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "credit_card_account": {
        "description": "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.\n",
        "properties": {
          "billing_address": {
            "$ref": "#/components/schemas/address"
          },
          "billing_address_id": {
            "description": "The unique Bolt ID associated with a saved shopper address. This can be obtained by accessing a shopper's account details. If you use this field, you do not need to use `billing_address`.\n",
            "type": [
              "string",
              "null"
            ],
            "examples": [
              null
            ]
          },
          "bin": {
            "description": "The Bank Identification Number for the credit card. This is typically the first 4-6 digits of the credit card number.",
            "maxLength": 6,
            "minLength": 4,
            "type": "string",
            "examples": [
              411111
            ]
          },
          "cryptogram": {
            "type": "string"
          },
          "eci": {
            "type": "string"
          },
          "expiration": {
            "description": "The expiration date of the credit card.",
            "type": "string",
            "examples": [
              "2025-11"
            ]
          },
          "last4": {
            "description": "The last 4 digits of the credit card number.",
            "maxLength": 4,
            "minLength": 4,
            "type": "string",
            "examples": [
              "1234"
            ]
          },
          "metadata": {
            "$ref": "#/components/schemas/shopper_metadata"
          },
          "network": {
            "enum": [
              "visa",
              "mastercard",
              "amex",
              "discover",
              "dinersclub",
              "jcb",
              "unionpay",
              "alliancedata",
              "citiplcc",
              "unknown"
            ],
            "type": "string"
          },
          "number": {
            "description": "Used to provide ApplePay DPAN or private label credit card PAN when applicable. Required when charging a private label credit card.",
            "type": "string"
          },
          "postal_code": {
            "description": "Used for the postal or zip code associated with the credit card.",
            "maxLength": 32,
            "type": "string",
            "examples": [
              "10044"
            ]
          },
          "priority": {
            "description": "Used to indicate the card's priority. '1' indicates primary, while '2' indicates a secondary card.\n",
            "enum": [
              1,
              2
            ],
            "type": "integer"
          },
          "save": {
            "description": "Determines whether or not the credit card will be saved to the shopper's account. Defaults to `true`.\n",
            "type": "boolean"
          },
          "token": {
            "description": "The Bolt token associated to the credit card.",
            "type": "string",
            "examples": [
              "a1B2c3D4e5F6G7H8i9J0k1L2m3N4o5P6Q7r8S9t0"
            ]
          },
          "token_type": {
            "description": "Used to define which payment processor generated the token for this credit card. For those using Bolt's tokenizer, the value must be `bolt`.\n",
            "enum": [
              "vantiv",
              "applepay",
              "bolt",
              "stripe",
              "plcc"
            ],
            "type": "string",
            "examples": [
              "bolt"
            ]
          }
        },
        "required": [
          "token",
          "expiration",
          "billing_address"
        ],
        "type": "object"
      },
      "address": {
        "description": "The Address object is used for billing, shipping, and physical store address use cases.",
        "properties": {
          "company": {
            "description": "The company name associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Bolt"
            ]
          },
          "country": {
            "description": "The name of the country associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "United States"
            ]
          },
          "country_code": {
            "description": "The ISO 3166-1 alpha-2 country code associated with this address.",
            "maxLength": 2,
            "minLength": 2,
            "type": "string",
            "examples": [
              "US"
            ]
          },
          "default": {
            "description": "Whether the added address is now the default address.",
            "type": "boolean",
            "examples": [
              true
            ]
          },
          "door_code": {
            "$ref": "#/components/schemas/door_code"
          },
          "email": {
            "description": "The email address associated with this address.",
            "$ref": "#/components/schemas/email"
          },
          "first_name": {
            "description": "The given name of the person associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Alan"
            ]
          },
          "last_name": {
            "description": "The surname of the person associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Watts"
            ]
          },
          "locality": {
            "description": "The city name details associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Brooklyn"
            ]
          },
          "name": {
            "description": "The given and surname of the person associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "Alan Watts"
            ]
          },
          "phone": {
            "description": "The phone number associated with this address.",
            "$ref": "#/components/schemas/phone"
          },
          "postal_code": {
            "description": "The the postal or zip code associated with this address.",
            "maxLength": 32,
            "type": "string",
            "examples": [
              "10044"
            ]
          },
          "region": {
            "description": "**Not Required for NON US addresses**. The region details such as state or province associated with this address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "NY"
            ]
          },
          "region_code": {
            "description": "The ISO 3166-2 region code associated with this address.\n  - * If specified, value must be valid for the `country`.\n  - * If null, value is inferred from the `region`.\n",
            "maxLength": 1024,
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "NY"
            ]
          },
          "street_address1": {
            "description": "The street number and street name of the address.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "888 main street"
            ]
          },
          "street_address2": {
            "description": "Any apartment, floor, or unit details.",
            "maxLength": 1024,
            "type": "string",
            "examples": [
              "apt 3021"
            ]
          },
          "street_address3": {
            "description": "Any additional street address details.",
            "maxLength": 1024,
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "c/o Alicia Watts"
            ]
          },
          "street_address4": {
            "description": "Any additional street address details.",
            "maxLength": 1024,
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "Bridge Street Apartment Building B"
            ]
          }
        },
        "required": [
          "street_address1",
          "locality",
          "region",
          "country_code",
          "postal_code",
          "email",
          "first_name",
          "last_name"
        ],
        "type": "object"
      },
      "door_code": {
        "description": "The building door code or community gate code.",
        "maxLength": 1024,
        "type": [
          "string",
          "null"
        ],
        "examples": [
          "123456"
        ]
      },
      "email": {
        "description": "An email address.",
        "format": "email",
        "type": "string",
        "maxLength": 255,
        "examples": [
          "alan.watts@example.com"
        ]
      },
      "phone": {
        "description": "A phone number following E164 standards, in its globalized format, i.e. prepended with a plus sign.",
        "maxLength": 16,
        "type": "string",
        "examples": [
          "+12125550199"
        ]
      },
      "shopper_metadata": {
        "description": "A key-value pair object that allows users to store arbitrary information associated with an object. For any individual account object, we allow up to 50 keys. Keys can be up to 40 characters long and values can be up to 500 characters long. Metadata should not contain any sensitive customer information, like PII (Personally Identifiable Information). For more information about metadata, see our [documentation](https://help.boltapp.com/developers/references/embedded-metadata/).\n",
        "properties": {
          "additionalProperties": {
            "type": "string"
          }
        },
        "type": [
          "object",
          "null"
        ],
        "examples": [
          {
            "customer_id": 234
          }
        ]
      },
      "saved_credit_card_view": {
        "properties": {
          "billing_address": {
            "$ref": "#/components/schemas/address_view"
          },
          "id": {
            "description": "The ID of the payment method associated with the Shopper's account.",
            "type": "string"
          },
          "last4": {
            "$ref": "#/components/schemas/card_last4"
          },
          "exp_month": {
            "description": "The expiration month of the credit card.",
            "maxLength": 2,
            "minLength": 1,
            "type": "integer",
            "examples": [
              11
            ]
          },
          "exp_year": {
            "description": "The expiration year of the credit card.",
            "maxLength": 4,
            "minLength": 4,
            "type": "integer",
            "examples": [
              2024
            ]
          },
          "network": {
            "$ref": "#/components/schemas/card_network"
          },
          "default": {
            "description": "The default card payment method chosen by the shopper.",
            "type": "boolean"
          },
          "type": {
            "description": "The payment method type. If empty, the property defaults to `card`.",
            "enum": [
              "card",
              "paypal"
            ],
            "type": "string"
          },
          "description": {
            "description": "The APM account identifier; usually the email address.",
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/shopper_metadata"
          }
        },
        "type": "object",
        "description": "Saved Credit Card Detail"
      },
      "address_view": {
        "description": "The address object returned in the response.",
        "properties": {
          "company": {
            "description": "The company name associated with this address.",
            "type": "string",
            "examples": [
              "Bolt"
            ]
          },
          "country": {
            "description": "The name of the country associated with this address.",
            "type": "string",
            "examples": [
              "United States"
            ]
          },
          "country_code": {
            "description": "The ISO 3166-1 alpha-2 country code associated with this address.",
            "type": "string",
            "examples": [
              "US"
            ]
          },
          "door_code": {
            "$ref": "#/components/schemas/door_code"
          },
          "email_address": {
            "description": "The email address associated with this address.",
            "$ref": "#/components/schemas/email"
          },
          "first_name": {
            "description": "The given name of the person associated with this address.",
            "type": "string",
            "examples": [
              "Alan"
            ]
          },
          "id": {
            "description": "The unique Bolt ID associated with this address.",
            "type": "string"
          },
          "last_name": {
            "description": "The surname of the person associated with this address.",
            "type": "string",
            "examples": [
              "Watts"
            ]
          },
          "locality": {
            "description": "The city name details associated with this address.",
            "type": "string",
            "examples": [
              "Brooklyn"
            ]
          },
          "name": {
            "description": "The given and surname of the person associated with this address.",
            "type": "string",
            "examples": [
              "Alan Watts"
            ]
          },
          "phone_number": {
            "description": "The phone number associated with this address.",
            "$ref": "#/components/schemas/phone"
          },
          "postal_code": {
            "description": "The postal or zip code associated with this address.",
            "maxLength": 32,
            "type": "string",
            "examples": [
              "10044"
            ]
          },
          "priority": {
            "description": "The shopper-indicated priority of this address compared to other addresses on their account.",
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "primary",
              "listed"
            ],
            "examples": [
              "primary"
            ]
          },
          "region": {
            "description": "The region details such as state or province associated with this address.",
            "type": "string",
            "examples": [
              "NY"
            ]
          },
          "region_code": {
            "description": "The the ISO 3166-2 region code associated with this address.",
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "NY"
            ]
          },
          "street_address1": {
            "description": "The street number and street name of the address.",
            "type": "string",
            "examples": [
              "888 main street"
            ]
          },
          "street_address2": {
            "description": "Any apartment, floor, or unit details.",
            "type": "string",
            "examples": [
              "apt 3021"
            ]
          },
          "street_address3": {
            "description": "Any additional street address details.",
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "c/o Alicia Watts"
            ]
          },
          "street_address4": {
            "description": "Any additional street address details.",
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "Bridge Street Apartment Building B"
            ]
          }
        },
        "type": "object"
      },
      "card_last4": {
        "description": "The card's last 4 digits. **Nullable** for Transactions Details.",
        "maxLength": 4,
        "minLength": 4,
        "type": "string",
        "examples": [
          "4021"
        ]
      },
      "card_network": {
        "description": "The card's network code. **Nullable** for Transactions Details. Note: LEGACY diners_club_us_ca now tagged as mastercard\n",
        "enum": [
          "visa",
          "mastercard",
          "amex",
          "discover",
          "dinersclub",
          "jcb",
          "unionpay",
          "alliancedata",
          "citiplcc",
          "unknown"
        ],
        "type": "string",
        "examples": [
          "visa"
        ]
      }
    },
    "securitySchemes": {
      "OAuth": {
        "description": "Bolt utilizes the OAuth flow that developers can use to attain access to Bolt Account data via APIs.\nFor all APIs that require authorization, please provide your `access_token` returned from `/v1/oauth/token` via the basic auth bearer header `Authorization: bearer ${TOKEN}`.\n[Read more about the OAuth token endpoint.](/api-bolt/#tag/OAuth)\n",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://api.boltapp.com/v1/oauth/authorize",
            "refreshUrl": "https://api.boltapp.com/v1/oauth/token",
            "scopes": {
              "bolt.account.manage": "This scope grants permissions to perform read/edit/delete actions on Bolt Account data",
              "bolt.account.view": "This scope grants permissions to perform read only actions on Bolt Account data",
              "openid": "This scope grants permissions that enable Bolt SSO by granting an id token JWT that stores account data. Not used in v1/account endpoints"
            },
            "tokenUrl": "https://api.boltapp.com/v1/oauth/token"
          }
        },
        "type": "oauth2"
      },
      "X-API-Key": {
        "description": "Admins and Developers can obtain their Bolt API key from the Bolt Merchant Dashboard.",
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      }
    }
  }
}
```
