Track payment status

DocsLimited

Last updated: Oct 6th, 8:36am

After creating the order, you can track the payment status in two ways:

Use webhooks

To track the payment status using webhooks, follow these steps:

  1. Subscribe to webhook events in your PayPal developer dashboard or through the Webhooks API. For example:
    • CHECKOUT.ORDER.COMPLETED – Payment captured successfully after automatic capture
    • PAYMENT.CAPTURE.DENIED – Payment capture failed
  2. Define a webhook handler in your server-side application to:
    1. Listen for incoming webhook events.
    2. Confirm receipt of the event to PayPal.
    3. Verify the source of the event notification.
    4. Complete further actions based on event data.

Note: If needed, use the List event notifications API to retrieve all webhook events or the Show event notification details API to get specific event details.

Extract the order ID from the "rel": "up" link in the webhook payload's resource.links array to correlate the capture to your original order.

Poll for updates

To check the status of an Afterpay order, you can poll the Orders API:

  1. Use a valid access token and send a GET request to the /v2/checkout/orders/{id} endpoint, replacing {id} with the order ID from your Create order response.
  2. Review the response to determine the current order status and take action as needed.
Parameter name Description
id Unique order ID.
status Current status of the order.
purchase_units List of purchase units for the order, including amount and currency.
payer Information about the buyer, including name and payer ID.

For the comprehensive list of response parameters, see Show order details.