Afterpay Initialize Payment Authorization
Overview
Initialize Payment Authorization is the first API call of Afterpay Processing. It is used to initiate the authorization process.
The Initialize Payment Authorization reply typically contains a unique PaymentId element to identify the transaction.
URI Summary
Action |
URI Template |
URI Example |
Non-URI Request |
Response |
---|---|---|---|---|
POST |
/v[M.m]/stores/{StoreID}/payments/authorization/initialize/{Tender}.[format] |
/v1.0/stores/stores123/payments/authorization/initialize/AF.xml |
XML |
200 + XML response |
Request Elements
Element |
Optional/Required |
Afterpay Integration Use |
Description |
Type |
Restriction |
---|---|---|---|---|---|
/InitializePaymentAuthorizationRequest/OrderId |
Required |
|
Unique identifier for an order across all transactions of the same order |
String |
Min 1 character
|
/InitializePaymentAuthorizationRequest/Amount |
Required |
|
Total dollar value of the authorization Format as 0.00 and max 9 digits total.
|
Decimal |
Min 0.00
|
/InitializePaymentAuthorizationRequest/PaymentType |
Required |
Not used |
The transaction type of the operation. |
Enum |
Can be any of these values: |
/InitializePaymentAuthorizationRequest/RedirectUrl |
Optional |
Required |
This URL will receive the result of an asynchronous payment.
It is required for any asynchronous payment method.
|
String |
Min 1 character
|
/InitializePaymentAuthorizationRequest/CancelUrl |
Optional |
Required |
The user to redirected to this URL if the payment process is cancelled.
|
String |
Min 1 character
|
/InitializePaymentAuthorizationRequest/BillingInformation |
Required |
|
Represents Billing Information of the order. Contains Customer Information and Address. |
ComplexType |
Contains two ComplexType
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Represents the Contact Information of the customer placing the order. |
ComplexType |
Contains below elements
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Represents the Person Name, Gender and Date of Birth. |
ComplexType |
Contains below elements
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Represents the Salutation, FirstName, MiddleName, Last Name and Suffix Information
|
ComplexType |
Contains below elements
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
|
Represents the Salutation of the customer placing the order. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Represents the Last Name of the customer placing the order. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
|
Represents the Middle Name of the customer placing the order. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Represents the First Name of the customer placing the order. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
|
Represents the Suffix of the customer placing the order. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Represents Gender information associated with the order. |
Enum |
Can be any of these values: |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Represents the Date Of Birth of the customer placing the order. |
Date |
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Customer phone number used for order follow-up. |
String |
Numbers 0-9
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Represents the Alternate Phone Number of the customer placing the order. |
String |
Numbers 0-9
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Email address used for sending automated email receipts. |
String |
Min 6 Characters
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Email address used for sending automated email receipts. |
String |
Min 6 Characters
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Represents shipping address of the customer placing the order.
|
ComplexType |
Line1 - max 70 characters
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
The Line1 components contain the street address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
|
Address Line 2 of the Billing Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Address Line 3 of the Billing Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Address Line 4 of the Billing Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Building Name of the Billing Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Post Office Box (do not pass PO Box as part of the request. Example. 765) |
String |
Numbers 0-9
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
City of the Billing Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
This is the full displayable State/Province name. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
|
Typically, a two- or three-digit postal abbreviation for the state or province.
|
String |
Min 1 character
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Not used |
Country Name of the Billing Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/BillingInformation
|
Required |
|
Two-digit ISO country code conforming to ISO 3166 alpha 2.
|
String |
Min 2 characters
|
/InitializePaymentAuthorizationRequest/BillingInformation
|
Optional |
Required |
Postal code of the Billing Address. |
String |
Min 3 characters
|
/InitializePaymentAuthorizationRequest/ShippingInformation |
Optional |
Required |
Represents Shipping Information of the order. Contains Customer Information and Address. |
ComplexType |
Contains two ComplexType
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Required |
Represents the Contact Information for the Shipping. |
ComplexType |
Contains below elements
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
|
Represents the Person Name, Gender and Date of Birth. |
ComplexType |
Contains below elements
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
|
Represents the Salutation, FirstName, MiddleName, Last Name and Suffix Information. |
ComplexType |
Contains below elements
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
|
Represents the Salutation of the shipping customer. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
Required |
Represents the Last Name of the customer. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
|
Represents the Middle Name. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
|
Represents the First Name of the customer. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
|
Represents the Suffix of the customer. |
String |
Min 1 Character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Represents Gender information associated with the order. |
Enum |
Can be any of these values: |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Represents the Date Of Birth of the customer. |
Date |
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
|
Customer phone number used for order follow-up. |
String |
Numbers 0-9
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Represents the Alternate Phone Number of the customer. |
String |
Numbers 0-9
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
|
Email address used for sending automated email receipts. |
String |
Min 6 Characters
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Email address used for sending automated email receipts. |
String |
Min 6 Characters
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
|
Represents shipping address of the customer placing the order.
|
ComplexType |
Line1 - max 70 characters
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
|
The "Line1" components contain the street address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
|
Address Line 2 of the Shipping Address |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Address Line 3 of the Shipping Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Address Line 4 of the Shipping Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Building Name of the Shipping Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Post Office Box (Do not pass PO Box as part of the request. Example: 765) |
String |
Numbers 0-9
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
|
City of the Shipping Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
This is the full displayable State/Province name. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
|
Typically, a two- or three-digit postal abbreviation for the state or province.
|
String |
Min 1 character
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Not used |
Country Name of the Shipping Address. |
String |
Min 1 character |
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Required |
|
Two-digit ISO country code conforming to ISO 3166 alpha 2.
|
String |
Min 2 characters
|
/InitializePaymentAuthorizationRequest/ShippingInformation
|
Optional |
Required |
Postal code of the Shipping Address. |
String |
Min 3 characters
|
/InitializePaymentAuthorizationRequest/OriginatorIpAddress |
Required |
|
An IP version 4 or version 6 address. |
String |
Max 39 characters |
/InitializePaymentAuthorizationRequest/LineItems |
Optional |
Required |
Sequence of LineItem. |
Complex Type |
|
/InitializePaymentAuthorizationRequest/LineItems/LineItemsTotal |
Required |
|
Total amount for all line items excluding shipping and tax; Includes currencyCode attribute that contains the 3-letter currency code of the money amount. |
Decimal |
Min 0.00 Max 9 digits Fraction 2 digits |
/InitializePaymentAuthorizationRequest/LineItems/ShippingTotal |
Required |
|
Total shipping amount for all line items. Includes currencyCode attribute that contains the 3-letter currency code of the money amount. |
Decimal |
Min 0.00 Max 9 digits Fraction 2 digits |
/InitializePaymentAuthorizationRequest/LineItems/TaxTotal |
Required |
|
Total tax amount for all line items. Includes currencyCode attribute that contains the 3-letter currency code of the money amount. |
Decimal |
Min 0.00 Max 9 digits Fraction 2 digits |
/InitializePaymentAuthorizationRequest/LineItems/LineItem |
Optional |
Required |
|
Complex Type |
|
/InitializePaymentAuthorizationRequest/LineItems/LineItem/Name |
Required |
|
Line item name like product title. |
String |
|
/InitializePaymentAuthorizationRequest/LineItems/LineItem/SequenceNumber |
Optional |
|
Sequence number of current line item if available. |
String |
|
/InitializePaymentAuthorizationRequest/LineItems/LineItem/Quantity | Required | Item quantity | Integer | ||
/InitializePaymentAuthorizationRequest/LineItems/LineItem/SkuId |
Optional |
|
Represents the identifier for an inventoriable product. a.k.a. SKU. |
String |
|
/InitializePaymentAuthorizationRequest/LineItems/LineItem/UnitAmount | Required | Total dollar value of the authorization Format as 0.00 and max 9 digits total. This should represent the total of all taxes, shipping charges and other product/service costs as applicable. Includes currencyCode attribute that contains the 3-letter currency code of the money amount. | Decimal | Min 0.00 Max 9 digits Fraction 2 digits | |
/InitializePaymentAuthorizationRequest/Promotions |
Optional |
|
Sequence of Promotion. |
Complex type |
|
/InitializePaymentAuthorizationRequest/Promotions/PromotionsTotal | Required | Item quantity. | Decimal | Min 0.00 Max 9 digits Fraction 2 digits | |
/InitializePaymentAuthorizationRequest/Promotions/Promotion |
Optional |
Required |
Includes promotional data. |
Complex Type |
|
/InitializePaymentAuthorizationRequest/Promotions/Promotion/Name | Required | Promotion name like coupon or discount. | String | ||
/InitializePaymentAuthorizationRequest/Promotions/Promotion/Amount |
Required |
|
Savings amount from promotions like discount or coupon. |
Decimal |
Min 0.00 Max 9 digits Fraction 2 digits |
/InitializePaymentAuthorizationRequest/POSMethod |
Optional |
Not used |
An identifier for the type of Point Of Sale method used.
|
Enum |
Can be any of these values: |
/InitializePaymentAuthorizationRequest/PaymentIdToBeCorrected |
Optional |
Not used |
Reference ID element from the gateway response of initial payment for authorization correction. |
Enum |
Min 32 Characters
|
Request Example
<?xml version="1.0" encoding="UTF-8"?>
<InitializePaymentAuthorizationRequest xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<OrderId>123456789</OrderId>
<Amount currencyCode="USD">55.00</Amount>
<PaymentType>Payment</PaymentType>
<RedirectUrl>my.app://custom/url</RedirectUrl>
<CancelUrl>my.app://custom/url</CancelUrl>
<BillingInformation>
<ContactInformation>
<Person>
<Name>
<Salutation>Salutation</Salutation>
<LastName>LName</LastName>
<MiddleName>MName</MiddleName>
<FirstName>FName</FirstName>
<Suffix>Suffix</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>
</ContactInformation>
<Address>
<Line1>279 Yonge Street</Line1>
<Line2>line2</Line2>
<Line3>line3</Line3>
<Line4>line4</Line4>
<BuildingName>buildingName</BuildingName>
<PoBox>16548</PoBox>
<City>Toronto</City>
<MainDivision>ON</MainDivision>
<MainDivisionCode>MDC</MainDivisionCode>
<CountryName>countryName</CountryName>
<CountryCode>US</CountryCode>
<PostalCode>19406</PostalCode>
</Address>
</BillingInformation>
<ShippingInformation>
<ContactInformation>
<Person>
<Name>
<Salutation>salutation</Salutation>
<LastName>lastName</LastName>
<MiddleName>middleName</MiddleName>
<FirstName>firstName</FirstName>
<Suffix>suffix</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>
</ContactInformation>
<Address>
<Line1>279 Yonge Street</Line1>
<Line2>line2</Line2>
<Line3>line3</Line3>
<Line4>line4</Line4>
<BuildingName>buildingName</BuildingName>
<PoBox>16548</PoBox>
<City>Toronto</City>
<MainDivision>ON</MainDivision>
<MainDivisionCode>MDC</MainDivisionCode>
<CountryName>countryName</CountryName>
<CountryCode>US</CountryCode>
<PostalCode>19406</PostalCode>
</Address>
</ShippingInformation>
<OriginatorIpAddress>199.241.238.65</OriginatorIpAddress>
<LineItems>
<LineItemsTotal currencyCode="USD">30.00 </LineItemsTotal>
<ShippingTotal currencyCode="USD">20.00 </ShippingTotal>
<TaxTotal currencyCode="USD">5.00 </TaxTotal>
<LineItem>
<Name>Shirt</Name>
<SequenceNumber>1</SequenceNumber>
<SkuId>INV-1239</SkuId>
<Quantity>2</Quantity>
<UnitAmount currencyCode="USD">15.00</UnitAmount>
</LineItem>
</LineItems>
<Promotions>
<PromotionsTotal currencyCode="USD">15.00</PromotionsTotal>
<Promotion>
<Name>Special Offer</Name>
<Amount currencyCode="USD">15.00</Amount>
</Promotion>
</Promotions>
<POSMethod>Hosted</POSMethod>
</InitializePaymentAuthorizationRequest>
Response Elements
Element |
Optional/Required |
Description |
Type |
Restriction |
---|---|---|---|---|
/InitializePaymentAuthorizationReply/PaymentContext |
Required |
Unique identifier of the payment transaction for the order. |
ComplexType |
|
/InitializePaymentAuthorizationReply/PaymentContext/OrderId |
Required |
Unique identifier of the order from the InitializePaymentAuthorizationRequest |
String |
Max 20 characters |
/InitializePaymentAuthorizationReply/PaymentContext/TenderType |
Required |
Identifies the tender type used for the transaction. |
String |
2-4 Characters. |
/InitializePaymentAuthorizationReply/ResponseCode |
Required |
Used by client to determine Success or Fail or Timeout response. |
Enum |
Can be any of these values: |
/InitializePaymentAuthorizationReply/ResponseCodeDescription |
Optional |
Reponse code description. |
String |
|
/InitializePaymentAuthorizationReply/PaymentId |
Required |
Reference ID element in the gateway response for the initial payment. |
String |
Min 32 Characters
|
/InitializePaymentAuthorizationReply/Amount |
Required |
Total dollar value of the authorization Format as 0.00 and max 9 digits total.
|
Decimal |
Min 0.00
|
Success Response Example
<?xml version="1.0" encoding="UTF-8"?>
<InitializePaymentAuthorizationReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>12345</OrderId>
<TenderType>AF</TenderType>
</PaymentContext>
<ResponseCode>Success</ResponseCode>
<ResponseCodeDescription>Transaction Successful</ResponseCodeDescription>
<PaymentId>123456789123456789123456789Abcde</PaymentId>
<Amount currencyCode="USD">10.00</Amount>
</InitializePaymentAuthorizationReply>
Failure Response Example
<?xml version="1.0" encoding="UTF-8"?>
<InitializePaymentAuthorizationReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>12345</OrderId>
<TenderType>AF</TenderType>
</PaymentContext>
<ResponseCode>Fail</ResponseCode>
<ResponseCodeDescription>Transaction Failed</ResponseCodeDescription>
<Amount currencyCode="USD">0.00</Amount>
</InitializePaymentAuthorizationReply>
Timeout Response Example
<?xml version="1.0" encoding="UTF-8"?>
<InitializePaymentAuthorizationReply xmlns="http://api.gsicommerce.com/schema/checkout/1.0">
<PaymentContext>
<OrderId>12345</OrderId>
<TenderType>AF</TenderType>
</PaymentContext>
<ResponseCode>Timeout</ResponseCode>
<ResponseCodeDescription>Transaction Timed out</ResponseCodeDescription>
<Amount currencyCode="USD">0.00</Amount>
</InitializePaymentAuthorizationReply>
Next Step
After a successful Initialize Payment Authorization call, the next step is Get Payment Authorization call after payment is confirmed or authorized by user.