---
title: Create Payment Method
---

[Skip to content](#_top)

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

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

[Payment Methods](https://developers.cloudflare.com/api/go/resources/accounts/subresources/payment_methods)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Create Payment Method

client.Accounts.PaymentMethods.New(ctx, params) (\*[PaymentMethodNewResponse](<https://developers.cloudflare.com/api/go/resources/accounts#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)>), error)

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

Creates a new payment method for an account.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



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

**Example:**<code>X-Auth-Email: user@example.com</code>

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

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

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

`Billing Write`

##### ParametersExpand Collapse

<details>

<summary>

params PaymentMethodNewParams

</summary>

AccountID param.Field\[string]

Path param: Identifier

maxLength32

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

Address param.Field\[string]Optional

Body param: Billing address line 1.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20address">Link to this property</a>

Address2 param.Field\[string]Optional

Body param: Billing address line 2.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20address2">Link to this property</a>

BankAccountType param.Field\[string]Optional

Body param: Bank account type.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20bank_account_type">Link to this property</a>

BankCode param.Field\[string]Optional

Body param: Bank code.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20bank_code">Link to this property</a>

BankCountry param.Field\[string]Optional

Body param: Bank country.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20bank_country">Link to this property</a>

BankName param.Field\[string]Optional

Body param: Bank name for bank-based payment methods.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20bank_name">Link to this property</a>

BankRoutingNumber param.Field\[string]Optional

Body param: Bank routing number.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20bank_routing_number">Link to this property</a>

CashappCashTag param.Field\[string]Optional

Body param: Cash App cash tag.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20cashapp_cash_tag">Link to this property</a>

City param.Field\[string]Optional

Body param: Billing city.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20city">Link to this property</a>

Country param.Field\[string]Optional

Body param: Billing country.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20country">Link to this property</a>

Default param.Field\[bool]Optional

Body param: Whether this is the default payment method.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20default">Link to this property</a>

DeviceData param.Field\[string]Optional

Body param: Device data for fraud prevention.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20device_data">Link to this property</a>

FirstName param.Field\[string]Optional

Body param: Billing first name.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20first_name">Link to this property</a>

LastName param.Field\[string]Optional

Body param: Billing last name.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20last_name">Link to this property</a>

NickName param.Field\[string]Optional

Body param: A nickname for the payment method.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20nick_name">Link to this property</a>

PaymentAccountEmail param.Field\[string]Optional

Body param: Email associated with the payment account.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20payment_account_email">Link to this property</a>

PaymentEmail param.Field\[string]Optional

Body param: Payment email address.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20payment_email">Link to this property</a>

PaymentGateway param.Field\[string]Optional

Body param: The payment gateway used.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20payment_gateway">Link to this property</a>

PaymentNonce param.Field\[string]Optional

Body param: Payment nonce for tokenized payments.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20payment_nonce">Link to this property</a>

State param.Field\[string]Optional

Body param: Billing state.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20state">Link to this property</a>

<details>

<summary>

Type param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/accounts/subresources/payment_methods/methods/create#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)">PaymentMethodNewParamsType</a>]Optional

Body param: The payment method type.

</summary>

const PaymentMethodNewParamsTypeCreditCard <a href="https://developers.cloudflare.com/api/go/resources/accounts/subresources/payment_methods/methods/create#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)">PaymentMethodNewParamsType</a> = "CREDIT\_CARD"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const PaymentMethodNewParamsTypePaypal <a href="https://developers.cloudflare.com/api/go/resources/accounts/subresources/payment_methods/methods/create#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)">PaymentMethodNewParamsType</a> = "PAYPAL"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

const PaymentMethodNewParamsTypeCashapp <a href="https://developers.cloudflare.com/api/go/resources/accounts/subresources/payment_methods/methods/create#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)">PaymentMethodNewParamsType</a> = "CASHAPP"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)%20%3E%20(member)%202">Link to this property</a>

const PaymentMethodNewParamsTypeSepaDebit <a href="https://developers.cloudflare.com/api/go/resources/accounts/subresources/payment_methods/methods/create#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)">PaymentMethodNewParamsType</a> = "SEPA\_DEBIT"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)%20%3E%20(member)%203">Link to this property</a>

const PaymentMethodNewParamsTypeLink <a href="https://developers.cloudflare.com/api/go/resources/accounts/subresources/payment_methods/methods/create#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)">PaymentMethodNewParamsType</a> = "LINK"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)%20%3E%20(member)%204">Link to this property</a>

const PaymentMethodNewParamsTypeACHDirectDebit <a href="https://developers.cloudflare.com/api/go/resources/accounts/subresources/payment_methods/methods/create#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)">PaymentMethodNewParamsType</a> = "ACH\_DIRECT\_DEBIT"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type%20%3E%20(schema)%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20type">Link to this property</a>

Zipcode param.Field\[string]Optional

Body param: Billing zip code.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20zipcode">Link to this property</a>

</details>

[Link to this property](<#(resource)%20accounts.payment_methods%20%3E%20(method)%20create%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type PaymentMethodNewResponse struct{…}

</summary>

ID stringOptional

Payment method identifier.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

Address stringOptional

Billing address line 1.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20address">Link to this property</a>

Address2 stringOptional

Billing address line 2.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20address2">Link to this property</a>

BankAccountType stringOptional

Bank account type.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20bank_account_type">Link to this property</a>

BankCode stringOptional

Bank code.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20bank_code">Link to this property</a>

BankCountry stringOptional

Bank country.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20bank_country">Link to this property</a>

BankName stringOptional

Bank name for bank-based payment methods.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20bank_name">Link to this property</a>

BankRoutingNumber stringOptional

Bank routing number.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20bank_routing_number">Link to this property</a>

CashappCashTag stringOptional

Cash App cash tag.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20cashapp_cash_tag">Link to this property</a>

City stringOptional

Billing city.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20city">Link to this property</a>

Country stringOptional

Billing country.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20country">Link to this property</a>

Default boolOptional

Whether this is the default payment method.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20default">Link to this property</a>

DeviceData stringOptional

Device data for fraud prevention.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20device_data">Link to this property</a>

ExpirationDate stringOptional

Card expiration date.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20expiration_date">Link to this property</a>

FirstName stringOptional

Billing first name.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20first_name">Link to this property</a>

LastFour stringOptional

Last four digits of the card number.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20last_four">Link to this property</a>

LastName stringOptional

Billing last name.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20last_name">Link to this property</a>

NickName stringOptional

A nickname for the payment method.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20nick_name">Link to this property</a>

PaymentAccountEmail stringOptional

Email associated with the payment account.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20payment_account_email">Link to this property</a>

PaymentEmail stringOptional

Payment email address.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20payment_email">Link to this property</a>

PaymentGateway stringOptional

The payment gateway used.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20payment_gateway">Link to this property</a>

PaymentNonce stringOptional

Payment nonce for tokenized payments.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20payment_nonce">Link to this property</a>

State stringOptional

Billing state.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20state">Link to this property</a>

<details>

<summary>

Type PaymentMethodNewResponseTypeOptional

The payment method type.

</summary>

One of the following:

const PaymentMethodNewResponseTypeCreditCard PaymentMethodNewResponseType = "CREDIT\_CARD"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%200">Link to this property</a>

const PaymentMethodNewResponseTypePaypal PaymentMethodNewResponseType = "PAYPAL"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%201">Link to this property</a>

const PaymentMethodNewResponseTypeCashapp PaymentMethodNewResponseType = "CASHAPP"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%202">Link to this property</a>

const PaymentMethodNewResponseTypeSepaDebit PaymentMethodNewResponseType = "SEPA\_DEBIT"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%203">Link to this property</a>

const PaymentMethodNewResponseTypeLink PaymentMethodNewResponseType = "LINK"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%204">Link to this property</a>

const PaymentMethodNewResponseTypeACHDirectDebit PaymentMethodNewResponseType = "ACH\_DIRECT\_DEBIT"

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20type%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20type">Link to this property</a>

Zipcode stringOptional

Billing zip code.

<a href="#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)%20%3E%20(property)%20zipcode">Link to this property</a>

</details>

[Link to this property](<#(resource)%20accounts.payment_methods%20%3E%20(model)%20PaymentMethodNewResponse%20%3E%20(schema)>)

### Create Payment Method

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/accounts"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  paymentMethod, err := client.Accounts.PaymentMethods.New(context.TODO(), accounts.PaymentMethodNewParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", paymentMethod.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
}
```