---
title: Create Payment Method
---

[Skip to content](#%5Ftop) 

[API Reference](https://developers.cloudflare.com/api/python)

[Accounts](https://developers.cloudflare.com/api/python/resources/accounts)

[Payment Methods](https://developers.cloudflare.com/api/python/resources/accounts/subresources/payment%5Fmethods)

Copy Markdown

Open in **Claude**

Open in **ChatGPT**

Open in **Cursor**

---

**Copy Markdown**

**View as Markdown**

# Create Payment Method

accounts.payment\_methods.create(PaymentMethodCreateParams\*\*kwargs)  \-> [PaymentMethodCreateResponse](https://developers.cloudflare.com/api/python/resources/accounts#%28resource%29%20accounts.payment%5Fmethods%20%3E%20%28model%29%20payment%5Fmethod%5Fcreate%5Fresponse%20%3E%20%28schema%29)

POST/accounts/{account\_id}/payment-methods

Creates a new payment method for an account.

##### Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).

**Example:**`Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY`

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**`X-Auth-Email: user@example.com`

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**`X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194`

##### Accepted Permissions (at least one required)

`Billing Write`

##### ParametersExpand Collapse 

account\_id: str

Identifier

maxLength32

address: Optional\[str\]

Billing address line 1.

address2: Optional\[str\]

Billing address line 2.

bank\_account\_type: Optional\[str\]

Bank account type.

bank\_code: Optional\[str\]

Bank code.

bank\_country: Optional\[str\]

Bank country.

bank\_name: Optional\[str\]

Bank name for bank-based payment methods.

bank\_routing\_number: Optional\[str\]

Bank routing number.

cashapp\_cash\_tag: Optional\[str\]

Cash App cash tag.

city: Optional\[str\]

Billing city.

country: Optional\[str\]

Billing country.

default: Optional\[[bool](https://developers.cloudflare.com/api/python/resources/accounts/subresources/payment%5Fmethods/methods/create#%28resource%29%20accounts.payment%5Fmethods%20%3E%20%28method%29%20create%20%3E%20%28params%29%20default%20%3E%20%28param%29%20default%20%3E%20%28schema%29)\]

Whether this is the default payment method.

device\_data: Optional\[str\]

Device data for fraud prevention.

first\_name: Optional\[str\]

Billing first name.

last\_name: Optional\[str\]

Billing last name.

nick\_name: Optional\[str\]

A nickname for the payment method.

payment\_account\_email: Optional\[str\]

Email associated with the payment account.

payment\_email: Optional\[str\]

Payment email address.

payment\_gateway: Optional\[str\]

The payment gateway used.

payment\_nonce: Optional\[str\]

Payment nonce for tokenized payments.

state: Optional\[str\]

Billing state.

type: Optional\[Literal\["CREDIT\_CARD", "PAYPAL", "CASHAPP", 3 more\]\]

The payment method type.

One of the following:

"CREDIT\_CARD"

"PAYPAL"

"CASHAPP"

"SEPA\_DEBIT"

"LINK"

"ACH\_DIRECT\_DEBIT"

zipcode: Optional\[str\]

Billing zip code.

##### ReturnsExpand Collapse 

class PaymentMethodCreateResponse: …

id: Optional\[str\]

Payment method identifier.

address: Optional\[str\]

Billing address line 1.

address2: Optional\[str\]

Billing address line 2.

bank\_account\_type: Optional\[str\]

Bank account type.

bank\_code: Optional\[str\]

Bank code.

bank\_country: Optional\[str\]

Bank country.

bank\_name: Optional\[str\]

Bank name for bank-based payment methods.

bank\_routing\_number: Optional\[str\]

Bank routing number.

cashapp\_cash\_tag: Optional\[str\]

Cash App cash tag.

city: Optional\[str\]

Billing city.

country: Optional\[str\]

Billing country.

default: Optional\[bool\]

Whether this is the default payment method.

device\_data: Optional\[str\]

Device data for fraud prevention.

expiration\_date: Optional\[str\]

Card expiration date.

first\_name: Optional\[str\]

Billing first name.

last\_four: Optional\[str\]

Last four digits of the card number.

last\_name: Optional\[str\]

Billing last name.

nick\_name: Optional\[str\]

A nickname for the payment method.

payment\_account\_email: Optional\[str\]

Email associated with the payment account.

payment\_email: Optional\[str\]

Payment email address.

payment\_gateway: Optional\[str\]

The payment gateway used.

payment\_nonce: Optional\[str\]

Payment nonce for tokenized payments.

state: Optional\[str\]

Billing state.

type: Optional\[Literal\["CREDIT\_CARD", "PAYPAL", "CASHAPP", 3 more\]\]

The payment method type.

One of the following:

"CREDIT\_CARD"

"PAYPAL"

"CASHAPP"

"SEPA\_DEBIT"

"LINK"

"ACH\_DIRECT\_DEBIT"

zipcode: Optional\[str\]

Billing zip code.

### Create Payment Method

Python

HTTPHTTP

TypeScriptTypeScript

PythonPython

GoGo

TerraformTerraform

```
import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
payment_method = client.accounts.payment_methods.create(
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(payment_method.id)
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "id",
    "address": "address",
    "address2": "address2",
    "bank_account_type": "bank_account_type",
    "bank_code": "bank_code",
    "bank_country": "bank_country",
    "bank_name": "bank_name",
    "bank_routing_number": "bank_routing_number",
    "cashapp_cash_tag": "cashapp_cash_tag",
    "city": "city",
    "country": "country",
    "default": true,
    "expiration_date": "expiration_date",
    "first_name": "first_name",
    "last_four": "4242",
    "last_name": "last_name",
    "nick_name": "nick_name",
    "payment_account_email": "payment_account_email",
    "payment_email": "payment_email",
    "state": "state",
    "type": "CREDIT_CARD",
    "zipcode": "zipcode"
  },
  "success": true
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "id",
    "address": "address",
    "address2": "address2",
    "bank_account_type": "bank_account_type",
    "bank_code": "bank_code",
    "bank_country": "bank_country",
    "bank_name": "bank_name",
    "bank_routing_number": "bank_routing_number",
    "cashapp_cash_tag": "cashapp_cash_tag",
    "city": "city",
    "country": "country",
    "default": true,
    "expiration_date": "expiration_date",
    "first_name": "first_name",
    "last_four": "4242",
    "last_name": "last_name",
    "nick_name": "nick_name",
    "payment_account_email": "payment_account_email",
    "payment_email": "payment_email",
    "state": "state",
    "type": "CREDIT_CARD",
    "zipcode": "zipcode"
  },
  "success": true
}
```