Skip to main content

Payment Methods

The Payment Methods API allows you to tokenize card data. This process replaces sensitive information (like the full card number) with a unique, non-sensitive identifier known as a token (id).

This step is fundamental to ensuring maximum security and simplifying your compliance with the PCI DSS standard. By operating with tokens, the actual card data never touches your servers, which minimizes risk and protects your customers' information.

You can use these tokens to securely process charges, either for one-time transactions or to link them to subscriptions, without needing to request the card details again.


Features​

Authentication and Security

To access the API, it is necessary to authenticate each request with a token, see Authentication.

πŸ“Œ Create payment method.​

  • Base URL: https://api-sandbox.n1co.shop
  • Method: POST
  • Endpoint: /api/v3/PaymentMethods
  • Description: Create a payment method to tokenize card data.
  • Required headers:
  • Content-Type: application/json
  • Authorization: Bearer {your_token}
  • Example:
{
"customer": {
"id": "customer001",
"name": "Carlos DΓΊran",
"email": "[email protected]",
"phoneNumber": "+50364331900"
},
"card": {
"number": "4000000000002701",
"cardHolder": "CARLOS DURAN",
"expirationMonth": "10",
"expirationYear": "2028",
"cvv": "111",
"singleUse": false
}
}

- Request Parameters​

ParameterTypeRequiredDescription
customerobjectβœ…Object containing customer information.
customer.idstringβœ…Unique identifier for your customer.
customer.namestringβœ…Customer's full name.
customer.emailstringβœ…Customer's email.
customer.phoneNumberstringβœ…Customer's phone number (e.g., "+50364331900").
cardobjectβœ…Object containing card data.
card.numberstringβœ…Credit or debit card number.
card.cardHolderstringβœ…Name of the cardholder, as it appears on the card.
card.expirationMonthstringβœ…Card's expiration month (e.g., "09").
card.expirationYearstringβœ…Card's expiration year (e.g., "2030").
card.cvvstringβœ…Card's security code (CVV, CVC).
card.singleUsebooleanβœ…Defines if the generated token will be single-use (true) or multi-use (false).
How to use card.singleUse?

This boolean parameter determines the lifespan of the generated token:

  • card.singleUse: true (Recommended for One-Time Payments): The generated token will be single-use and will be automatically invalidated after being used in a charge. It is the ideal option for transactions where the customer does not want to save their card for future purchases.

  • card.singleUse: false (Required for Subscriptions and Saved Cards): The token will be multi-use, allowing it to be used for multiple charges. You must use this option if you plan to:

    • Link the payment method to a subscription.
    • Save the card to a customer's profile to facilitate future purchases.

- Response Parameters​

ParameterTypeDescription
idstringThe unique identifier of the payment method (token).
typestringType of payment method, in this case, "card".
binobjectObject with information from the card's BIN.
bin.brandstringThe card brand (e.g., "visa", "mastercard").
bin.issuerNamestringName of the card's issuing bank.
bin.countryCodestringIssuing country code of the card (e.g., "SLV").
successbooleanIndicates if the payment method creation was successful.
messagestringDescriptive message of the operation's result.

πŸ“Œ Update payment method.​

  • Base URL: https://api-sandbox.n1co.shop
  • Method: PUT
  • Endpoint: /api/v3/PaymentMethods
  • Description: Update payment method.
  • Required headers:
  • Content-Type: application/json
  • Authorization: Bearer {your_token}
  • Example:
{
"customerId": "customer001",
"cardId": "69167196381d34f25eb22e9d",
"card": {
"cardHolder": "CARLOS DURAN",
"expirationMonth": "12",
"expirationYear": "2030",
"cvv": "111"
}
}