Afterpay

App · 11 actions

Create checkout sessions and read Afterpay orders and payment limits.

Actions

ActionWhat it does
Authorize and capture paymentAuthorize and capture the full amount of a standard checkout in one call.
Authorize paymentAuthorize a standard checkout token for later capture.
Capture authorized paymentCapture part or all of a previously authorized order amount.
Create checkoutCreate a standard checkout session and return the URL you can send the customer to.
Get checkoutRead the details of a checkout session by token.
Get paymentRead an Afterpay order by its order ID.
Get payment by checkout tokenRead an Afterpay order by its checkout token.
Get payment limitsRead the minimum and maximum order amount for your merchant account.
List paymentsRead a page of Afterpay orders with payment state and an optional date range.
Refund paymentRefund a captured amount on an Afterpay payment.
Void paymentRelease the remaining authorization on a payment.

Authorize and capture payment

Authorize and capture the full amount of a standard checkout in one call.

Inputs

TokentokentextRequired
Token.
Merchant referencemerchant_referencetext
Merchant reference.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "created": "example",
    "id": "example",
    "merchantReference": "example",
    "originalAmount": {
      "amount": "example",
      "currency": "example"
    },
    "paymentEvents": [
      {}
    ],
    "paymentState": "example",
    "refunds": [
      {}
    ],
    "status": "APPROVED",
    "token": "example"
  }
}

Authorize payment

Authorize a standard checkout token for later capture.

Inputs

TokentokentextRequired
Token.
Merchant referencemerchant_referencetext
Merchant reference.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "created": "example",
    "id": "example",
    "merchantReference": "example",
    "originalAmount": {
      "amount": "example",
      "currency": "example"
    },
    "paymentEvents": [
      {}
    ],
    "paymentState": "example",
    "refunds": [
      {}
    ],
    "status": "APPROVED",
    "token": "example"
  }
}

Capture authorized payment

Capture part or all of a previously authorized order amount.

Inputs

Orderorder_idtextRequired
Order ID.
AmountamounttextRequired
A decimal amount in the order currency, such as 35.00.
CurrencycurrencytextRequired
Currency.One of: AUD, CAD, GBP, NZD, USD.
Request IDrequest_idtext
A unique request ID to reuse if you repeat this operation.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "created": "example",
    "id": "example",
    "merchantReference": "example",
    "originalAmount": {
      "amount": "example",
      "currency": "example"
    },
    "paymentEvents": [
      {}
    ],
    "paymentState": "example",
    "refunds": [
      {}
    ],
    "status": "APPROVED",
    "token": "example"
  }
}

Create checkout

Create a standard checkout session and return the URL you can send the customer to.

Inputs

AmountamounttextRequired
The amount as a decimal, such as 35.00.
CurrencycurrencytextRequired
Currency.One of: AUD, CAD, GBP, NZD, USD.
EmailemailtextRequired
Email.
First namefirst_nametextRequired
First name.
Last namelast_nametextRequired
Last name.
Phonephonetext
Phone.
Confirmation URLconfirmation_urltextRequired
Confirmation URL.
Cancellation URLcancellation_urltextRequired
Cancellation URL.
Merchant referencemerchant_referencetext
Merchant reference.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "expires": "example",
    "redirectCheckoutUrl": "example",
    "token": "example"
  }
}

Get checkout

Read the details of a checkout session by token.

Inputs

TokentokentextRequired
Token.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "amount": {
      "amount": "example",
      "currency": "example"
    },
    "consumer": {},
    "expires": "example",
    "merchantReference": "example",
    "token": "example"
  }
}

Get payment

Read an Afterpay order by its order ID.

Inputs

Orderorder_idtextRequired
Order ID.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "created": "example",
    "id": "example",
    "merchantReference": "example",
    "originalAmount": {
      "amount": "example",
      "currency": "example"
    },
    "paymentEvents": [
      {}
    ],
    "paymentState": "example",
    "refunds": [
      {}
    ],
    "status": "APPROVED",
    "token": "example"
  }
}

Get payment by checkout token

Read an Afterpay order by its checkout token.

Inputs

TokentokentextRequired
Token.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "created": "example",
    "id": "example",
    "merchantReference": "example",
    "originalAmount": {
      "amount": "example",
      "currency": "example"
    },
    "paymentEvents": [
      {}
    ],
    "paymentState": "example",
    "refunds": [
      {}
    ],
    "status": "APPROVED",
    "token": "example"
  }
}

Get payment limits

Read the minimum and maximum order amount for your merchant account.

Inputs

None.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "maximumAmount": {
      "amount": "example",
      "currency": "example"
    },
    "minimumAmount": {
      "amount": "example",
      "currency": "example"
    }
  }
}

List payments

Read a page of Afterpay orders with payment state and an optional date range.

Inputs

Start datestart_datedate and time
Start date.
End dateend_datedate and time
End date.
Statusesstatuseslist
Statuses.One or more of: APPROVED, DECLINED.
Order IDSorder_idslist
Order IDS.
Merchant referencesmerchant_referenceslist
Merchant references.
Tokenstokenslist
Tokens.
Order byorder_bytext
Order by.One of: createdAt, id, amount, merchantReference, email.
Ascendingascendingtrue/false
Ascending.
Limitlimitnumber
Limit.From 1 to 250.
Offsetoffsetnumber
Offset.At least 0.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "limit": 1,
    "nextPageUrl": "example",
    "offset": 1,
    "results": [
      {
        "created": "example",
        "id": "example",
        "merchantReference": "example",
        "originalAmount": {
          "amount": "example",
          "currency": "example"
        },
        "paymentEvents": [
          {}
        ],
        "paymentState": "example",
        "refunds": [
          {}
        ],
        "status": "APPROVED",
        "token": "example"
      }
    ],
    "totalResults": 1
  }
}

Refund payment

Refund a captured amount on an Afterpay payment.

Inputs

Orderorder_idtextRequired
Order ID.
AmountamounttextRequired
A decimal amount in the order currency, such as 35.00.
CurrencycurrencytextRequired
Currency.One of: AUD, CAD, GBP, NZD, USD.
Merchant referencemerchant_referencetextRequired
Merchant reference.
Request IDrequest_idtextRequired
A unique request ID to reuse if you repeat this operation.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "amount": {
      "amount": "example",
      "currency": "example"
    },
    "merchantReference": "example",
    "refundId": "example",
    "refundedAt": "example",
    "requestId": "example"
  }
}

Void payment

Release the remaining authorization on a payment.

Inputs

Orderorder_idtextRequired
Order ID.
Request IDrequest_idtext
Request ID.

Outputs

dataobject
The response from Afterpay.
Example output
{
  "data": {
    "created": "example",
    "id": "example",
    "merchantReference": "example",
    "originalAmount": {
      "amount": "example",
      "currency": "example"
    },
    "paymentEvents": [
      {}
    ],
    "paymentState": "example",
    "refunds": [
      {}
    ],
    "status": "APPROVED",
    "token": "example"
  }
}

On this page