Afterpay and Clearpay Developer Guide {#afterpay-about-guide}
=============================================================

This section describes how to use this guide and where to find further information.

Audience and Purpose
:
This guide is written for application developers who want to integrate Afterpay and Clearpay into their order management system.

Conventions
:
The following special statement is used in this document:

    > An *Important* statement contains information essential to successfully completing a task or learning a concept.

Related Documentation
:
Refer to the Support Center for complete technical documentation:

    [https://www.cybersource.com/en-us/support/technical-documentation.html](https://www.cybersource.com/en-us/support/technical-documentation.md "")

Customer Support
:
For support information about any service, visit the Support Center:

<http://support.visaacceptance.com>

Recent Revisions to This Document {#afterpay-revisions}
=======================================================

24.02
-----

This update contains only editorial changes and no technical updates.

24.01
-----

Updated the example response for creating a session. See [Simple Order API Example: Create Session with XML](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-session-intro/afterpay-session-ex-so.md "").

23.01
-----

Added the transaction workflow and graphic. See [Afterpay and Clearpay Workflow](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-intro/afterpay-intro-flow.md "").  
Added the Create a Session section. See [Create a Session](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-session-intro.md "").  
Added an Authorization example that includes optional line items. See [Example: Authorizing a Payment with XML](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-auth/afterpay-auth-init-ex-xml-so.md "").  
Updated the Sales section to support the new Session service. See [Sales](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-sale.md "").

21.01
-----

Initial release.

VISA Platform Connect: Specifications and Conditions for Resellers/Partners {#vpc-partner-reseller-disclaimer}
==============================================================================================================

The following are specifications and conditions that apply to a Reseller/Partner enabling its merchants through Cybersource for Visa Platform Connect ("VPC") processing. Failure to meet any of the specifications and conditions below is subject to the liability provisions and indemnification obligations under Reseller/Partner's contract with Visa/Cybersource.

1. Before boarding merchants for payment processing on a VPC acquirer's connection, Reseller/Partner and the VPC acquirer must have a contract or other legal agreement that permits Reseller/Partner to enable its merchants to process payments with the acquirer through the dedicated VPC connection and/or traditional connection with such VPC acquirer.
2. Reseller/Partner is responsible for boarding and enabling its merchants in accordance with the terms of the contract or other legal agreement with the relevant VPC acquirer.
3. Reseller/Partner acknowledges and agrees that all considerations and fees associated with chargebacks, interchange downgrades, settlement issues, funding delays, and other processing related activities are strictly between Reseller and the relevant VPC acquirer.
4. Reseller/Partner acknowledges and agrees that the relevant VPC acquirer is responsible for payment processing issues, including but not limited to, transaction declines by network/issuer, decline rates, and interchange qualification, as may be agreed to or outlined in the contract or other legal agreement between Reseller/Partner and such VPC acquirer.

DISCLAIMER: NEITHER VISA NOR CYBERSOURCE WILL BE RESPONSIBLE OR LIABLE FOR ANY ERRORS OR OMISSIONS BY THE VISA PLATFORM CONNECT ACQUIRER IN PROCESSING TRANSACTIONS. NEITHER VISA NOR CYBERSOURCE WILL BE RESPONSIBLE OR LIABLE FOR RESELLER/PARTNER BOARDING MERCHANTS OR ENABLING MERCHANT PROCESSING IN VIOLATION OF THE TERMS AND CONDITIONS IMPOSED BY THE RELEVANT VISA PLATFORM CONNECT ACQUIRER.

Introduction to Afterpay and Clearpay {#afterpay-intro}
=======================================================

Afterpay and Clearpay are Buy Now Pay Later (BNPL) payment methods you can offer your customers through `Cybersource`. The pay later service enables online customers to purchase a product immediately and pay for it later with four equal repayments. The repayments are interest-free, as long as the customer pays on time.

Supported Services
------------------

These are the API services you must integrate with to process a transaction using Afterpay and Clearpay:

* Options
* Session
* Authorization
* Capture
* Sale
* Refund
* Authorization-reversal
* Check status

Requirements
------------

Your merchant account must be configured to process Afterpay and Clearpay payments. Contact your `Cybersource` account manager for further details.

Supported Countries and Currencies
----------------------------------

Afterpay is available in Australia, Canada, New Zealand, and the United States. Clearpay is available in the United Kingdom. This table shows the country codes and currency codes supported by Afterpay and Clearpay.

|    Country     | Country Code |       Currency       | Currency Code |
|----------------|--------------|----------------------|---------------|
| Australia      | `AU`         | Australian dollar    | `AUD`         |
| Canada         | `CA`         | Canadian dollar      | `CAN`         |
| New Zealand    | `NZ`         | New Zealand dollar   | `NZD`         |
| United Kingdom | `GB`         | United Kingdom pound | `GBP`         |
| United States  | `US`         | United States dollar | `USD`         |
[Supported Countries and Currencies]

Afterpay and Clearpay Workflow {#afterpay-intro-flow}
=====================================================

This workflow describes the sequence of events that comprise a successful Afterpay and Clearpay payment.

#### Figure:

Workflow ![](/content/dam/new-documentation/documentation/en-us/topics/payments-processing/altpay/afterpay/graphics/afterpay-sequence-flow.svg/jcr:content/renditions/original)

1. The customer begins to checkout on the merchant site.
2. The merchant sends a session API request. See [Create a Session](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-session-intro.md "").
3. `Cybersource` returns a redirect Afterpay or Clearpay URL to the merchant and a token.
4. The merchant redirects the customer to the unique Afterpay or Clearpay URL for the customer to complete the payment.
5. The customer logs into their Afterpay or Clearpay account and completes the checkout. The customer is then redirected back to the merchant site.
6. The merchant sends an authorization API request with the token from the session response. See [Authorizations](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-auth.md "").
7. `Cybersource` returns an `AUTHORIZED` response.
8. The merchant sends a capture API request to complete the payment. See [Captures](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-authcap.md "").
9. `Cybersource` returns a `SETTLED` response.

Afterpay and Clearpay Services {#afterpay-services}
===================================================

The following services are available:

* [Options](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-options.md "")
* [Create a Session](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-session-intro.md "")
* [Authorizations](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-auth.md "")
* [Captures](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-authcap.md "")
* [Authorization-Reversals](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-authrev.md "")
* [Sales](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-sale.md "")
* [Refunds](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-credit.md "")
* [Check Status](/docs/cybs/en-us/afterpay/developer/all/so/afterpay/afterpay-services/afterpay-chkstatus.md "")

Options {#afterpay-options}
===========================

Use the options service to request the minimum amount, maximum amount, and currency for the day from your Afterpay and Clearpay account.

Endpoints
---------

Set the apOptionsService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Required Fields for Options {#afterpay-options-reqd-fields}
===========================================================

[apCheckStatusService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-check-status-service-run.md "")
:
Set to `true`.

[apOptionsService_limit](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-options-service-limit.md "")
:

[apOptionsService_offset](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-options-service-offset.md "")
:

[apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
:
Set to `afp`

[merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
:

[merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
:

Example: Options Service with XML {#afterpay-options-init-ex-xml-so}
====================================================================

Request

```
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
   &lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;apPaymentType&gt;afp&lt;/apPaymentType&gt;
   &lt;apOptionsService run="true"&gt;
      &lt;limit&gt;3&lt;/limit&gt;
      &lt;offset&gt;2&lt;/offset&gt;
   &lt;/apOptionsService&gt;
 &lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
   &lt;merchantReferenceCode&gt;123456&lt;/merchantReferenceCode&gt;
   &lt;requestID&gt;6246005374346859304083&lt;/requestID&gt;
   &lt;decision&gt;ACCEPT&lt;/decision&gt;
   &lt;reasonCode&gt;100&lt;/reasonCode&gt;
   &lt;apOptionsReply&gt;
      &lt;reasonCode&gt;100&lt;/reasonCode&gt;
      &lt;responseCode&gt;00000&lt;/responseCode&gt;
      &lt;offset&gt;0&lt;/offset&gt;
      &lt;count&gt;6&lt;/count&gt;
      &lt;totalCount&gt;6&lt;/totalCount&gt;
      &lt;option data="0"&gt;
         &lt;id&gt;6&lt;/id&gt;
         &lt;name&gt;1000.00&lt;/name&gt;
      &lt;/option&gt;
      &lt;option data="1"&gt;
         &lt;id&gt;5&lt;/id&gt;
         &lt;name&gt;Maximum Amount&lt;/name&gt;
      &lt;/option&gt;
      &lt;option data="2"&gt;
         &lt;id&gt;4&lt;/id&gt;
         &lt;name&gt;1.00&lt;/name&gt;
      &lt;/option&gt;
      &lt;option data="3"&gt;
         &lt;id&gt;3&lt;/id&gt;
         &lt;name&gt;Minimum Amount&lt;/name&gt;
      &lt;/option&gt;
      &lt;option data="4"&gt;
         &lt;id&gt;2&lt;/id&gt;
         &lt;name&gt;USD&lt;/name&gt;
      &lt;/option&gt;
      &lt;option data="5"&gt;
         &lt;id&gt;1&lt;/id&gt;
         &lt;name&gt;Currency&lt;/name&gt;
      &lt;/option&gt;
   &lt;/apOptionsReply&gt;
&lt;/replyMessage&gt;
```

Create a Session {#afterpay-session-intro}
==========================================

Creating a session is mandatory for processing a payment. To create a session, you must include shipping fields in your request. The shipping field values are included in the invoice Afterpay and Clearpay send to the customer.  
A successful session response includes an Afterpay or Clearpay redirect URL and a token. Send the customer to the redirect URL to approve the payment using their Afterpay or Clearpay account. Use the token in the authorization request to link the authorization to the session.

Endpoints
---------

Set the apSessionsService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Response Status
---------------

The session service responds with this status as the apSessionReply_status field value:

* `PENDING`: The Afterpay or Clearpay redirect URL is generated. Redirect the customer to the Afterpay or Clearpay URL.
  {#afterpay-session-intro_ul_gjc_lsn_jyb}  
  The session service also responds with a reason code as the apSessionReply_reasonCode field value. For more information about reason codes, see the [Reason Codes for the Simple Order API](https://developer.cybersource.com/docs/cybs/en-us/reason-codes-so/reference/all/so/reason-codes-so/reason-codes-so.md "").

Line Items {#afterpay-intro-items}
==================================

Afterpay and Clearpay use optional line item fields when you send a session request.  
Line items are used to include information about the goods that your customers purchase, such as product name, quantity, and price.  
Line items are represented as the item_#_ fields, starting with item_0_, and increasing in numerical order.  
These fields are required for each line item that you use:

[item_#_productCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-code.md "")
:

[item_#_productName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-name.md "")
:

[item_#_productSKU](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-sku.md "")
:

[item_#_quantity](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-quantity.md "")
:

[item_#_totalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-total-amount.md "")
:

[item_#_unitPrice](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-unit-price.md "")
:
Including Line Items  
This example shows three valid line items.

```
&lt;item id="0"&gt;
	&lt;unitPrice&gt;20&lt;/unitPrice&gt;
	&lt;quantity&gt;1&lt;/quantity&gt;
	&lt;productCode&gt;98765&lt;/productCode&gt;
	&lt;productName&gt;shirt&lt;/productName&gt;
	&lt;productSKU&gt;testJ&lt;/productSKU&gt;
	&lt;totalAmount&gt;20&lt;/totalAmount&gt;
&lt;/item&gt;
&lt;item id="1"&gt;
	&lt;unitPrice&gt;10&lt;/unitPrice&gt;
	&lt;quantity&gt;3&lt;/quantity&gt;
	&lt;productCode&gt;65432&lt;/productCode&gt;
	&lt;productName&gt;pants&lt;/productName&gt;
	&lt;productSKU&gt;testK&lt;/productSKU&gt;
	&lt;totalAmount&gt;30&lt;/totalAmount&gt;
&lt;/item&gt;
&lt;item id="2"&gt;
	&lt;unitPrice&gt;5&lt;/unitPrice&gt;
	&lt;quantity&gt;5&lt;/quantity&gt;
	&lt;productCode&gt;12345&lt;/productCode&gt;
	&lt;productName&gt;socks&lt;/productName&gt;
	&lt;productSKU&gt;testX&lt;/productSKU&gt;
	&lt;totalAmount&gt;25&lt;/totalAmount&gt;
&lt;/item&gt;
```

Creating a Session {#afterpay-session-task}
===========================================

Follow these steps to successfully complete a session request.

1. Send a `POST` request to the `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor` endpoint and include these required fields:

   #### ADDITIONAL INFORMATION

   [apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
   :
   Set to `afp`.

   [apSaleService_cancelURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-cancel-url.md "")
   :

   [apSaleService_failureURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-failure-url.md "")
   :

   [apSaleService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-run.md "")
   :
   Set to `true`.

   [apSessionsService_sessionsType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-session-session-type.md "")
   :
   Set to `N`.

   [apSessionsService_successURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-session-success-url.md "")
   :

   [billTo_city](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-city.md "")
   :

   [billTo_country](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-country.md "")
   :

   [billTo_email](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-email.md "")
   :

   [billTo_firstName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-first-name.md "")
   :

   [billTo_lastName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-last-name.md "")
   :

   [billTo_postalCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-postal-code.md "")
   :

   [billTo_state](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-state.md "")
   :

   [billTo_street1](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-street1.md "")
   :

   [merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
   :

   [merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
   :

   [purchaseTotals_currency](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-currency.md "")
   :

   [purchaseTotals_grandTotalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-grand-total-amount.md "")
   :

   [shipTo_city](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-city.md "")
   :

   [shipTo_country](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-country.md "")
   :

   [shipTo_firstName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-first-name.md "")
   :

   [shipTo_lastName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-last-name.md "")
   :

   [shipTo_postalCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-postal-code.md "")
   :

   [shipTo_state](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-state.md "")
   :

   [shipTo_street1](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-street1.md "")
   :

2. Include any of these optional fields in the request:

   #### ADDITIONAL INFORMATION

   apSessionService_paymentMethod_name
   :

   [apSessionsService_sessionsType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-session-session-type.md "")
   :
   Set to `N`.

   [billTo_phoneNumber](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-phone-number.md "")
   :

   billTo_street2
   :

   [item_#_productCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-code.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_productDescription](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-description.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_productName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-name.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_productSKU](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-sku.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_quantity](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-quantity.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_totalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-total-amount.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.
   :
   When this field is included in the request, the purchaseTotals_grandTotalAmount field is no longer required.

   [item_#_unitPrice](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-unit-price.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [shipTo_email](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-email.md "")
   :

   [shipTo_phoneNumber](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-phone-number.md "")
   :

   Non-US Countries
   :
   [item_#_taxAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-tax-amount.md "")

   US
   :
   [purchaseTotals_taxAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-tax-amount.md "")

3. Store the value in the processorToken field from the session response. You must include this value in the follow-on authorization request.

   #### ADDITIONAL INFORMATION

   ```
   &lt;processorToken&gt;5f97d636-85d1-486b-a1de-96111938ec61&lt;/processorToken&gt;
   ```
4. Redirect the customer to the returned Afterpay or Clearpay URL contained in the merchantURL response field.

   #### ADDITIONAL INFORMATION

   ```
   &lt;merchantURL&gt;https://portal.afterpay.com/us/checkout/?token=002.suuh2tq1gfvthg0180il0928fjkhg1p4ufg4savhihcvm9uj&lt;/merchantURL&gt;
   ```
5. When the customer completes the checkout using their Afterpay or Clearpay credentials, Afterpay or Clearpay redirects the customer to the success URL specified in the session request. You can now send an authorization request.

6. When you send the authorization request, set the apAuthService_preapprovalToken field to the processorToken field value you stored from the session response.

`Simple Order API` Example: Create Session with XML {#afterpay-session-ex-so}
=============================================================================

Request

```keyword
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
    &lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
    &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
    &lt;billTo&gt;
	&lt;firstName&gt;John&lt;/firstName&gt;
	&lt;lastName&gt;Smith&lt;/lastName&gt;
	&lt;street1&gt;Happy&lt;/street1&gt;
	&lt;city&gt;Austin&lt;/city&gt;
	&lt;state&gt;TX&lt;/state&gt;
	&lt;postalCode&gt;78757&lt;/postalCode&gt;
	&lt;country&gt;US&lt;/country&gt;
	&lt;email&gt;test@cybs.com&lt;/email&gt;
    &lt;/billTo&gt;
    &lt;shipTo&gt;
	&lt;firstName&gt;John&lt;/firstName&gt;
	&lt;lastName&gt;Smith&lt;/lastName&gt;
	&lt;street1&gt;Happy&lt;/street1&gt;
	&lt;city&gt;Austin&lt;/city&gt;
	&lt;state&gt;TX&lt;/state&gt;
	&lt;postalCode&gt;78757&lt;/postalCode&gt;
	&lt;country&gt;US&lt;/country&gt;
    &lt;/shipTo&gt;
    &lt;purchaseTotals&gt;
	&lt;currency&gt;USD&lt;/currency&gt;
	&lt;grandTotalAmount&gt;600&lt;/grandTotalAmount&gt;
    &lt;/purchaseTotals&gt;
    &lt;apPaymentType&gt;AFP&lt;/apPaymentType&gt;
    &lt;apSessionsService run="true"&gt;
	&lt;cancelURL&gt;https://www.test0.com&lt;/cancelURL&gt;
	&lt;successURL&gt;https://www.test1.com&lt;/successURL&gt;
    &lt;/apSessionsService&gt;
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
    &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
    &lt;requestID&gt;6951825944986489403007&lt;/requestID&gt;
    &lt;decision&gt;ACCEPT&lt;/decision&gt;
    &lt;reasonCode&gt;100&lt;/reasonCode&gt;
    &lt;requestToken&gt;AxjnrwSTeNv3IJzf8zZ/AAUZYjWmrWbQcsYsOgojmhl/H/SCHUwGX0MmkmXoxZaH/pN42/cgnN/zNn8A2VlF&lt;/requestToken&gt;
    &lt;purchaseTotals&gt;
	&lt;currency&gt;USD&lt;/currency&gt;
    &lt;/purchaseTotals&gt;
    &lt;apSessionsReply&gt;
	&lt;reasonCode&gt;100&lt;/reasonCode&gt;
	&lt;responseCode&gt;00000&lt;/responseCode&gt;
	&lt;merchantURL&gt;https://portal.sandbox.afterpay.com/us/checkout/?token=002.suuh2tq1gfvthg0180il0928fjkhg1p4ufg4savhihcvm9uj&lt;/merchantURL&gt;
	&lt;processorToken&gt;519ff272-d850-4c81-ab65-674f670063c7&lt;/processorToken&gt;
	&lt;amount&gt;600.00&lt;/amount&gt;
	&lt;reconciliationID&gt;XFZ55MP91ECP&lt;/reconciliationID&gt;
	&lt;status&gt;COMPLETED&lt;/status&gt;
	&lt;dateTime&gt;2023-09-20T04:03:14Z&lt;/dateTime&gt;
    &lt;/apSessionsReply&gt;
&lt;/replyMessage&gt;
```

`Simple Order API` Example: Create Session Using Line Items with XML {#afterpay-session-li-ex-so}
=================================================================================================

Request with Optional Line Items

```keyword
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
	&lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
	&lt;billTo&gt;
		&lt;firstName&gt;John&lt;/firstName&gt;
		&lt;lastName&gt;Smith&lt;/lastName&gt;
		&lt;street1&gt;Peachtree St&lt;/street1&gt;
		&lt;city&gt;Atlanta&lt;/city&gt;
		&lt;state&gt;GA&lt;/state&gt;
		&lt;postalCode&gt;33019&lt;/postalCode&gt;
		&lt;country&gt;US&lt;/country&gt;
		&lt;email&gt;test@cybs.com&lt;/email&gt;
	&lt;/billTo&gt;
	&lt;shipTo&gt;
		&lt;firstName&gt;John&lt;/firstName&gt;
		&lt;lastName&gt;Smith&lt;/lastName&gt;
		&lt;street1&gt;Peachtree St&lt;/street1&gt;
		&lt;city&gt;Atlanta&lt;/city&gt;
		&lt;state&gt;GA&lt;/state&gt;
		&lt;postalCode&gt;30319&lt;/postalCode&gt;
		&lt;country&gt;US&lt;/country&gt;
	&lt;/shipTo&gt;
	&lt;item id="0"&gt;
		&lt;unitPrice&gt;1&lt;/unitPrice&gt;              
		&lt;quantity&gt;10&lt;/quantity&gt;               
		&lt;productCode&gt;4564&lt;/productCode&gt;      
		&lt;productName&gt;TV&lt;/productName&gt;                
		&lt;productSKU&gt;testI&lt;/productSKU&gt;
		&lt;totalAmount&gt;10&lt;/totalAmount&gt;
	&lt;/item&gt;
	&lt;item id="1"&gt;
		&lt;unitPrice&gt;15&lt;/unitPrice&gt;
		&lt;quantity&gt;1&lt;/quantity&gt;
		&lt;productCode&gt;65432&lt;/productCode&gt;
		&lt;productName&gt;TV&lt;/productName&gt;
		&lt;productSKU&gt;testJ&lt;/productSKU&gt;
		&lt;totalAmount&gt;15&lt;/totalAmount&gt;
	&lt;/item&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;USD&lt;/currency&gt;
	&lt;/purchaseTotals&gt;
	&lt;apPaymentType&gt;AFP&lt;/apPaymentType&gt;
	&lt;apSessionsService run="true"&gt;
		&lt;cancelURL&gt;https://www.test.com&lt;/cancelURL&gt;
		&lt;successURL&gt;https://www.test1.com&lt;/successURL&gt;
		&lt;paymentMethod_name&gt;afp&lt;/paymentMethod_name&gt;
	&lt;/apSessionsService&gt;
&lt;/requestMessage&gt;
```

Response with Optional Line Items

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
	&lt;requestID&gt;6977376246486503703007&lt;/requestID&gt;
	&lt;decision&gt;ACCEPT&lt;/decision&gt;
	&lt;reasonCode&gt;100&lt;/reasonCode&gt;
	&lt;requestToken&gt;AxjnrwSTej6MCHSsbsHfAAUZYiy6ladJo2qFOEnkFtpem2kDJxDNyGTSTL0YwW2Lkm9H0YEOlY3YO+AAES2i&lt;/requestToken&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;USD&lt;/currency&gt;
	&lt;/purchaseTotals&gt;
	&lt;apSessionsReply&gt;
		&lt;reasonCode&gt;100&lt;/reasonCode&gt;
		&lt;responseCode&gt;00001&lt;/responseCode&gt;
		&lt;merchantURL&gt;https://portal.sandbox.afterpay.com/us/checkout/?token=002.kfl0qoc9q5tarv41p34s1dvbrk62iflv382j1sd0ot7o5s82&lt;/merchantURL&gt;
		&lt;processorToken&gt;0d97aa1b-a9dd-4e9c-b60c-b1157470d034&lt;/processorToken&gt;
		&lt;amount&gt;25.00&lt;/amount&gt;
		&lt;reconciliationID&gt;XEKTVNIQZPSB&lt;/reconciliationID&gt;
		&lt;status&gt;PENDING&lt;/status&gt;
		&lt;dateTime&gt;2023-10-19T17:47:05Z&lt;/dateTime&gt;
	&lt;/apSessionsReply&gt;
&lt;/replyMessage&gt;
```

Authorizations {#afterpay-auth}
===============================

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
---------

Set the apAuthService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Response Status
---------------

An authorization can have one of the following statuses:

* `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 {#afterpay-auth-reqd-fields}
======================================================================

Include these required fields in the authorization request.

[apAuthService_preapprovalToken](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-auth-service-preappr-token.md "")
:
Set to the processorToken from the session response.

[apAuthService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-auth-service-run.md "")
:
Set to `true`.

[apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
:
Set to `afp`.

[apSaleService_cancelURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-cancel-url.md "")
:

[apSessionsService_successURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-session-success-url.md "")
:

[billTo_city](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-city.md "")
:

[billTo_country](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-country.md "")
:

[billTo_email](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-email.md "")
:

[billTo_firstName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-first-name.md "")
:

[billTo_lastName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-last-name.md "")
:

[billTo_postalCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-postal-code.md "")
:

[billTo_state](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-state.md "")
:

[billTo_street1](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-street1.md "")
:

[merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
:

[merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
:

[purchaseTotals_currency](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-currency.md "")
:

[purchaseTotals_grandTotalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-grand-total-amount.md "")
:

[shipTo_city](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-city.md "")
:

[shipTo_country](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-country.md "")
:

[shipTo_firstName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-first-name.md "")
:

[shipTo_lastName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-last-name.md "")
:

[shipTo_postalCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-postal-code.md "")
:

[shipTo_state](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-state.md "")
:

[shipTo_street1](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-street1.md "")
:

Optional Fields for Authorizing a Payment {#afterpay-auth-opt-fields}
=====================================================================

Choose from these optional fields to include in the authorization request.

[apAuthService_failureURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-auth-service-failure-url.md "")
:

apAuthService_reconciliationID
:
Set to the reconciliationID returned in the session response.

[billTo_phoneNumber](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-phone-number.md "")
:

[item_#_productCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-code.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_productDescription](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-description.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_productName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-name.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_productSKU](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-sku.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_quantity](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-quantity.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_totalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-total-amount.md "")
:
If this field is present, the purchaseTotals_grandTotalAmount field becomes optional.
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_unitPrice](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-unit-price.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[merchantDefinedData_field5](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-defined-data-field-1-20.md "")
:
Set to `inline`.

[shipTo_buildingNumber](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-building-number.md "")
:

[shipTo_district](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-district.md "")
:

[shipTo_email](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-email.md "")
:

[shipTo_street2](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-street2.md "")
:

Example: Authorizing a Payment with XML {#afterpay-auth-init-ex-xml-so}
=======================================================================

These examples show successful authorization requests.  
Request

```keyword
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
	&lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
	&lt;billTo&gt;
		&lt;firstName&gt;John&lt;/firstName&gt;
		&lt;lastName&gt;Smith&lt;/lastName&gt;
		&lt;street1&gt;123 Happy St&lt;/street1&gt;
		&lt;city&gt;Austin&lt;/city&gt;
		&lt;state&gt;TX&lt;/state&gt;
		&lt;postalCode&gt;78757&lt;/postalCode&gt;
		&lt;country&gt;US&lt;/country&gt;
		&lt;email&gt;test@cybs.com&lt;/email&gt;
	&lt;/billTo&gt;
	&lt;shipTo&gt;
		&lt;firstName&gt;John&lt;/firstName&gt;
		&lt;lastName&gt;Smith&lt;/lastName&gt;
		&lt;street1&gt;123 Happy&lt;/street1&gt;
		&lt;city&gt;Austin&lt;/city&gt;
		&lt;state&gt;TX&lt;/state&gt;
		&lt;postalCode&gt;78757&lt;/postalCode&gt;
		&lt;country&gt;US&lt;/country&gt;	
	&lt;/shipTo&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;USD&lt;/currency&gt;
		&lt;grandTotalAmount&gt;75.00&lt;/grandTotalAmount&gt;
	&lt;/purchaseTotals&gt;
	&lt;apPaymentType&gt;afp&lt;/apPaymentType&gt;
	&lt;apAuthService run="true"&gt;
		&lt;cancelURL&gt;https://www.test.com&lt;/cancelURL&gt;
		&lt;successURL&gt;https://www.test.com&lt;/successURL&gt;
		&lt;preapprovalToken&gt;519ff272-d850-4c81-ab65-674f670063c7&lt;/preapprovalToken&gt;
	&lt;/apAuthService&gt;
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
	&lt;requestID&gt;6246274241256683803069&lt;/requestID&gt;
	&lt;decision&gt;ACCEPT&lt;/decision&gt;
	&lt;reasonCode&gt;100&lt;/reasonCode&gt;
	&lt;requestToken&gt;AxjnrwSTeaOOe5Ed6nFKAAUZYjWmrWdFqOaFmiojml/qNzSBvUwzPhk0ky9GMFti5JvNHHPciO9TilAA4hjb&lt;/requestToken&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;USD&lt;/currency&gt;
	&lt;/purchaseTotals&gt;
	&lt;apAuthReply&gt;
		&lt;reasonCode&gt;100&lt;/reasonCode&gt;
		&lt;status&gt;AUTHORIZED&lt;/status&gt;
		&lt;processorResponse&gt;00003&lt;/processorResponse&gt;
		&lt;amount&gt;75.00&lt;/amount&gt;
		&lt;dateTime&gt;2023-10-06T19:33:21Z&lt;/dateTime&gt;
		&lt;paymentStatus&gt;authorized&lt;/paymentStatus&gt;
		&lt;responseCode&gt;00003&lt;/responseCode&gt;
		&lt;reconciliationID&gt;XFZ55NET9PYQ&lt;/reconciliationID&gt;
		&lt;processorTransactionID&gt;519ff272-d850-4c81-ab65-674f670063c7&lt;/processorTransactionID&gt;
	&lt;/apAuthReply&gt;
&lt;/replyMessage&gt;
```

Request with Optional Line Items

```keyword
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
	&lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
	&lt;billTo&gt;
		&lt;firstName&gt;John&lt;/firstName&gt;
		&lt;lastName&gt;Smith&lt;/lastName&gt;
		&lt;street1&gt;Peachtree St&lt;/street1&gt;
		&lt;city&gt;Atlanta&lt;/city&gt;
		&lt;state&gt;GA&lt;/state&gt;
		&lt;postalCode&gt;33019&lt;/postalCode&gt;
		&lt;country&gt;US&lt;/country&gt;
		&lt;email&gt;test@cybs.com&lt;/email&gt;
	&lt;/billTo&gt;
	&lt;shipTo&gt;
		&lt;firstName&gt;John&lt;/firstName&gt;
		&lt;lastName&gt;Smith&lt;/lastName&gt;
		&lt;street1&gt;Peachtree St&lt;/street1&gt;
		&lt;city&gt;Atlanta&lt;/city&gt;
		&lt;state&gt;GA&lt;/state&gt;
		&lt;postalCode&gt;33019&lt;/postalCode&gt;
		&lt;country&gt;US&lt;/country&gt;
	&lt;/shipTo&gt;
	&lt;item id="0"&gt;
		&lt;unitPrice&gt;1&lt;/unitPrice&gt;               
		&lt;quantity&gt;10&lt;/quantity&gt;              
		&lt;productCode&gt;4564&lt;/productCode&gt;              
		&lt;productName&gt;TV&lt;/productName&gt;             
		&lt;productSKU&gt;testI&lt;/productSKU&gt;
		&lt;totalAmount&gt;10&lt;/totalAmount&gt;
	&lt;/item&gt;
	&lt;item id="1"&gt;
		&lt;unitPrice&gt;15&lt;/unitPrice&gt;
		&lt;quantity&gt;1&lt;/quantity&gt;
		&lt;productCode&gt;65432&lt;/productCode&gt;
		&lt;productName&gt;TV&lt;/productName&gt;
		&lt;productSKU&gt;testJ&lt;/productSKU&gt;
		&lt;totalAmount&gt;15&lt;/totalAmount&gt;
	&lt;/item&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;USD&lt;/currency&gt;
	&lt;/purchaseTotals&gt;
	&lt;apPaymentType&gt;AFP&lt;/apPaymentType&gt;
	&lt;apAuthService run="true"&gt;
		&lt;cancelURL&gt;https://www.test.com&lt;/cancelURL&gt;
		&lt;successURL&gt;https://www.test1.com&lt;/successURL&gt;
		&lt;preapprovalToken&gt;0d97aa1b-a9dd-4e9c-b60c-b1157470d034&lt;/preapprovalToken&gt;
	&lt;/apAuthService&gt;
&lt;/requestMessage&gt;
```

Response with Optional Line Items

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
	&lt;requestID&gt;6977375233876065503009&lt;/requestID&gt;
	&lt;decision&gt;ACCEPT&lt;/decision&gt;
	&lt;reasonCode&gt;100&lt;/reasonCode&gt;
	&lt;requestToken&gt;AxjnrwSTej6Ib33u98chAAUZYiy69adJpUaUiInkFtpV8ukDJxDNyGTSTL0YwW2Lkm9H0Q3vvd745CAA6Qe8&lt;/requestToken&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;USD&lt;/currency&gt;
	&lt;/purchaseTotals&gt;
	&lt;apAuthReply&gt;
		&lt;reasonCode&gt;100&lt;/reasonCode&gt;
		&lt;status&gt;AUTHORIZED&lt;/status&gt;
		&lt;processorResponse&gt;00003&lt;/processorResponse&gt;
		&lt;amount&gt;25.00&lt;/amount&gt;
		&lt;dateTime&gt;2023-10-19T17:45:24Z&lt;/dateTime&gt;
		&lt;paymentStatus&gt;authorized&lt;/paymentStatus&gt;
		&lt;responseCode&gt;00003&lt;/responseCode&gt;
		&lt;reconciliationID&gt;XEKWVNIRQRHD&lt;/reconciliationID&gt;
		&lt;processorTransactionID&gt;0d97aa1b-a9dd-4e9c-b60c-b1157470d034&lt;/processorTransactionID&gt;
	&lt;/apAuthReply&gt;
&lt;/replyMessage&gt;
```

Captures {#afterpay-authcap}
============================

Use this service to capture an authorized payment. Partial captures and full-amount captures are both supported.

Endpoints
---------

Set the apCaptureService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Response Status
---------------

The capture service responds with one of these statuses as the apCaptureReply_status response field value:

* `FAILED`: The capture request failed.
* `PENDING`: The capture request is accepted but is not captured. Request the check status service to retrieve status updates.
* `SETTLED`: The capture request is settled for the requested amount.

{#afterpay-authcap_ul_pv2_n2z_byb}The capture service also responds with a reason code as the apCaptureReply_reasonCode field value.

Required Fields for Capturing an Authorization {#afterpay-authcap-reqd-fields}
==============================================================================

Include these required fields in the capture request.

[apCaptureService_authRequestID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-capture-service-auth-request-id.md "")
:

[apCaptureService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-capture-service-run.md "")
:
Set to `true`.

[apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
:
Set to `afp`.

[merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
:

[merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
:

[purchaseTotals_currency](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-currency.md "")
:

[purchaseTotals_grandTotalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-grand-total-amount.md "")
:

Example: Capturing an Authorization with XML {#afterpay-authcap-init-ex-xml-so}
===============================================================================

Request

```
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
   &lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;purchaseTotals&gt;
      &lt;currency&gt;USD&lt;/currency&gt;
      &lt;grandTotalAmount&gt;1&lt;/grandTotalAmount&gt;
   &lt;/purchaseTotals&gt;
   &lt;apPaymentType&gt;afp&lt;/apPaymentType&gt;
   &lt;apCaptureService run="true"&gt;
	&lt;authRequestID&gt;6246274241256683803069&lt;/authRequestID&gt;
   &lt;/apCaptureService&gt;
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;requestID&gt;6246277717236180203285&lt;/requestID&gt;
   &lt;decision&gt;ACCEPT&lt;/decision&gt;
   &lt;reasonCode&gt;100&lt;/reasonCode&gt;
   &lt;purchaseTotals&gt;
      &lt;currency&gt;USD&lt;/currency&gt;
   &lt;/purchaseTotals&gt;
   &lt;apCaptureReply&gt;
      &lt;reasonCode&gt;100&lt;/reasonCode&gt;
      &lt;status&gt;SETTLED&lt;/status&gt;
      &lt;processorResponse&gt;00004&lt;/processorResponse&gt;
      &lt;amount&gt;1.00&lt;/amount&gt;
      &lt;reconciliationID&gt;XFZOSQ97H6UE&lt;/reconciliationID&gt;
      &lt;paymentStatus&gt;settled&lt;/paymentStatus&gt;
      &lt;responseCode&gt;00004&lt;/responseCode&gt;
   &lt;/apCaptureReply&gt;
&lt;/replyMessage&gt;
```

Sales {#afterpay-sale}
======================

This service enables you to send both a payment authorization request and a capture request as a single transaction using the sale service. You must include the token received from the session response in the sale request to receive a successful response.

Endpoints
---------

Set the apSaleService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`{#afterpay-sale_d7e266}  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`{#afterpay-sale_d7e273}

Response Status
---------------

A sale request can have one of the following statuses:

* `FAILED`: the sale request fails when there are invalid or missing fields.
* `PENDING`: the sale request is accepted but is not settled. To settle the payment, check out using the payment redirect URL that you received in the sale response.

Once ` SETTLED `, a sale transaction cannot be reversed using the authorization-reversal service. You must use a credit request to refund a transaction.

Required Fields for a Sale {#afterpay-sale-reqd-fields}
=======================================================

Include these required fields in the sale request.

[apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
:
Set to `afp`.

[apSaleService_cancelURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-cancel-url.md "")
:

[apSaleService_failureURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-failure-url.md "")
:

[apSaleService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-run.md "")
:
Set to `true`.

apSaleService_successfulURL
:

apSaleService_preapprovalToken
:
Set to the processorToken returned in the session response.

[billTo_city](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-city.md "")
:

[billTo_country](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-country.md "")
:

[billTo_email](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-email.md "")
:

[billTo_firstName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-first-name.md "")
:

[billTo_lastName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-last-name.md "")
:

[billTo_postalCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-postal-code.md "")
:

[billTo_state](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-state.md "")
:

[billTo_street1](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-street1.md "")
:

[merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
:

[merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
:

[purchaseTotals_currency](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-currency.md "")
:

[purchaseTotals_grandTotalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-grand-total-amount.md "")
:

[shipTo_city](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-city.md "")
:

[shipTo_country](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-country.md "")
:

[shipTo_firstName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-first-name.md "")
:

[shipTo_lastName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-last-name.md "")
:

[shipTo_postalCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-postal-code.md "")
:

[shipTo_state](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-state.md "")
:

[shipTo_street1](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-street1.md "")
:

Optional Fields for a Sale {#afterpay-sale-opt-fields}
======================================================

Choose from these optional fields to include in the sale request.

[billTo_phoneNumber](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-phone-number.md "")
:

[item_#_productCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-code.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_productDescription](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-description.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_productName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-name.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_productSKU](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-sku.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_quantity](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-quantity.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[item_#_totalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-total-amount.md "")
:
Replace the `#` character with a sequential number starting from `0`.
:
When this field is included in the request, the purchaseTotals_grandTotalAmount field is no longer required.

[item_#_unitPrice](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-unit-price.md "")
:
Replace the `#` character with a sequential number starting from `0`.

[shipTo_buildingNumber](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-building-number.md "")
:

[shipTo_district](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-district.md "")
:

[shipTo_email](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-email.md "")
:

[shipTo_phoneNumber](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-phone-number.md "")
:

[shipTo_street2](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ship-to-street2.md "")
:

Example: Performing a Sale with XML {#afterpay-sale-init-ex-xml-so}
===================================================================

Request

```keyword
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
	&lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
	&lt;merchantReferenceCode&gt;ref-1234&lt;/merchantReferenceCode&gt;
	&lt;billTo&gt;
		&lt;firstName&gt;John&lt;/firstName&gt;
		&lt;lastName&gt;Smith&lt;/lastName&gt;
		&lt;street1&gt;Happy St&lt;/street1&gt;
		&lt;city&gt;Austin&lt;/city&gt;
		&lt;state&gt;TX&lt;/state&gt;
		&lt;postalCode&gt;78757&lt;/postalCode&gt;
		&lt;country&gt;US&lt;/country&gt;
		&lt;email&gt;test@cybs.com&lt;/email&gt;
	&lt;/billTo&gt;
	&lt;shipTo&gt;
		&lt;firstName&gt;John&lt;/firstName&gt;
		&lt;lastName&gt;Smith&lt;/lastName&gt;
		&lt;street1&gt;Happy&lt;/street1&gt;
		&lt;city&gt;Austin&lt;/city&gt;
		&lt;state&gt;TX&lt;/state&gt;
		&lt;postalCode&gt;78757&lt;/postalCode&gt;
		&lt;country&gt;US&lt;/country&gt;
		&lt;phoneNumber&gt;33623456789&lt;/phoneNumber&gt;
	&lt;/shipTo&gt;
	&lt;purchaseTotals&gt;
		&lt;currency&gt;USD&lt;/currency&gt;
		&lt;grandTotalAmount&gt;100.00&lt;/grandTotalAmount&gt;
	&lt;/purchaseTotals&gt;
	&lt;apPaymentType&gt;afp&lt;/apPaymentType&gt;
	&lt;apSaleService run="true"&gt;
		&lt;cancelURL&gt;http://test0.com&lt;/cancelURL&gt;
		&lt;successURL&gt;http://test1.com&lt;/successURL&gt;
		&lt;failureURL&gt;http://test2.com&lt;/failureURL&gt;
		&lt;preapprovalToken&gt;c25e5752-ce21-4426-9b77-635a2d6a7aee&lt;/preapprovalToken&gt;
	&lt;/apSaleService&gt;
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;requestID&gt;6246055293446455103056&lt;/requestID&gt;
   &lt;decision&gt;ACCEPT&lt;/decision&gt;
   &lt;reasonCode&gt;100&lt;/reasonCode&gt;
   &lt;purchaseTotals&gt;
      &lt;currency&gt;USD&lt;/currency&gt;
   &lt;/purchaseTotals&gt;
   &lt;apSaleReply&gt;
      &lt;reasonCode&gt;100&lt;/reasonCode&gt;
      &lt;paymentStatus&gt;pending&lt;/paymentStatus&gt;
      &lt;responseCode&gt;00001&lt;/responseCode&gt;
      &lt;merchantURL&gt;https://portal.afterpay.com/us/checkout/?token=002.co8&lt;/merchantURL&gt;
      &lt;processorTransactionID&gt;ab19e56a-1056&lt;/processorTransactionID&gt;
      &lt;reconciliationID&gt;XFZOQQ97FEIW&lt;/reconciliationID&gt;
      &lt;amount&gt;10.00&lt;/amount&gt;
      &lt;processorResponse&gt;00001&lt;/processorResponse&gt;
   &lt;/apSaleReply&gt;
&lt;/replyMessage&gt;
```

Refunds {#afterpay-credit}
==========================

Send a refund request to credit a `SETTLED` capture. A refund request requires the request ID and reconciliation ID returned in the capture response.

Endpoints
---------

Set the apRefundService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Response Status
---------------

The refund service responds with one of these statuses as the apRefundReply_status field value:

* `FAILED`: The refund request failed.
* `PENDING`: The refund request is accepted but is not refunded. Request the check status service to retrieve status updates.
* `REFUNDED`: The captured payment is successfully refunded.

The refund service also responds with a reason code as the apRefundReply_reasonCode field value.

Required Fields for Refunding a Payment {#afterpay-credit-reqd-fields}
======================================================================

[apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
:
Set to `afp`.

[apRefundService_refundRequestID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-refund-service-refund-request-id.md "")
:

[apRefundService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-refund-service-run.md "")
:
Set to `true`.

[merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
:

[merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
:

[purchaseTotals_currency](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-currency.md "")
:

[purchaseTotals_grandTotalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-grand-total-amount.md "")
:

Example: Refunding a Payment with XML {#afterpay-credit-init-ex-xml-so}
=======================================================================

Request

```
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt; 
   &lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;purchaseTotals&gt;
      &lt;currency&gt;USD&lt;/currency&gt;
      &lt;grandTotalAmount&gt;1&lt;/grandTotalAmount&gt;
   &lt;/purchaseTotals&gt;
   &lt;apPaymentType&gt;afp&lt;/apPaymentType&gt;
   &lt;apRefundService run="true"&gt;
      &lt;refundRequestID&gt;6246277717236180203285&lt;/refundRequestID&gt;
   &lt;/apRefundService&gt; 
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt; 
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;requestID&gt;6246279076626811503016&lt;/requestID&gt;
   &lt;decision&gt;ACCEPT&lt;/decision&gt;
   &lt;reasonCode&gt;100&lt;/reasonCode&gt;
   &lt;purchaseTotals&gt;
      &lt;currency&gt;USD&lt;/currency&gt;
      &lt;/purchaseTotals&gt;
   &lt;apRefundReply&gt;
      &lt;reasonCode&gt;100&lt;/reasonCode&gt;
      &lt;transactionID&gt;47797f6a-d894-428b-91d2-8408e8a53c5a&lt;/transactionID&gt;
      &lt;status&gt;REFUNDED&lt;/status&gt;
      &lt;processorResponse&gt;00006&lt;/processorResponse&gt;
      &lt;amount&gt;1.00&lt;/amount&gt;
      &lt;reconciliationID&gt;XFZOSQ97H6UE&lt;/reconciliationID&gt;
      &lt;returnRef&gt;EE3FLQ9GXCWH&lt;/returnRef&gt;
      &lt;paymentStatus&gt;refunded&lt;/paymentStatus&gt;
      &lt;responseCode&gt;00006&lt;/responseCode&gt;
   &lt;/apRefundReply&gt;
&lt;/replyMessage&gt;
```

Authorization-Reversals {#afterpay-authrev}
===========================================

Use this service to reverse an unnecessary or undesired authorization.

Endpoints
---------

Set the apAuthReversalService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Response Status
---------------

The authorization reversal service responds with one of these statuses as the apAuthReversalReply_status field value:

* `AUTH_REVERSED`: The authorization is successfully reversed.
* `FAILED`: The authorization reversal failed.

{#afterpay-authrev_ul_l2g_sm1_cyb}  
The authorization reversal service also responds with a reason code as the apAuthReversalreply_reasonCode field value.

Required Fields for Reversing an Authorization {#afterpay-authrev-reqd-fields}
==============================================================================

Include these required fields in the authorization-reversal request.

[apAuthReversalService_authRequestID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-auth-reversal-service-auth-request-id.md "")
:

[apAuthReversalService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-auth-reversal-service-run.md "")
:
Set to `true`.

[apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
:
Set to `afp`.

[merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
:

[merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
:

Example: Reversing an Authorization with XML {#afterpay-authrev-init-ex-xml-so}
===============================================================================

Request

```
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
   &lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;apPaymentType&gt;afp&lt;/apPaymentType&gt;
   &lt;apAuthReversalService run="true"&gt;
      &lt;authRequestID&gt;6246274241256683803069&lt;/authRequestID&gt;
   &lt;/apAuthReversalService&gt;        
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;requestID&gt;6246062044236748603086&lt;/requestID&gt;
   &lt;decision&gt;ACCEPT&lt;/decision&gt;
   &lt;reasonCode&gt;100&lt;/reasonCode&gt;
   &lt;apAuthReversalReply&gt;
      &lt;reasonCode&gt;100&lt;/reasonCode&gt;
      &lt;status&gt;AUTH_REVERSED&lt;/status&gt;
      &lt;processorResponse&gt;00007&lt;/processorResponse&gt;
      &lt;amount&gt;10.00&lt;/amount&gt;
      &lt;paymentStatus&gt;auth_reversed&lt;/paymentStatus&gt;
      &lt;responseCode&gt;00007&lt;/responseCode&gt;
      &lt;reconciliationID&gt;XFZONQ96WTF2&lt;/reconciliationID&gt;
   &lt;/apAuthReversalReply&gt;
&lt;/replyMessage&gt;
```

Check Status {#afterpay-chkstatus}
==================================

This service returns the current status of an Afterpay or Clearpay transaction. Use the request ID value returned by the individual service to check the status of the service request.

Endpoints
---------

Set the apCheckStatusService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`

Response Status
---------------

The check status service returns one of the following statuses:

* `AUTHORIZED`: you have successfully completed the authorization or sale using the redirection URL sent in response.
* `AUTH-REVERSED`: the authorization is successfully reversed.
* `FAILED`: the service request is rejected due to missing fields, invalid fields, or downtime.
* `PENDING`: the payment is waiting for authentication or approval. When you receive a pending status, wait a short time and request the check status service.
* `REFUNDED`: the refund is successfully completed.
* `SETTLED`: the payment is successfully completed.

Required Fields for Checking Status {#afterpay-chkstatus-reqd-fields}
=====================================================================

[apCheckStatusService_checkStatusRequestID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-check-status-service-check-status-req-id.md "")
:

[apCheckStatusService_run](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-check-status-service-run.md "")
:
Set to `true`.

[apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
:
Set to `afp`.

[merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
:

[merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
:

Example: Checking Status with XML {#afterpay-chkstatus-init-ex-xml-so}
======================================================================

Request

```
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.213"&gt; 
   &lt;merchantID&gt;test_merchant&lt;/merchantID&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;apPaymentType&gt;afp&lt;/apPaymentType&gt;
   &lt;apCheckStatusService run="true"&gt;
      &lt;checkStatusRequestID&gt;6246036783396181003073&lt;/checkStatusRequestID&gt;
   &lt;/apCheckStatusService&gt;
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns:c="urn:schemas-cybersource-com:transaction-data-1.213"&gt;
   &lt;merchantReferenceCode&gt;refnum-1234&lt;/merchantReferenceCode&gt;
   &lt;requestID&gt;6246049907006336203063&lt;/requestID&gt;
   &lt;decision&gt;ACCEPT&lt;/decision&gt;
   &lt;reasonCode&gt;100&lt;/reasonCode&gt;
   &lt;apCheckStatusReply&gt;
      &lt;reasonCode&gt;100&lt;/reasonCode&gt;
      &lt;reconciliationID&gt;XFZOPQ97EIXG&lt;/reconciliationID&gt;
      &lt;paymentStatus&gt;pending&lt;/paymentStatus&gt;
      &lt;processorResponse&gt;00001&lt;/processorResponse&gt;
   &lt;/apCheckStatusReply&gt;
&lt;/replyMessage&gt;
```

Reference Information {#concept_tph_5vy_y1c}
============================================

This section contains reference information that is useful when using Afterpay or Clearpay.

Reporting {#conref-altpay-reporting}
====================================

You can generate various types of reports for your financial and reconciliation data. For more information about how to automate your generated reports through API integration, see the [*Reporting Developer Guide*](https://developer.cybersource.com/docs/cybs/en-us/reporting/developer/all/rest/reporting/reporting_api.md ""). For more information about how to use your `Business Center` account to generate reports, see the [*Reporting User Guide*](https://developer.cybersource.com/library/documentation/dev_guides/reporting_and_reconciliation/Reporting_User.pdf "").  
The Reporting User Guide contains these relevant topics:

* How and When Reports Are Generated
* Downloading Available Reports
* Subscribing to Standard Reports

Additional Resources
--------------------

For additional information about how to use the `Business Center`, see these helpful resources.

`Business Center` Overview
:
For an overview of the various resources available in the `Business Center`, see this YouTube video: [watch?v=UDmAWGHPbWs](https://www.youtube.com/watch?v=UDmAWGHPbWs "")

Navigating the `Business Center`
:
For a step-by-step demonstration of how to navigate in the `Business Center`, see this YouTube video:

    [watch?v=2qi_g2DParI](https://www.youtube.com/watch?v=2qi_g2DParI "")

Managing Report Subscriptions
:
For an overview of how to manage report subscriptions in the Downloadable Reports section in the `Business Center`, see this YouTube video:

    [watch?v=tFlmkXtvxWE](https://www.youtube.com/watch?v=tFlmkXtvxWE "")

Downloading Reports
:
For an overview of how to download available reports in the Reports section in the `Business Center`, see this YouTube video:

[watch?v=E0slUYjJvmw](https://www.youtube.com/watch?v=E0slUYjJvmw "")

Reason Codes and Response Codes for the `Simple Order` API {#conref-altpay-reason-codes-so}
===========================================================================================

> Response fields and reason codes can be added at any time. ` Cybersource ` recommends these best practices to ensure you keep up-to-date with the latest possible responses:
>
> * Parse the response data according to the field names instead of the field order in the response message. For more information about parsing response fields, see the documentation for your client.
> * Your error handler must be able to process new reason codes without problems.
> * Your error handler must use the decision field to determine the result if it receives a reason code that it does not recognize.
>   {#conref-altpay-reason-codes-so_ul_qhx_r2y_p4b}  
>   This table lists the possible reason codes that are returned by the `Simple Order API` in the reasonCode field. For a list of all of the possible reason codes and descriptions, see the *[Reason Codes for the `Simple Order` API Reference Guide](https://developer.cybersource.com/docs/cybs/en-us/reason-codes-so/reference/all/so/reason-codes-so/reason-codes-so.md "")*.

| Reason Code |                                                                                                                                                                                                                                                                          Processor Response Code                                                                                                                                                                                                                                                                           |                                                                                                                                                                                                                                                                                                                                                                                                           Description                                                                                                                                                                                                                                                                                                                                                                                                           |
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `100`       | * 00000---status: completed. * 00001---status: pending. * 00002---status: abandoned. * 00003---status: authorized. * 00004---status: settled. * 00006---status: refunded. * 00008---status: reversed. * 00009---status: cancelled. * 00010---status: accepted. * 00011---status: chargeback. * 00012---status: settle_initiated. * 00013---status: settle_accepted. * 00014---status: refund_initiated. * 00015---status: active. * 00016---status: revoked. * 00017---status: expired. * 00020---status: refund_rejected. {#conref-altpay-reason-codes-so_ul_lsq_h34_1rb} | The transaction was successful.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `101`       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | The request is missing one or more required fields. Examine the response fields missingField_0 through missingField_N to identify which fields are missing. Resend the request with all the required fields.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `102`       | * 10000---status: failed. {#conref-altpay-reason-codes-so_ul_eln_gj4_1rb}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | One or more fields in the request contain invalid data. Examine the response fields invalidField_0 through invalidField_N to identify which fields are invalid. Resend the request with valid data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `150`       | * 20000---status: failed. * 20001---status: failed. * 20002---status: failed. * 30000---status: failed. * 30100---status: failed. {#conref-altpay-reason-codes-so_ul_phl_hj4_1rb}                                                                                                                                                                                                                                                                                                                                                                                          | A system error caused the request to fail. You must design your transaction management system to include a way to correctly handle system errors. Depending on which payment processor is handling the transaction, the error might indicate a valid `Cybersource` system error, or it might indicate a processor rejection because of invalid data. For either reason, `Cybersource` recommends you to not design your system to keep resending a transaction when a system error occurs. See the documentation for the `Cybersource` client (SDK) that you are using for important information about how to handle system errors and retries. Other possible reasons for a failed status: * The signature was not included in the HTTP header. * The signature in the HTTP header has expired or it is not a valid signature. |
| `151`       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | The request was received but a server timeout occurred. This error does not include timeouts that occur between the client and the server. To avoid duplicating the transaction, do not resend the request until you have reviewed the transaction status in the `Business Center`. See the documentation for your `Cybersource` client for information about handling retries in the case of system errors.                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `152`       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | The request was received, but a service did not finish processing in time. To avoid duplicating the transaction, do not resend the request until you have reviewed the transaction status in the `Business Center`. See the documentation for your `Cybersource` client for information about handling retries in the case of system errors.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `153`       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Your account is not enabled for the OCT service. Contact your `Cybersource` account manager to have your account enabled for this service.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `202`       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | The payment method is expired. You might also receive this value if the expiration date that you provided does not match the date that the issuing bank has on file. Request a different form of payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `203`       | * 30000---status: failed. * 30100---status: failed. * 30200---status: failed. * 30400---status: failed. * 30500---status: failed. {#conref-altpay-reason-codes-so_ul_bdl_pj4_1rb}                                                                                                                                                                                                                                                                                                                                                                                          | The payment method was declined. No other information was provided by the issuing bank. Request a different form of payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `204`       | * 30350---status: failed. {#conref-altpay-reason-codes-so_ul_wcb_5j4_1rb}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | The account does not contain sufficient funds. Request a different form of payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `223`       | * 30600---status: failed. * 30700---status: failed. {#conref-altpay-reason-codes-so_ul_wr2_1k4_1rb}                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | The processor declined the transaction due to tax errors or government compliance errors.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `233`       | * 30600---status: failed. * 30700---status: failed. {#conref-altpay-reason-codes-so_ul_t4m_kk4_1rb}                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | The processor declined the payment method. For more information about the decline, search for the transaction in the `Business Center` and view the transaction details. Request a different form of payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
[Reason Codes]

