Create a Card Payment Method

Create a new credit or debit card payment method by securely tokenizing the card details.

This endpoint allows you to create a new credit or debit card payment method by securely tokenizing the card details. However, using this server-side API solution increases the PCI DSS compliance requirements for your application. For most use cases, it is strongly recommended to use Stax.js, a browser-side solution, to minimize compliance obligations.

Key Features

lock
Secure Tokenization

Tokenizes sensitive card data for secure storage and future use in transactions.

user
Customer Association

Associates the payment method with a customer if a customer_id is provided.

shield-alt
Safe Storage

Provides a tokenized representation of the card without storing sensitive details like the full card number or CVV.


Usage Guidelines

exclamation-trianglePCI Compliance
  • Using the server-side solution expands your PCI scope and requires an annual SAQ-D assessment.
  • Avoid handling sensitive card details server-side unless absolutely necessary.
  • For reduced risk and liability, use Stax.js for tokenization.
credit-cardSupported Card Details

Ensure that the provided card details, including the number, expiration date, and CVV, are valid.

linkCustomer Association

Include a customer_id to associate the card with an existing customer. If no customer_id is provided, the card will not be linked to a customer.

bugError Handling

Invalid or expired cards will result in a validation error.


Response Structure

CodeResponseReason
200SuccessA successful response returns the tokenized payment method
400Bad RequestInvalid or missing card details.
401UnauthorizedAuthentication failed.
422Unprocessable EntityValidation error for card information (e.g., expired card, invalid number).
500Internal Server ErrorAn unexpected error occurred on the server.

Important Considerations

PCI Compliance: Avoid using this server-side API for credit card tokenization unless absolutely necessary. Always prioritize using Stax.js.

Card Validation: Stax does not store the full card number or CVV; these are only used during tokenization.

Customer Association: Linking the card to a customer ensures easier future retrieval.

Body Params
string
required

The customer id which will be associated with the payment method

string
enum
required
Defaults to card
Allowed:
string
required

Account holder first and last name. For company card/account, you can use Company Name

string
required
number
required
string
required

4 digit expiration (ex. "0427")

string
required

null is accepted

string

This may be used for AVS.

string
string

The cIty associated with the cardholder.

string

Use the 2-letter state abbreviation.

string

This may be used for AVS.

string
Responses

Language
Credentials
Bearer
JWT
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json