Card-Present payments done using Adyen terminal/reader hardware.
Overview
This document will outline how to collect card-present payments from using Adyen as a processor and using Adyen hardware. Please note, the P5 terminal doesn't currently support card on file.
If you've already successfully implemented Card Present transactions, the biggest difference is the two additional parameters when creating the payment: external_customer_id and allow_saving_card.
Adyen Hardware
The customer will first need to add the Adyen hardware and connect it to their account. This can be done in the payment portal, but it might also be convenient to integrate it into your own software. One reason for this is you will need the ID of the hardware for each call, so at a minimum, you need to get a list of hardware from the API if the customer uses the portal to add the hardware https://quilt-payment-api.readme.io/reference/getreaders-1.
Step 1: Get Payment Intent
You will need to create a payment intent either by calling the Payment CREATE API endpoint. https://quilt-payment-api.readme.io/reference/createpaymentintent-1
// POST /v1/payment/intent
{
"external_account_id": "account_123456",
"amount": 12.99,
"payment_method_types": "card_present",
"capture_method": "automatic",
"external_transaction_id": "transaction_123456",
"external_customer_id": "cust_12345",
"allow_saving_card": true
}
This will return a result that has a payment_id
and you'll need this id to authorize the payment.
Step 2: Collect Payment (synchronous)
The following API call will contact the terminal and collect payment. Please note that this is a blocking call and will not return until the customer has added payment or cancelled the payment and there is a timeout of 120 seconds. We are working on an asynchronous solution. If you need that solution, you could get this solution working for now and then switch to the async solution when ready.
To request a payment for a specific terminal, call the following endpoint https://quilt-payment-api.readme.io/reference/authpayment-1. Please note that in this case terminal_id
is required.
// POST /v1/payment/auth
{
"external_account_id": "account_123456",
"payment_id": "pi_12345",
"external_payment_id", "your_id_for_the_transaction",
"terminal_id": "S1F2-1234567890",
}
If this call completes successfully, then the payment is authorized. If the capture_method
on the payment intent was "automatic" then this payment will be automatically captured. If it was "manual", then the payment will need to be captured either through the portal or through the capture API.
The token for Card on File will be returned in the payment_method_id field.
Card on file only works with test cards that have an expiration date if 03/30 or later. Depending on which test cards you have, this may mean you have to swipe the card instead of tap so you can use the test card on the back of it.
If you are testing with a P5, you have to insert the card the wrong way, 3 times before swipe is activated.