API Reference

Collecting Interac Payments - Stripe

Step 1. Create Payment Intent

When using the payment API to get an intent for Canada, you can pass "interac" as one of the payment_method_types accepted. This will allow you take an Interac card at the terminal. But, just passing "interac" will not allow you to take regular cards. When activating the terminal to accept a payment method, you may not know if the customer is going to use a credit card or an Interac card, so you can pass both in the "payment_method_types" parameter and this will allow the terminal to accept either a credit card or and Interact card. This example shows allowing both.

// POST /v1/payment/intent
{
    external_account_id: "my merchants account id",
    amount: 12.99,
    payment_method_types: 'card_present,interac',
    capture_method: 'manual',
    external_transaction_id: "my transaction id",
    external_customer_id: "customer_12345"
  }

NOTE: In this example, the capture_method is set to "manual". This is on purpose to prove a point. If the customer presents a credit/debit card, the terminal will authorize the credit card and you will still need to capture later. However, if the customer presents an Interac card, it will automatically be captured by the terminal and no capture will be required later.

Step 2: Collect Payment Method

Collecting payment is no different than a normal CP credit card. Note, you will not know whether they used a credit card or Interac card until the "collectPaymentMethod" call is complete.

terminal.collectPaymentMethod(client_secret).then(function(result) {
  if (result.error) {
    // Placeholder for handling result.error
  } else {
    log('terminal.collectPaymentMethod', result.paymentIntent);
    terminal.processPayment(result.paymentIntent).then(function(result) {
    if (result.error) {
      console.log(result.error)
    } else if (result.paymentIntent) {
      paymentIntentId = result.paymentIntent.id;
      log('terminal.processPayment', result.paymentIntent);
    }
  });
}

Testing Notes: In order to test Interac payments, you will need a special Interac test card. See here for more details: https://quilt-payment-api.readme.io/reference/testing-interac

Step 3: Get Payment

You'll need to get the payment to determine what payment type was used and whether it needs to be captured. This is because we don't know at this point if they used a credit card or an Interac card. In the example below, the card was an Interac card and in this case we are done, there is no action needed to capture the card because it is already captured.

// GET /v1/payment/intent/pi_12345?external_account_id=merchant_account_id
{
    "payment_id": "pi_12345",
    "currency": "cad",
    "amount": 12.99,
    "amount_captured": 12.99,
    "amount_capturable": 0,
    "status": "succeeded",
    "card_present": true,
    "payment": {
        "payment_method_id": "pm_12345",
        "charge_id": "ch_12345",  
        "type": "interac",
        "brand": "VISA",
        "last_4": "1933",
        "exp_month": 12,
        "exp_year": 2022,
        "cardholder_name": "Test Person",
        "checks": []
    },
    ...
}

In the example data below, a credit card was used instead of the Interac card. In this case, we will need to capture the card to complete the payment.

// GET /v1/payment/intent/pi_12345?external_account_id=merchant_account_id
{
    "payment_id": "pi_12345",
    "currency": "cad",
    "amount": 12.99,
    "amount_captured": 0,
    "amount_capturable": 12.99,
    "status": "requires_capture",
    "card_present": true,
    "payment": {
        "payment_method_id": "pm_12345",
        "type": "card_present",
        "brand": "VISA",
        "last_4": "9969",
        "exp_month": 2,
        "exp_year": 2023,
        "cardholder_name": "Test Person",
        "checks": []
    },
    ...
}

Step 4: Capture Payment

If the card used was not an Interac card and requires capture, you'll need to capture the card to complete the payment.

// POST /v1/payment/capture
{
  payment_id: 'pi_12345',
  amount: '12.99',
  external_account_id: 'account_123456'
}
const params = {
  payment_id: 'pi_12345',
  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);
});
import requests

url = "https://<your portal domain>/v1/payment/capture"
import requests
payload = {
    "payment_id": "pi_12345",
    "amount": "12.99",
    "external_account_id": "account_123456"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
use GuzzleHttp\Client;

$client = new Client();
$response = $client->post('http://<your portal domain>/v1/payment/capture', [
  "payment_id" => "pi_12345",
  "amount" => "12.99",
  "external_account_id" => "account_123456"
]);
print_r($esponse);