> 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",
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://qosic.gitbook.io/qospay-eng/api-documentation/callback.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
