Afterpay Get Payment Authorization
Overview
Get Payment Authorization is the second API call of Afterpay's two-step checkout flow following Initialize Payment Authorization. The request is sent with the PaymentId from Initialize Payment Authorization reply.
The same OrderId must be used between Initialize Payment Authorization and Get Payment Authorization requests.
In Get Payment Authorization reply, ResponseCode is used to determine if the payment was successfully processed for the order. The order can be accepted when ResponseCode is APPROVED and must be rejected if the value is DECLINED.
URI Summary
Action |
URI Template |
URI Example |
Non-URI Request |
Response |
---|---|---|---|---|
POST |
/v[M.m]/stores/{StoreID}/payments/authorization/get.[format] |
/v1.0/stores/stores123/payments/authorization/get.xml |
XML |
200 + XML response |
Request Elements
Element |
Optional/Required |
Description |
Type |
Restriction |
---|---|---|---|---|
/GetPaymentAuthorizationRequest/OrderId |
Required |
Unique identifier for an order across all transactions of the same order.
|
String |
Min 1 character
|
/GetPaymentAuthorizationRequest/PaymentId |
Required |
Reference id element from the InitialPaymentAuthorization reply. |
String |
Min 16 chars
|
Request Example
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationRequest xmlns="http://api.gsicommerce.com/schema/checkout/1.0" requestId="1234567">
<OrderId>Order-01</OrderId>
<PaymentId>123456789123456789123456789Abcde</PaymentId>
</GetPaymentAuthorizationRequest>
Response Elements
Element |
Optional/Required |
Description |
Type |
Restriction |
---|---|---|---|---|
/GetPaymentAuthorizationReply/PaymentContext |
Required |
Unique identifier of the payment transaction for the order. |
ComplexType |
|
/GetPaymentAuthorizationReply/PaymentContext/OrderId |
Required |
Unique identifier of the order from the GetPaymentAuthorizationRequest |
String |
Min 1 char
|
/GetPaymentAuthorizationReply/PaymentContext/TenderType |
Required |
Identifies the tender type. |
String |
Min 2 char
|
/GetPaymentAuthorizationReply/PaymentContext/PaymentAccountUniqueId |
Required |
Either a raw PAN (payment account number such as a credit card number), a token
|
String |
Max 22 characters |
/GetPaymentAuthorizationReply/PaymentContext/PaymentAccountUniqueId@isToken |
Required |
Attribute that indicates whether the payment account number is tokenized |
Boolean |
true or false |
/GetPaymentAuthorizationReply/PaymentContextFinal |
Optional, not applicable to Afterpay integration |
If the payment context in this reply is the final context. |
Boolean |
true or false |
/GetPaymentAuthorizationReply/ResponseCode |
Required |
Status code describing the current state of the authorization. |
Enum |
Can be any of the below
|
/GetPaymentAuthorizationReply/AmountAuthorized |
Required |
The amount that has been authorized. |
Decimal |
Min 0.00
|
/GetPaymentAuthorizationReply/ExternalAuthorizationId |
Optional, not applicable to Afterpay integration |
This is an external transaction ID. |
String |
Min 16 characters
|
/GetPaymentAuthorizationReply/CreditCardResponseData |
Optional, not applicable to Afterpay integration |
Credit Card Response data. |
ComplexType |
Can have the below elements
|
/GetPaymentAuthorizationReply/CreditCardResponseData/BankAuthorizationCode |
Optional |
Authorization Code returned by the payment processor upon a successful credit card auth.
|
String |
|
/GetPaymentAuthorizationReply/CreditCardResponseData/AvsResponseCode |
Optional |
Payment Processor Response for the Address Verification System check. |
String |
|
/GetPaymentAuthorizationReply/CreditCardResponseData/CvvResponseCode |
Optional |
Card Security Code Verification Response code. |
String |
|
/GetPaymentAuthorizationReply/PayPalResponseData |
Optional, not applicable to Afterpay integration |
PayPal Response data. |
ComplexType |
This may have any of the below
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation |
Optional |
Represents Billing Information of the order. Contains Customer Information and Address. |
ComplexType |
Contains two ComplexType
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Represents the Contact Information of the customer placing the order. |
ComplexType |
Contains below elements
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Required |
Represents the Person Name, Gender and Date of Birth. |
ComplexType |
Contains below elements
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Required |
Represents the Salutation, FirstName, MiddleName, Last Name and Suffix Information
|
ComplexType |
Contains below elements
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Represents the Salutation of the customer placing the order. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Required |
Represents the Last Name of the customer placing the order. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Represents the Middle Name of the customer placing the order. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Required |
Represents the First Name of the customer placing the order. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Represents the Suffix of the customer placing the order. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Represents Gender information associated with the order. |
Enum |
Can be any of the below
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Represents the Date Of Birth of the customer placing the order. |
Date |
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Customer phone number used for order follow-up. |
String |
Numbers 0-9
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Represents the Alternate Phone Number of the customer placing the order. |
String |
Numbers 0-9
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Email address used for sending automated email receipts. |
String |
Min 6 Characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Email address used for sending automated email receipts. |
String |
Min 6 Characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Represents shipping address of the customer placing the order.
|
ComplexType |
Line1 - max 70 characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Required |
The Line1 components contain the street address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Address Line 2 of the Billing Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Address Line 3 of the Billing Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Address Line 4 of the Billing Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Building Name of the Billing Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Post Office Box. (Do not pass PO Box as part of the request. Example: 765) |
String |
Numbers 0-9
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Required |
City of the Billing Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
This is the full displayable State/Province name. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Typically, a two- or three-digit postal abbreviation for the state or province.
|
String |
Min 1 character
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Country Name of the Billing Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Required |
Two-digit ISO country code conforming to ISO 3166 alpha 2.
|
String |
Min 2 characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/BillingInformation
|
Optional |
Postal code of the Billing Address. |
String |
Min 3 characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation |
Optional |
Represents Shipping Information of the order. Contains Customer Information and Address. |
ComplexType |
Contains two ComplexType
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Represents the Contact Information for the Shipping. |
ComplexType |
Contains below elements
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Required |
Represents the Person Name, Gender and Date of Birth. |
ComplexType |
Contains below elements
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Required |
Represents the Salutation, FirstName, MiddleName, Last Name and Suffix Information. |
ComplexType |
Contains below elements
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Represents the Salutation of the shipping customer. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Required |
Represents the Last Name of the customer. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Represents the Middle Name. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Required |
Represents the First Name of the customer. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Represents the Suffix of the customer. |
String |
Min 1 Character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Represents Gender information associated with the order. |
Enum |
Can be any of the below
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Represents the Date Of Birth of the customer. |
Date |
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Customer phone number used for order follow-up. |
String |
Numbers 0-9
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Represents the Alternate Phone Number of the customer. |
String |
Numbers 0-9
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Email address used for sending automated email receipts. |
String |
Min 6 Characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Email address used for sending automated email receipts. |
String |
Min 6 Characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Represents shipping address of the customer placing the order.
|
ComplexType |
Line1 - max 70 characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Required |
The Line1 components contain the street address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Address Line 2 of the Shipping Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Address Line 3 of the Shipping Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Address Line 4 of the Shipping Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Building Name of the Shipping Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Post Office Box (do not pass PO Box as part of the request. e.g. 765) |
String |
Numbers 0-9
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Required |
City of the Shipping Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
This is the full displayable State/Province name. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Typically, a two- or three-digit postal abbreviation for the state or province.
|
String |
Min 1 character
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Country Name of the Shipping Address. |
String |
Min 1 character |
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Required |
Two-digit ISO country code conforming to ISO 3166 alpha 2.
|
String |
Min 2 characters
|
/GetPaymentAuthorizationReply/PayPalResponseData/ShippingInformation
|
Optional |
Postal code of the Shipping Address. |
String |
Min 3 characters
|
Response Examples
Get Payment Authorization Response can be any of the below
- Get Payment Authorization Response with Credit Card Data
- Get Payment Authorization Response with PayPal Data
- Get Payment Authorization Response for other tenders without Credit Card and PayPal Data
Approved Get Payment Authorization Response with Credit Card Data
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>OrderId-01</OrderId>
<TenderType>VC</TenderType>
<PaymentAccountUniqueId isToken="false">4111111111111111</PaymentAccountUniqueId>
</PaymentContext>
<PaymentContextFinal>true</PaymentContextFinal>
<ResponseCode>APPROVED</ResponseCode>
<AmountAuthorized currencyCode="USD">50.00</AmountAuthorized>
<CreditCardResponseData>
<BankAuthorizationCode>1245</BankAuthorizationCode>
<AvsResponseCode>Y</AvsResponseCode>
<CvvResponseCode>Y</CvvResponseCode>
</CreditCardResponseData>
</GetPaymentAuthorizationReply>
Approved Payment Authorization Status Response with PayPal Data
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>OrderId-01</OrderId>
<TenderType>PY</TenderType>
<PaymentAccountUniqueId isToken="false">403CD11202F3E4BD3E6063AA11009A1D.sbg-vm-tx02</PaymentAccountUniqueId>
</PaymentContext>
<PaymentContextFinal>true</PaymentContextFinal>
<ResponseCode>APPROVED</ResponseCode>
<AmountAuthorized currencyCode="USD">50.00</AmountAuthorized>
<PayPalResponseData>
<BillingInformation>
<Contact>
<Person>
<Name>
<Salutation>Mr.</Salutation>
<LastName>Doe</LastName>
<MiddleName>William</MiddleName>
<FirstName>John</FirstName>
<Suffix>Sr</Suffix>
</Name>
<Gender>male</Gender>
<DateOfBirth>2018-05-03</DateOfBirth>
</Person>
<PrimaryPhoneNumber>55555555555</PrimaryPhoneNumber>
<AlternatePhoneNumber>6666666666</AlternatePhoneNumber>
<PrimaryEmailAddress>primary@email.com</PrimaryEmailAddress>
<AlternateEmailAddress>altername@email.com</AlternateEmailAddress>
</Contact>
<Address>
<Line1>935 First Ave</Line1>
<Line2>Second Floor</Line2>
<Line3>First Cross Street</Line3>
<Line4>Main Road</Line4>
<BuildingName>building-name</BuildingName>
<PoBox>16548</PoBox>
<City>King of Prussia</City>
<MainDivision>Pennsylvania</MainDivision>
<MainDivisionCode>PA</MainDivisionCode>
<CountryName>United States</CountryName>
<CountryCode>US</CountryCode>
<PostalCode>19406</PostalCode>
</Address>
</BillingInformation>
<ShippingInformation>
<Contact>
<Person>
<Name>
<Salutation>Mr.</Salutation>
<LastName>Doe</LastName>
<MiddleName>William</MiddleName>
<FirstName>John</FirstName>
<Suffix>Sr</Suffix>
</Name>
<Gender>male</Gender>
<DateOfBirth>2018-05-03</DateOfBirth>
</Person>
<PrimaryPhoneNumber>55555555555</PrimaryPhoneNumber>
<AlternatePhoneNumber>6666666666</AlternatePhoneNumber>
<PrimaryEmailAddress>primary@email.com</PrimaryEmailAddress>
<AlternateEmailAddress>altername@email.com</AlternateEmailAddress>
</Contact>
<Address>
<Line1>935 First Ave</Line1>
<Line2>Second Floor</Line2>
<Line3>First Cross Street</Line3>
<Line4>Main Road</Line4>
<BuildingName>building-name</BuildingName>
<PoBox>16548</PoBox>
<City>King of Prussia</City>
<MainDivision>Pennsylvania</MainDivision>
<MainDivisionCode>PA</MainDivisionCode>
<CountryName>United States</CountryName>
<CountryCode>US</CountryCode>
<PostalCode>19406</PostalCode>
</Address>
</ShippingInformation>
</PayPalResponseData>
</GetPaymentAuthorizationReply>
Approved Payment Authorization Status Response without Credit Card and PayPal Data
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>OrderId-01</OrderId>
<TenderType>AF</TenderType>
<PaymentAccountUniqueId isToken="true">AFTERPAY</PaymentAccountUniqueId>
</PaymentContext>
<ResponseCode>APPROVED</ResponseCode>
<AmountAuthorized currencyCode="USD">50.00</AmountAuthorized>
</GetPaymentAuthorizationReply>
Declined Payment Authorization Status Response
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>OrderId-01</OrderId>
<TenderType>AF</TenderType>
<PaymentAccountUniqueId isToken="true">AFTERPAY</PaymentAccountUniqueId>
</PaymentContext>
<ResponseCode>DECLINED</ResponseCode>
<AmountAuthorized currencyCode="USD">0.00</AmountAuthorized>
</GetPaymentAuthorizationReply>
Error Payment Authorization Status Response
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>OrderId-01</OrderId>
<TenderType>AF</TenderType>
<PaymentAccountUniqueId isToken="true">AFTERPAY</PaymentAccountUniqueId>
</PaymentContext>
<ResponseCode>ERROR</ResponseCode>
<AmountAuthorized currencyCode="USD">0.00</AmountAuthorized>
</GetPaymentAuthorizationReply>
Timeout Payment Authorization Status Response
<?xml version="1.0" encoding="UTF-8"?>
<GetPaymentAuthorizationReply xmlns:payment="http://schema.gsicommerce.com/payments/types/1.0/"
xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>OrderId-01</OrderId>
<TenderType>AF</TenderType>
<PaymentAccountUniqueId isToken="true">AFTERPAY</PaymentAccountUniqueId>
</PaymentContext>
<ResponseCode>TIMEOUT</ResponseCode>
<AmountAuthorized currencyCode="USD">0.00</AmountAuthorized>
</GetPaymentAuthorizationReply>
Next Step
After a successful Get Payment Authorization call, the next step may be for user to confirm the order.