Authorize a payment
Authorize a payment and charge your customer later.
About authorization
You can reserve an amount on your customer’s account, and then charge that amount at a later date.
Payment service providers guarantee the authorized amount for up to 7 days.
Supported payment methods
The following payment methods support authorization:
Authorize a payment
To authorize a payment, follow the steps below.
When testing, do not use real customer data. Use the test data prepared by Unzer.
Step 1: Authorize an amount
To authorize an amount, make a POST call to payments/authorize
, with the following parameters in the request body:
Parameter | Required | Type | Default | Description | Example |
---|---|---|---|---|---|
amount |
Yes | Float | / |
The authorization amount. | 12.23 |
currency |
Yes | String | / |
The authorization currency, in the ISO 4217 alpha-3 format. | EUR |
returnUrl |
Yes | String | / |
Needed for redirect payments and credit card payments if 3-D Secure is used. | https://www.unzer.com |
customerId |
No | String | / |
The ID of the customers resource to be used. |
s-cst-3a0daffe47cb |
typeId |
Yes | String | / |
The ID of the payment type resource to be used. | s-crd-fm7tifzkqewy |
POST https://api.unzer.com/v1/payments/authorize
{
"amount" : "100.00",
"currency" : "EUR",
"returnUrl": "https://www.unzer.com",
"resources" : {
"customerId" : "s-cst-3a0daffe47cb",
"typeId" : "`s-crd-fm7tifzkqewy"
}
}
{
"id": "s-aut-1",
"isSuccess": true,
"isPending": false,
"isError": false,
"message": {
"code": "COR.000.100.112",
"customer": "Request successfully processed in 'Merchant in Connector Test Mode'"
},
"amount": "100.0000",
"currency": "EUR",
"returnUrl": "https://www.unzer.com",
"paymentReference": "Test authorize transaction",
"date": "2018-09-13 19:41:49",
"resources": {
"customerId": "s-cst-3a0daffe47cb",
"basketId": "",
"paymentId": "s-pay-1",
"metadataId": "",
"typeId": "s-crd-fm7tifzkqewy"
},
"processing": {
"uniqueId": "31HA07BC8179DC97ADB6249F09E3BBBE",
"shortId": "4007.9410.9870",
"3dsecure": false // only for the card payment method
}
}
Property | Type | Description |
---|---|---|
id |
String | The authorization’s unique ID. |
isSuccess |
Boolean | Set to true if the transaction was successful. |
isPending |
Boolean | Set to true if the transaction is pending(e.g. if a redirect to an external system is required). |
isError |
Boolean | Set to true if an error occurs. |
message |
String | An error message describing the error in more detail. |
code |
String | A unique ID of the message. For details, go to Error code structure. |
customer |
String | Message displayed to the customer. |
amount |
Number | The authorization amount. |
currency |
String | The authorization currency, in the ISO 4217 alpha-3 format. |
returnUrl |
String | The URL to redirect the customer to after the payment is completed. |
paymentReference |
String | Additional description of the transaction. |
date |
String | Date and time of the transaction. |
customerId |
String | The ID of the customers resource. |
basketId |
String | The ID of the related baskets resource. |
paymentId |
String | The ID of the related payment resource. |
metadataId |
String | The ID of the related metadata resource. |
typeId |
String | The ID of the related payment type resource. |
uniqueId |
String | The ID of the transaction process. |
shortId |
String | The short ID of the transaction process. |
3dsecure |
Boolean | Only for the card payment method: if set to true , the card is configured with the 3-D Secure protocol enabled. |
Step 2: Charge the authorized amount
To charge the authorized amount, make a POST call to payments/{authorization_ID}/charges
, with an empty request body:
POST https://api.unzer.com/v1/payments/s-aut-1/charges