On This Page
Authorize a Payment
Use the authorization service to process a payment request to Afterpay or Clearpay. You
must include the token received from the session response in the authorization request
to receive a successful response.
Endpoints
Production:
POST
https://api.cybersource.com
/pts/v2/payments/Test:
POST
https://apitest.cybersource.com
/pts/v2/payments/Response Statuses
Cybersource
responds to your request with one of these statuses in the
status
.- AUTHORIZED: the payment is authorized.
- PENDING: the authorization request is accepted, but the payment is not authorized. To authorize the payment, complete the authorization using the payment redirection URL that you received in the authorization response.
- FAILED: the authorization request fails when there are invalid or missing fields.
Required Fields for Authorizing a Payment
Include these required fields in the authorization request.
- This field becomes optional if theorderInformation.lineItems[].totalAmountfield is present.
- Set toAFTERPAY.
- Set toINVOICE.
- Set toAP_AUTH.
- Set to theprocessorInformation.tokenfield value from the session response.
Optional Fields for Authorizing a Payment
Choose from these optional fields to include in the authorization request.
- If this field is present, theorderInformation.amountDetails.totalAmountfield is optional.
REST API Example: Authorizing a
Payment
REST API
Example: Authorizing a
PaymentRequest
{ "clientReferenceInformation": { "code": "refnum-1234" }, "merchantInformation": { "successUrl": "https://www.test.com", "cancelUrl": "https://www.test.com" }, "processorInformation": { "preApprovalToken": "519ff272-d850-4c81-ab65-674f670063c7" }, "paymentInformation": { "paymentType": { "name": "INVOICE", "method": { "name": "AFTERPAY" } } }, "processingInformation": { "actionList": "AP_AUTH" }, "orderInformation": { "amountDetails": { "totalAmount": "75.00", "currency": "USD" }, "billTo": { "firstName": "John", "lastName": "Smith", "address1": "123 Happy St", "locality": "Sunnyville", "administrativeArea": "TX", "postalCode": "55555", "country": "US", "email": "" }, "shipTo": { "firstName": "John", "lastName": "Smith", "address1": "123 Happy St", "locality": "Sunnyville", "administrativeArea": "TX", "postalCode": "55555", "country": "US" } } }
Response to a Successful Request
{ "_links": { "authReversal": { "method": "POST", "href": "/pts/v2/payments/7138874556236173004951/reversals" }, "capture": { "method": "POST", "href": "/pts/v2/payments/7138874556236173004951/captures" }, "self": { "method": "POST", "href": "/pts/v2/payments/7138874556236173004951" }, "status": { "method": "POST", "href": "/pts/v2/refresh-payment-status/7138874556236173004951" } }, "clientReferenceInformation": { "code": "refnum-1234" }, "id": "7138874556236173004951", "orderInformation": { "amountDetails": { "totalAmount": "102.21", "currency": "USD" } }, "processorInformation": { "responseDetails": "00003", "transactionId": "c5d7271f-cd59-4bd7-bf03-836b4d5318df", "responseCode": "00003" }, "reconciliationId": "XFZ40VALUOWO", "status": "AUTHORIZED", "submitTimeUtc": "2024-04-23T15:50:56Z" }
REST API Example: Authorizing a Payment
with Line Items
REST API
Example: Authorizing a Payment
with Line ItemsRequest
{ "clientReferenceInformation": { "code": "refnum-1234" }, "merchantInformation": { "successUrl": "https://www.test.com", "cancelUrl": "https://www.test1.com" }, "processorInformation": { "preApprovalToken": "519ff272-d850-4c81-ab65-674f670063c7" }, "paymentInformation": { "paymentType": { "name": "INVOICE", "method": { "name": "AFTERPAY" } } }, "processingInformation": { "actionList": "AP_AUTH" }, "orderInformation": { "amountDetails": { "currency": "USD" }, "billTo": { "firstName": "John", "lastName": "Smith", "address1": "123 Happy St", "locality": "Sunnyville", "administrativeArea": "TX", "postalCode": "55555", "country": "US", "email": "" }, "shipTo": { "firstName": "John", "lastName": "Smith", "address1": "123 Happy St", "locality": "Sunnyville", "administrativeArea": "TX", "postalCode": "55555", "country": "US" }, "lineItems": [ { "unitPrice": "1.00", "quantity": "10", "productSKU": "testI", "productName": "TV", "productCode": "4564" }, { "unitPrice": "15.00", "quantity": "1", "productSKU": "testJ", "productName": "TV", "productCode": "65432" } ] } }
Response to a Successful Request
{ "clientReferenceInformation": { "code": "refnum-1234" }, "id": "6977375233876065503009", "status": "AUTHORIZED", "submitTimeUtc": "2024-10-19T17:45:24Z", "processorInformation": { "responseCode": "00003", "transactionId": "0d97aa1b-a9dd-4e9c-b60c-b1157470d034" }, "reconciliationId": "XEKWVNIRQRHD", "orderInformation": { "amountDetails": { "totalAmount": "25.00", "currency": "USD" } }, "_links": { "self": { "href": "/pts/v2/payments/6977375233876065503009", "method": "GET" }, "authReversal": { "href": "/pts/v2/payments/6977375233876065503009/reversals", "method": "POST" }, "capture": { "href": "/pts/v2/payments/6977375233876065503009/captures", "method": "POST" }, "checkStatus": { "href": "/pts/v2/refresh-payment-status/6977375233876065503009", "method": "POST" } } }