On This Page
Authorize a Payment
Authorizing a purchase requires the Klarna generated token from a completed session
creation. Set the
processorInformation.preApprovalToken
request field value to the token value.
Where you retrieve the token is dependent on whether you created a HOP session or inline
session. If you created a HOP session, the token is appended to the success URL the
customer is redirected to after completing the checkout using their Klarna account. If
you created an inline session, the token is generated by the Klarna widget when the
customer completes the checkout. After authorizing a payment, you can capture the authorization for up to 28 days.
Merchant-Defined Data
Merchant-defined data is included in the
merchantDefinedData_mddField_5
field. IMPORTANT
This field has replaced the
merchantDefinedData_field5
field. If you
submit a request with the
merchantDefinedData_field5
field, Cybersource
automatically replaces the field with
merchantDefinedData_mddField_5
.WARNING
You are prohibited from including personally
identifying information (PII) in the
merchantDefinedData
fields for the purposes
of capturing, obtaining, and/or transmitting any PII. PII includes,
but is not limited to, address, credit card number, social security
number, driver's license, state-issued identification number,
passport number, and card verification number (CVV, CVC2, CVV2, CID,
CVN). In the event Cybersource
discovers you are
capturing and/or transmitting PII in the
merchantDefinedData
fields, whether or not
intentionally, Cybersource
immediately suspends your
merchant account, which results in a rejection of any and all
transaction requests submitted by the merchant account after the
point of suspension.Endpoints
Production:
POST
https://api.cybersource.com
/pts/v2/payments/Test:
POST
https://apitest.cybersource.com
/pts/v2/payments/Response Status
The authorization service responds with one of these statuses as the
status
field value:- FAILED: The authorization request is not successful. Send a new authorization request. A failed request can be due to either Klarna rejecting the transaction or a technical error.
- AUTHORIZED: The customer's funds are authorized. You can now capture the authorized amount.
When you send a check status request for a pending authorization, you can receive
this status when the authorization updates:
Required Fields for an Authorization
- Set toKLARNA.
- Set toINVOICE.
- Set toAP_AUTH.
- Set to the token value created by Klarna.
- If you created a HOP session, the token is appended to the merchant success URL.
- If you created an inline session, the token is generated by the Klarna widget.
Country-Specific Fields
- Non-US Countries
- US and Canada
- IMPORTANTThe billing state and billing postal code fields are required when the billing country is set toUSorCA.
Optional Fields for an Authorization
- merchantDefinedInformation[].value
- orderInformation.billTo.city
- Set tocoupon.
- orderInformation.shipTo.city
Example: Authorizing a Payment
Request
{ "orderInformation": { "billTo": { "administrativeArea": "TX", "postalCode": "78757", "country": "US" }, "amountDetails": { "totalAmount": "1.00", "currency": "USD" } }, "paymentInformation": { "paymentType": { "name": "INVOICE", "method": { "name": "KLARNA" } } }, "processingInformation": { "actionList": "AP_AUTH" }, "processorInformation":{ "preApprovalToken": "87b09e60-4e34-69c6-9bea-906516cdec18" } }
Response to a Successful Request
{ "_links": { "authReversal": { "method": "POST", "href": "/pts/v2/payments/7297199754036380503955/reversals" }, "capture": { "method": "POST", "href": "/pts/v2/payments/7297199754036380503955/captures" }, "self": { "method": "POST", "href": "/pts/v2/payments/7297199754036380503955" }, "status": { "method": "POST", "href": "/pts/v2/refresh-payment-status/7297199754036380503955" } }, "clientReferenceInformation": { "code": "1729717123388" }, "id": "7297199754036380503955", "orderInformation": { "invoiceDetails": { "productId": "paylaterbycard" }, "amountDetails": { "totalAmount": "1.00", "currency": "USD" } }, "processorInformation": { "responseDetails": "00003", "transactionId": "dfcf1b24-311d-4e10-9be9-3b5f371bbe23", "responseCode": "00003" }, "reconciliationId": "XFZ402EJ8ZWS", "status": "AUTHORIZED", "submitTimeUtc": "2024-10-23T20:58:47Z" }