API Reference

Save COF - CP - no payment collected - Stripe

STRIPE: Saving card-on-file when card is present but now payment is collected or due

This document is for the STRIPE integration.

Step1: Collect payment method token

Using the Stripe Terminal SDK, collect a card token without payment a payment amount.

terminal.readReusableCard().then((result) => {
  if (result.error) {
      console.log(result.error)
    } else if (result.payment_method) {
      paymentMethodId = result.payment_method.id;
      console.log(result.payment_method);
    }
}

Using the payment method id from the result above, you'll need to make a call to the customer card API to add the card on file using the payment_method_id property.

2. Save card on file

// POST /v1/customer/card
{
  payment_method_id: 'pm_123456',
  external_customer_id: 'customer_12345',
  external_account_id: 'account_123456'
}
const params = {
  payment_method_id: 'pm_123456',
  external_customer_id: 'customer_12345',
  external_account_id: 'account_123456'
};
axios.post('/v1/customer/card', params).then((response) => {
  if (response.data.error) {
    console.error(response.data.error);
  } else {
    console.log(response);
  }
}.catch((err) => {
  console.error(err);
});
import requests

url = "https://<your portal domain>/v1/customer/card"

payload = {
    "external_account_id": "account_123456",
    "external_customer_id": "customer_123456",
    "payment_method_id": "pm_123456"
}
response = requests.post(url, json=payload)

print(response.text)

You do not need to save the customer ID and card ID as you can always access them using your external customer ID, but for speed of making payments, you might want to keep them to avoid additional API calls to retrieve them.