Card reader
What the card reader reports, what the lane does with each answer and when a person is called.
The card reader works with the payment provider of your store. It sends the system one thing: the result. The amount to pay is the total of the basket, which you read from the basket before you start the payment.
| Result | The lane | The basket |
|---|---|---|
approved | complete | paid, with its receipt number. |
declined | payment; the third decline in a row: assistance_needed | payment, with the declines counted. |
curl
curl -X POST "$RDC_BASE_URL/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/payment/result" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "714cd5d7-89eb-4592-8c86-d0d0e15ad9b9",
"expectedRevision": 4,
"result": "approved"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/payment/result`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "714cd5d7-89eb-4592-8c86-d0d0e15ad9b9",
"expectedRevision": 4,
"result": "approved"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/payment/result',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '714cd5d7-89eb-4592-8c86-d0d0e15ad9b9',
'expectedRevision': 4,
'result': 'approved',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "714cd5d7-89eb-4592-8c86-d0d0e15ad9b9",
"expectedRevision": 4,
"result": "approved"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/payment/result');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/selfcheckout/v1/baskets/094a0e7f-0541-49b0-b063-3fa75d8468a8/payment/result");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "714cd5d7-89eb-4592-8c86-d0d0e15ad9b9",
"expectedRevision": 4,
"result": "approved"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); {
"operationId": "714cd5d7-89eb-4592-8c86-d0d0e15ad9b9",
"status": "accepted",
"aggregateId": "094a0e7f-0541-49b0-b063-3fa75d8468a8",
"aggregateRevision": 5
} When a person is called
The third decline in a row raises an intervention with the reason payment_problem. The attendant approves it to let the shopper try again, with the count of declines back at zero, or refuses it to take the basket back to scanning.
- While the intervention waits, a payment result is refused with
assistance_pending. - A payment result for a basket that is not in payment is refused with
no_payment_pending. - A reader in fault takes the lane out of service. See Health and heartbeats.