Dual Messaging
Auth and Capture
Dual messaging is a feature of our Card Payments API that allows merchants to place a lien on a customer's account before making a subsequent call to either void it or convert it to a sale.
This can be useful for merchants who need to verify the customer's funds or hold the funds for a while before completing the transaction.
How to use Dual Messaging APIs
The dual messaging APIs are part of the Interswitch Card Payments API.
To use them, you will need to create an account with Interswitch and obtain an API key.
For dual messaging, merchants must send a transactionMode
request parameter with the value AUTH
when sending the preauth
request.
This will place a lien on the customer's account for the specified amount. The merchant can then send a capture request to complete the transaction or a void request to cancel it.
The Dual Messaging API Flow
Auth Request
To send a preauth request, you will need to send a POST
request to the https://qa.interswitchng.com/collections/api/v3/purchases
endpoint with the following parameters:
- customerId: The customer's ID.
- amount: The amount to preauthorize.
- transactionRef: A unique reference for the transaction.
- transactionMode: Set to AUTH to indicate that this is a preauth request.
- currency: The currency of the transaction.
- authData: The encrypted card data.
- authorizationDuration (optional): Set this parameter to specify how many days you want the authorization to be active for. If no completion or void message is received before this time, the authorization will be automatically voided.
Capture Request
To capture a preauth
and complete the transaction, you will need to send a POST
request to the https://qa.interswitchng.com/collections/api/v3/purchases/capture
endpoint with the following parameters:
- transactionRef: The reference of the preauth transaction.
- requestRef: A unique reference for the capture request.
- amount: The amount to capture.
Void Request
To void a preauth
, you will need to send a POST
request to the https://qa.interswitchng.com/collections/api/v3/purchases/reverse
endpoint with the following parameters:
- transactionRef: The reference of the
preauth
transaction. - reversalReason: A reason for the void.
Example cURL Requests
The following cURL requests show how to send an auth
request, a capture
request, and a void
request:
# Auth request
curl --request POST \
--url https://qa.interswitchng.com/collections/api/v3/purchases \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"customerId": "[email protected]",
"amount": "600.00",
"transactionRef": "asdfasdfasdf",
"transactionMode": "AUTH",
"currency": "NGN",
"authData": "G3cf/VTghh=="
}
'
# Capture request
curl --request POST \
--url https://qa.interswitchng.com/collections/api/v3/purchases/capture \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"transactionRef": "asdfasdfasdf",
"requestRef": "aaaa1223",
"amount": 300.50
}
'
# Void request
curl --request POST \
--url https://qa.interswitchng.com/collections/api/v3/purchases/reverse \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"transactionRef": "asdfasdfasdf",
"reversalReason": "Not proceeding with transaction"
}
'
Updated about 1 year ago