Use these operations to find out which payment methods a customer can use, and to manage the methods a customer has saved.

A saved payment method is stored by VNSwitch. Your systems only ever see a reference to it (payment_method_id, or a short-lived payment_token) and masked details such as the last four card digits. Full card numbers and CVCs never pass through your server when you pay with a saved method, which keeps most of your systems out of card-data scope.

See Saved payment methods and recurring payments for how methods get saved and how to charge them.

List available payment methods

Returns the payment methods enabled on your account, filtered by amount, currency, country and other criteria. Call it before showing a checkout so you only offer methods that will work.

GET /account/payment_methods

Authentication: secret API key, or publishable key together with the payment’s client_secret (see Authentication).

There are two ways to call it:

  • From your server with the secret API key. Do not send client_secret; the request is rejected if you do. The result covers your account, narrowed by the filters you pass.
  • From the browser or app with <YOUR_PUBLISHABLE_KEY> in the api-key header and the payment’s client_secret as a query parameter (it is required in this mode). The result is tailored to that payment’s amount, currency and customer.

Query parameters

ParameterTypeRequiredDescription
client_secretstringWith publishable keyThe client_secret of a payment. Required with the publishable key, not allowed with the secret key.
amountintegerNoAmount in minor units. For VND, 150000 means 150,000 VND.
accepted_currenciesarray of stringsNoISO 4217 currency codes, for example VND.
accepted_countriesarray of stringsNoISO 3166-1 alpha-2 country codes, for example VN.
recurring_enabledbooleanNotrue to return only methods that can be used for recurring payments.
installment_payment_enabledbooleanNotrue to return only methods that support instalments.
card_networksarray of stringsNoCard networks to include, for example Visa, Mastercard, JCB.
limitintegerNoMaximum number of recently used methods to consider.

Example request

Response

{
  "redirect_url": "https://merchant.example.vn/checkout/return",
  "currency": "VND",
  "payment_methods": [
    {
      "payment_method": "card",
      "payment_method_types": [
        {
          "payment_method_type": "credit",
          "customer_acceptance_support": "supported"
        },
        {
          "payment_method_type": "debit",
          "customer_acceptance_support": "supported"
        }
      ]
    }
  ],
  "mandate_payment": null,
  "merchant_name": "Merchant Demo",
  "show_surcharge_breakup_screen": false,
  "payment_type": "normal",
  "request_external_three_ds_authentication": false,
  "is_tax_calculation_enabled": false,
  "sdk_next_action": { "next_action": "confirm" },
  "is_guest_customer": false
}

Response

FieldTypeDescription
currencystringCurrency of the payment.
payment_methodsarrayOne entry per payment_method (for example card, wallet, bank_transfer), each with its payment_method_types.
payment_methods[].payment_method_types[].payment_method_typestringThe specific method, for example credit, debit, momo or viet_qr.
payment_methods[].payment_method_types[].customer_acceptance_supportstringWhether the method can be saved for later: supported, partially_supported or unsupported. Use it to decide whether to show a “save my details” option.
payment_methods[].payment_method_types[].required_fieldsobjectFields you must collect for this method, when any.
mandate_paymentobjectMandate details when the payment sets up a mandate, otherwise null.
payment_typestringnormal, new_mandate, setup_mandate, recurring_mandate or installment.
is_guest_customerbooleantrue when the payment has no customer attached.

Vietnamese methods such as momo and viet_qr appear only when a provider for them is enabled on your account. Availability depends on the payment providers enabled for your account. Contact info@nivc.ai.

List customer payment methods

Returns the payment methods a customer has saved, most recently used first. Use it to show “pay with your saved card” options at checkout.

GET /customers/{customer_id}/payment_methods

Authentication: secret API key (api-key header).

Path parameters

ParameterTypeRequiredDescription
customer_idstringYesThe customer’s ID, for example cus_demo_001.

Query parameters

The same filters as List available payment methods are accepted: amount, accepted_currencies, accepted_countries, recurring_enabled, installment_payment_enabled, card_networks and limit.

Example request

Response

{
  "customer_payment_methods": [
    {
      "payment_token": "1d6e8a2c-5b3f-4c71-9e0a-7f2b4c8d9e13",
      "payment_method_id": "pm_5d1c9a7e3b",
      "customer_id": "cus_demo_001",
      "payment_method": "card",
      "payment_method_type": "credit",
      "recurring_enabled": true,
      "card": {
        "scheme": "Visa",
        "issuer_country": null,
        "last4_digits": "4242",
        "expiry_month": "12",
        "expiry_year": "2030",
        "card_holder_name": "NGUYEN VAN AN",
        "card_fingerprint": null,
        "nick_name": "Thẻ chính",
        "card_network": "Visa",
        "card_isin": "424242",
        "card_type": "CREDIT",
        "saved_to_locker": true
      },
      "created": "2026-11-01T08:20:11.000Z",
      "requires_cvv": true,
      "last_used_at": "2026-11-01T08:20:11.000Z",
      "default_payment_method_set": true
    }
  ],
  "is_guest_customer": null
}

Response

customer_payment_methods is an array. Each entry has:

FieldTypeDescription
payment_method_idstringPermanent ID of the saved method. Use it for merchant-initiated payments and to delete the method.
payment_tokenstringShort-lived token for this method. Pass it as payment_token on a payment while the customer is at checkout. List again for a fresh token; do not store it.
payment_method, payment_method_typestringFor example card and credit.
cardobjectMasked card details: last4_digits, expiry_month, expiry_year, card_holder_name, card_network, card_isin (first 6 digits), card_issuer, nick_name. The full number is never returned.
bankobjectMasked bank account details (mask, account_holder_name, bank_name) for saved bank methods.
requires_cvvbooleantrue if the customer must enter the CVC again to pay with this card.
recurring_enabledbooleanWhether the method can be used for recurring payments.
default_payment_method_setbooleantrue for the customer’s default method.
last_used_atstringWhen the method was last used (ISO 8601).

Retrieve a payment method

Returns one saved payment method by ID, with masked details.

GET /payment_methods/{method_id}

Authentication: secret API key (api-key header).

Path parameters

ParameterTypeRequiredDescription
method_idstringYesThe payment_method_id, for example pm_5d1c9a7e3b.

Example request

Response

{
  "merchant_id": "merchant_demo",
  "customer_id": "cus_demo_001",
  "payment_method_id": "pm_5d1c9a7e3b",
  "payment_method": "card",
  "payment_method_type": "credit",
  "card": {
    "scheme": "Visa",
    "issuer_country": null,
    "last4_digits": "4242",
    "expiry_month": "12",
    "expiry_year": "2030",
    "card_holder_name": "NGUYEN VAN AN",
    "nick_name": "Thẻ chính",
    "card_network": "Visa",
    "card_isin": "424242",
    "card_type": "CREDIT",
    "saved_to_locker": true
  },
  "recurring_enabled": true,
  "installment_payment_enabled": false,
  "metadata": null,
  "created": "2026-11-01T08:20:11.000Z",
  "last_used_at": "2026-11-01T08:20:11.000Z",
  "client_secret": null
}

Response

The payment method: payment_method_id, customer_id, payment_method, payment_method_type, masked card details, recurring_enabled, metadata, created and last_used_at. An unknown ID returns HTTP 404.

Delete a payment method

Deletes a saved payment method. Offer this when a customer removes a card from their account. The method can no longer be used for new payments.

DELETE /payment_methods/{method_id}

Authentication: secret API key (api-key header).

If the method backs a recurring arrangement, also revoke the mandate so the customer’s provider is told the arrangement has ended.

Path parameters

ParameterTypeRequiredDescription
method_idstringYesThe payment_method_id to delete.

Example request

Response

{
  "payment_method_id": "pm_5d1c9a7e3b",
  "deleted": true
}

Response

FieldTypeDescription
payment_method_idstringThe ID of the method.
deletedbooleantrue when the method was deleted.