---
id: notificationcallback
title: Handle purchase callbacks
hide_title: true
description: "How to handle purchase and status update callbacks in Walley Checkout"
---

import Ingress from '../../src/components/ingress/ingress.react';

<Ingress title="Handle purchase callbacks">
    Walley Checkout will send a GET request with TLS to the notification URI that was provided in the initialize Checkout step for the following events:
</Ingress>

:::info Before you start
Set `notificationUri` when you [initialize the checkout session](/docs/checkout/initcheckout). The endpoint must be reachable over HTTPS and must answer `200 OK`.
:::

## Notification events

### Completed purchase

A purchase has been successfully completed by the end customer.
When you [acquire checkout information](/docs/checkout/getcheckoutinformation)
the state of the Checkout has transferred to `PurchaseCompleted` and the invoice status is one of the values described in [`data.purchase.result`](/docs/checkout/getcheckoutinformation#datapurchaseresult).

### Invoice status update

An invoice has been approved or rejected by Walley's anti-fraud system (if that feature is configured on your account), or the Invoice required the end customer to digitally sign a credit agreement and this has been completed by the end customer. When you [acquire checkout information](/docs/checkout/getcheckoutinformation) the invoice status has transferred to one of the values described in [`data.purchase.result`](/docs/checkout/getcheckoutinformation#datapurchaseresult). If the invoice was `Cancelled` before the notification callback arrived, the invoice is considered `Cancelled` regardless of the `data.purchase.result` value.

### Pay Link is cancelled

If using the checkout as a [Pay Link](/docs/checkout/paylink/overview) and a `checkoutAbortedRedirectPageUri` is provided at [Initialize Checkout](/docs/checkout/initcheckout), a notification callback will be sent if the cancel button is called. The customer will be redirected to the redirect page and a notification will be triggered.

<aside className="notice">
It is essential that you always react to a notification by <a href="/docs/checkout/getcheckoutinformation">acquiring checkout information to determine what the current state of the checkout is</a>.
</aside>

## Idempotency and retries

The Checkout will attempt to notify the provided notification URI multiple times with increasing backoff time until a HTTP status code 200 is received in the response.
Our retry mechanism is built in a way that we guarantee at-least-once-delivery and the notification URI endpoint must therefore support being called multiple times without side effects.

We send the notification callback instantly. If your endpoint does not answer with a `200 OK` status, we retry after each of the following delays, measured from the previous attempt:

- 5 seconds
- 10 seconds
- 3 minutes
- 1 hour
- 4 hours
- 8 hours
- 16 hours
- 24 hours

The last retry falls about 53 hours after the first attempt. If your endpoint has still not answered with a `200 OK` status by then, we handle it manually and contact you before retrying again.
