Reversal
A reversal is an immediate financial correction on a successful transaction that was just made. The reversal request needs information from the successul response that wants to be reversed. A reversal cannot be made without first getting a successful response.
sequenceDiagram
participant POS
participant Terminal
POS->>Terminal: Http POST PaymentRequest
Terminal->>POS: rsp 200 PaymentResponse Success
POS->>Terminal: Http POST ReversalRequest
Terminal->>POS: rsp 200 ReversalResponse Success
note over POS,Terminal: But fails if payment response was not approved
POS->>Terminal: Http POST PaymentRequest
Terminal->>POS: rsp 200 PaymentResponse Failure
POS->>Terminal: Http POST ReversalRequest
Terminal->>POS: rsp 200 ReversalResponse Failure
sample ReversalRequest message
1
2
3
4
5
6
7
8
<SaleToPOIRequest>
<MessageHeader ProtocolVersion="3.1" MessageClass="Service" MessageCategory="Reversal" MessageType="Request" ServiceID="7" SaleID="1" POIID="A-POIID"/>
<ReversalRequest ReversalReason="MerchantCancel">
<OriginalPOITransaction SaleID="1" POIID="A-POIID">
<POITransactionID TransactionID="8778880381" TimeStamp="2023-10-04T14:25:08.647Z"/>
</OriginalPOITransaction>
</ReversalRequest>
</SaleToPOIRequest> :]
Name | Lev | Attribute | Description |
---|---|---|---|
ReversalRequest | 1 | ReversalReason |
MerchantCancel when manually operation by POS operator, Malfunction if automatically made by software due to some problem. |
OriginalPOITransaction | 2 | SaleID | SaleID used for transaction being reversed. |
POIID | POIID used for transaction being reversed. | ||
POITransactionID | 3 | TransactionID | Copied form POITransactionID received in response for transaction being reversed. |
TimeStamp | Copied form POITransactionID received in response for transaction being reversed. |
Reversal Response
A successful reversal response contains receipt information as a base64 encoded Json structure. Make sure to print the customer receipt information to give the customer.
Sample ReversalResponse message
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<SaleToPOIResponse>
<MessageHeader MessageClass="Service" MessageCategory="Reversal" MessageType="Response" ServiceID="7" SaleID="1" POIID="A-POIID"/>
<ReversalResponse>
<Response Result="Success"/>
<POIData>
<POITransactionID TransactionID="8778880381" TimeStamp="2023-10-04T14:25:08.647Z"/>
</POIData>
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3ZpdHRvIl19fX0=</OutputText>
</OutputContent>
</PaymentReceipt>
<PaymentReceipt DocumentQualifier="CashierReceipt">
<OutputContent OutputFormat="Text">
<OutputText>eyJNZXJjaGFudCI6eyJNYW5kYXRvcnkiOnsiQWNxdWlyZXIiOnsiQ2FyZEFjY2VwdG9yTnVtYmVyIjoiMTAwMjAwMDEiLCJUZXJtaW5hbElEIjoiODc3ODg4In0sIkNhcmRBY2NlcHRvciI6eyJBZGRyZXNzMSI6IkjDpGxsZXNrw6VyYW4gMjkiLCJCYW5rQWdlbnROYW1lIjoiYmFua3ktYmFuayIsIk5hbWUiOiJUZXN0IHNob3AiLCJPcmdhbmlzYXRpb25OdW1iZXIiOiI1NTY1NjcxLTYxNjUiLCJQb3N0WmlwQ29kZSI6IjUwNTAiLCJUb3duQ2l0eSI6Im1lcmNoYW50LUJhc2UyNC1DaXR5In0sIkNhcmREZXRhaWxzIjp7IkFwcGxpY2F0aW9uSWRlbnRpZmllciI6IkEwMDAwMDAwMDQxMDEwIiwiQ2FyZFNjaGVtZU5hbWUiOnsiQXBwbGljYXRpb25MYWJlbCI6Ik1hc3RlcmNhcmQifSwiUHJpbWFyeUFjY291bnROdW1iZXIiOiI1MTY4MTUqKioqKio5NjU5IiwiVGVybWluYWxWZXJpZmljYXRpb25SZXN1bHQiOiIwMDAwMDA4MDAxIiwiVHJhbnNhY3Rpb25TdGF0dXNJbmZvcm1hdGlvbiI6IjAwMDAifSwiT3V0Y29tZSI6eyJBcHByb3ZhbENvZGUiOiI3NDE1OTEiLCJBdXRob3Jpc2F0aW9uUmVzcG9uZGVyIjoiMyIsIkF1dGhvcmlzYXRpb25SZXNwb25zZUNvZGUiOiIwMCIsIkRlYml0U3RhdHVzIjoiOTEifSwiUGF5bWVudCI6eyJBdXRob3Jpc2F0aW9uQ2hhbm5lbCI6IjEiLCJDYXJkaG9sZGVyVmVyaWZpY2F0aW9uTWV0aG9kIjoiLyIsIkN1cnJlbmN5IjoiU0VLIiwiRmluYW5j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ha3VsZXJpbmciLCIiLCIiLCIiLCJGw7Zyc8OkbGphcmVucyBrdml0dG8iXX19fQ==</OutputText>
</OutputContent>
</PaymentReceipt>
</ReversalResponse>
</SaleToPOIResponse>
The Json struct of customer receipt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{
"Cardholder": {
"Mandatory": {
"Acquirer": {
"CardAcceptorNumber": "10020001",
"TerminalID": "877888"
},
"CardAcceptor": {
"Address1": "Hälleskåran 29",
"BankAgentName": "banky-bank",
"Name": "Test shop",
"OrganisationNumber": "5565671-6165",
"PostZipCode": "5050",
"TownCity": "merchant-Base24-City"
},
"CardDetails": {
"ApplicationIdentifier": "A0000000041010",
"CardSchemeName": {
"ApplicationLabel": "Mastercard"
},
"PrimaryAccountNumber": "************9659",
"TerminalVerificationResult": "0000008001",
"TransactionStatusInformation": "0000"
},
"Outcome": {
"ApprovalCode": "741591",
"AuthorisationResponder": "3",
"AuthorisationResponseCode": "00",
"DebitStatus": "91"
},
"Payment": {
"AuthorisationChannel": "1",
"CardholderVerificationMethod": "/",
"Currency": "SEK",
"FinancialInstitution": "SWE",
"PaymentAmount": "89,00",
"ReceiptNumber": "8778880381",
"SignatureBlock": false,
"TotalAmount": "89,00",
"TransactionSource": "K",
"TransactionType": "00"
},
"TimeStamp": {
"DateOfPayment": "2023-10-04",
"TimeOfPayment": "16:25"
}
},
"Optional": {
"CardAcceptor": {
"CountryName": "752",
"PhoneNumber": "+4684051000"
},
"CardDetails": {
"CardSchemeName": {
"ApplicationLabel": "Mastercard"
}
},
"Payment": {
"Reference": "1625083"
},
"ReceiptString": [
"Test shop",
"Hälleskåran 29",
"5050 merchant-Base24-City",
"☎ +46 8 405 10 00",
"Org nr: SE 5565671-6165",
"2023-10-04 16:25",
"",
"MID/TID: 10020001/877888",
"",
"Mastercard",
"Contactless",
"************9659",
"",
"K/1 3 00 SWE",
"AID: A0000000041010",
"TVR: 0000008001",
"TSI: 0000",
"RRN: 8778880381",
"Auth code: 741591",
"ARC: 00",
"",
"KÖP: 89,00 SEK",
"Makulering",
"",
"",
"",
"Kortinnehavarens kvitto"
]
}
}
}