For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HomeGuidesAPI Reference
HomeGuidesAPI Reference
  • Online API
    • API Environments
    • Direct Payment Flow
    • REST
    • HTTPS
    • Dates
    • Pagination
    • Authentication
    • Idempotent Requests
    • Timeouts
    • API Simulator
  • Models
    • Introduction
    • Contact Object
    • Consumer Object
    • Discount Object
    • Item Object
    • Money Object
    • Order Details Object
    • Payment Object
    • Refund Object
    • Shipping Courier Object
  • Service Status
    • GETPing
  • Configuration
    • GETGet Configuration
  • Orders
    • Introduction
    • GETGet Order
    • POSTCreate Order
  • Javascript afterpay.js
    • Information
    • Redirect Method
  • Payments
    • Introduction
    • POSTCapture Payment
    • PUTUpdate Shipping Courier
    • GETGet Payment By Order ID
    • GETGet Payment By Token
    • GETList Payment(s)
    • POSTCreate Refund
    • PUTUpdate Payment by Order ID
    • POSTReverse Payment By Token
  • Errors
    • Introduction
    • Get Errors
    • Put/Post Errors
  • Reference
LogoLogo
Online API

Direct Payment Flow

  1. Merchant calls the Get Configuration endpoint to retrieve Afterpay order limits, possibly as part of an asynchronous scheduled background process.
  2. Merchant stores these minimum and maximum order values server-side.
  3. Separately, at the checkout, Merchant uses the stored Afterpay minimum and maximum order values to determine if Afterpay should be presented as an available payment method.
  4. Merchant calls the Create Order endpoint to retrieve an Afterpay order token.
  5. Merchant uses the token in combination with the JavaScript afterpay.js to direct the Consumer through the Afterpay screenflow.
  6. Consumer completes the Afterpay screenflow and is returned to the Merchant website.
    • If the Consumer clicks “confirm”, they will be returned to the Merchant website with the orderToken and a status of “SUCCESS”.
    • If the Consumer cancels, they will be returned to the Merchant website with the orderToken and a status of “CANCELLED”.
  7. If the merchant is able to fulfil the order, the merchant calls the Capture Payment endpoint to capture the payment.
    • Payment status (“APPROVED” or “DECLINED”) is only known once Capture Payment has been completed.
    • If the payment was approved by Afterpay, the Merchant presents the Consumer with an order confirmation/receipt page.
    • If the payment was declined by Afterpay (e.g. the Consumer’s card details are entered incorrectly), the Merchant presents an appropriate message to the Consumer at the checkout.
Was this page helpful?
Previous

REST

Next
Built with