Void an Authorization
POST /alternatepayments/v1/accounts/account_id/payments/payment_id/voidauths
To void (cancel) a payment authorization that has not been settled, you must make a POST request to the voidauths endpoint. The payment authorization must have a status of COMPLETED to proceed with this operation. Some payment methods support voiding only a part of an authorization.
Currently, only Paysafe Pay Later supports partially voiding an authorization.
This operation is available only for payment methods that support manual settlement. If the authorization has already been fully settled, then you will not be able to void it and will need to issue a refund instead.
curl -X POST https://api.test.paysafe.com/alternatepayments/v1/accounts/1001070130/payments/4bf209b-f99d-4bd0-ae52-455991cfe370/voidauths \
-u testuser:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d
{
"merchantRefNum":"UniqueRef1234",
"dupCheck":true
}
Prior to trying the example above, you should:
- Provide a unique merchant reference number (merchantRefNum) for each transaction.
- Replace the account number (1001070130) in the URL with the Test account number you received for the alternate payments method you are testing.
- Replace the payment ID (4bf209b-f99d-4bd0-ae52-455991cfe370) with the payment ID you received in the response to your Payment request.
- Replace the API key (after the -u) with the API key you have received.
{
"id": "11d9e7fe-a688-4e65-bc77-283571c21985",
"merchantRefNum": "0bsasdffdsfsfdfssdasdfwwaddsad23",
"dupCheck": true,
"amount": 100,
"paymentType": "PAYOLUTION",
"currencyCode": "EUR",
"liveMode": true,
"txnTime": "2017-06-01T15:13:07Z",
"status": "COMPLETED",
"gatewayResponse": {
"code": "0.0.0",
"description": "The request was processed successfuly.",
"id": "87f67963-639c-4620-9007-94742415282e",
"processor": "PAYOLUTION"
},
"links": [{
"rel": "self",
"href": "https://api.test.paysafe.com/alternatepayments/v1/accounts/1001070130/voidauths/11d9e7fe-a688-4e65-bc77-283571c21985"
},
{
"rel": "payment",
"href": "https://api.test.paysafe.com/alternatepayments/v1/accounts/1001070130/payments/4bf209b-f99d-4bd0-ae52-455991cfe370"
}
]
}
The response parameters are described below:
Value | Type | Description |
---|---|---|
id | string | This is a unique ID for this void authorization operation. This ID can be used to look up this request. |
merchantRefNum | string | This is the merchant reference number created by the merchant and submitted as part of the request. |
dupCheck | boolean | true indicates this is not a duplicate transaction. A request is considered a duplicate if the merchantRefNum has already been used in a previous request within the past 90 days. |
amount | integer | This is the amount of the void authorization, in minor units. |
paymentType | enum | This is the payment type used for the request (e.g., PAYOLUTION). |
currencyCode | string | This is the three-digit code for the currency of the merchant account specified in the account_id included in the request URL. |
liveMode | boolean | true indicates this is a real transaction. false indicates this is a test transaction. |
txnTime | dateTime | This is the transaction time and date in UTC format. |
status | enum | This is the status of the void authorization: RECEIVED – Our system has received the request and is waiting for the payment provider's response. COMPLETED – The transaction has been completed. FAILED – The transaction was declined. ERROR – The transaction failed, due to an error (e.g., validation, missing required parameter, etc.). |
gatewayResponse | object | This contains the response from the payment provider and varies depending on the payment method used. |
links | array of link objects | Contains a self link that can be used to look up details about this void authorization. |