> For the complete documentation index, see [llms.txt](https://qosic.gitbook.io/qospay-eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qosic.gitbook.io/qospay-eng/api-documentation/callback.md).

# Callback

&#x20;A callback URL is a website page to which the user is directed after a successful transaction. For example, on an e-commerce site selling phone cases and jewelry, the customer can make a purchase via the payment option provided. Once the payment process is complete, the customer is redirected back to the website, usually to a page confirming that the order has been received. This page is known as the callback URL.

&#x20;From the customer's point of view, a correctly configured callback URL redirects them to the page you've specified once the transaction is complete, usually an order confirmation page.&#x20;

Examples of how callback URLs can be used. A customer purchases an item in your store, using the redirect method to pay for the item. A callback URL is used to send the customer back to your website so they can continue browsing. If you have a web-based appointment scheduling application that integrates Paystack, you can redirect a user to your Calendly account to reserve a slot in your calendar. If you own a bookshop, you can set up a reminder URL that redirects a customer to your Google drive of books once the customer has made payment.

Steps to follow

<figure><img src="/files/gGJLb3KrySx6peYMeh55" alt=""><figcaption></figcaption></figure>

1. Go to the merchant dashboard settings to add your callback URL
2. Settings>API Key & Callback URL
3. Select the account, e.g. MTN benin or MOOV benin, etc.
4. Enter the secure callback URL
5. Save by clicking on the save button

Valid callback URL:

1. Make sure the URL only redirects to an HTTPS site
2. Make sure the URL is a website that can be loaded by a browser, e.g. <https://www.example.com>.
3. Make sure you don't use localhost as a callback URL, e.g. localhost://example.com wouldn't work

## For the callback payload, QOSPAY will send you the payload that follows your validated url.

```
Successful transaction 
```

```json
// Some code{
{
"status": "SUCCESSFUL",
  "transRef": "455855",
  "specialfield1": "SUCCESSFUL",
  "amount": "2000",
  "serviceRef": "14557856",
  "code": "200",
}

```

```
Transaction failed
```

```json
// 
{
  "status": "FAILED",
  "transRef": "455855",
  "specialfield1": "FAILED",
  "amount": "2000",
  "serviceRef": "14557856",
  "code": "-1",
}
```
