API Reference

Save COF - CNP - manual capture - customer later - Stripe

STRIPE: Save a card-on-file when card is not present. Manual capture the payment method and attach the customer with the intent.

This document is for the STRIPE integration.

Step 1: Create Payment Intent

You will need to first create an intent with an external_customer_id and capture_method set to manual.

// POST /v1/payment/intent
{
    external_account_id: "my merchants account id",
    amount: 12.99,
    payment_method_types: 'card',
    capture_method: 'manual',
    external_transaction_id: "my transaction id",
    allow_saving_card: true
  }

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.

Step 3: Save card on file

// POST /v1/customer/card
{
  payment_id: 'pi_123456',
  external_customer_id: 'customer_12345',
  external_account_id: 'account_123456'
}
const params = {
  payment_id: 'pi_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_id": "pi_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.

Step 4: Capture payment (optional)

Later when you are ready you can capture the payment.

// POST /v1/payment/capture'
{
  payment_id: 'pi_1HukElJKggKyYsMVXSTqKZ24',
  amount: '12.99',
  external_account_id: 'account_123456'
}
const params = {
  payment_id: 'pi_1HukElJKggKyYsMVXSTqKZ24',
  amount: '12.99',
  external_account_id: 'account_123456'
};
axios.post('/v1/payment/capture', params).then((response) => {
  if (response.data.error) {
    console.error(response.data.error);
  } else {
    console.log(response);
  }
}.catch((err) => {
  console.error(err);
});