API Reference

Save COF - CNP - no payment collected - Stripe

STRIPE: Save a card-on-file when card is not present. Collect payment without charging an amount.

This document is for the STRIPE integration.

Step 1: Create Card Intent

You will need to first create a card intent.

// POST /v1/customer/card/intent
{
    external_account_id: "my merchants account id"
}

Step 2: Collect Payment Method

Using the Stripe JS SDK collect the payment method from the customer.
https://quilt-payment-api.readme.io/reference/card-not-present-payments#collect-payment.

let data = {
	payment_method: {
		card: this.cardElement,
}
};
stripe.confirmCardSetup(intentResult.client_secret, data).then((result) => {
  if (result.error) {
    // Handle error
  } else {
    // Success
    let paymentMethodId = result.setupIntent.id;
  }
);

Step 3: Save card on file

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 and external_customer_id property.

// 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": "pi_123456"
}
response = requests.post(url, json=payload)

print(response.text)

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