Skip to main content
POST
/
payment-method
Create a new payment method
curl --request POST \
  --url https://api.example.com/payment-method \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customerId": "cus_1234567890",
  "isActive": true,
  "stripeId": "pm_1234567890",
  "type": "card",
  "last4": "1234",
  "fingerprint": "1234567890",
  "country": "US",
  "brand": "Visa",
  "exp_month": 1,
  "exp_year": 2025,
  "funding": "credit",
  "wallet": {}
}
'
{
  "id": "pm_123456789",
  "customerId": "cust_123456789",
  "isActive": true,
  "type": "card",
  "last4": "4242",
  "brand": "visa",
  "expMonth": 12,
  "expYear": 2025,
  "country": "CH",
  "exp_month": 12,
  "exp_year": 2025,
  "fingerprint": "1234567890",
  "funding": "card",
  "stripeId": "1234567890",
  "wallet": {}
}

Headers

Authorization
string
required

Bearer token for authentication

Body

application/json
customerId
string
required

The ID of the customer to associate with the payment method

Example:

"cus_1234567890"

isActive
boolean
required

Whether the payment method is active

Example:

true

stripeId
string
required

The ID of the Stripe payment method

Example:

"pm_1234567890"

type
string
required

The type of the payment method

Example:

"card"

last4
string
required

The last 4 digits of the payment method

Example:

"1234"

fingerprint
string
required

The fingerprint of the payment method

Example:

"1234567890"

country
string
required

The country of the payment method

Example:

"US"

brand
string
required

The brand of the payment method

Example:

"Visa"

exp_month
number
required

The expiration month of the payment method

Example:

1

exp_year
number
required

The expiration year of the payment method

Example:

2025

funding
string
required

The funding of the payment method

Example:

"credit"

wallet
object
required

The wallet of the payment method

Example:
{}

Response

Payment method successfully created

id
string
required

Unique identifier of the payment method

Example:

"pm_123456789"

customerId
string
required

Customer ID associated with this payment method

Example:

"cust_123456789"

isActive
boolean
required

Whether the payment method is active

Example:

true

type
enum<string>

Type of payment method

Available options:
card,
twint
Example:

"card"

last4
string

Last 4 digits of the card (for card payments)

Example:

"4242"

brand
enum<string>

Card brand (for card payments)

Available options:
visa,
mastercard,
amex
Example:

"visa"

expMonth
number

Expiration month (for card payments)

Required range: 1 <= x <= 12
Example:

12

expYear
number

Expiration year (for card payments)

Example:

2025

country
string

Country of the payment method

Example:

"CH"

exp_month
number

Expiration month of the payment method

Example:

12

exp_year
number

Expiration year of the payment method

Example:

2025

fingerprint
string

Fingerprint of the payment method

Example:

"1234567890"

funding
string

Funding of the payment method

Example:

"card"

stripeId
string

Stripe ID of the payment method

Example:

"1234567890"

wallet
object

Wallet of the payment method

Example:
{}