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

# Callbacks Guide

Use callback URLs to receive asynchronous payment and session updates.

## Overview

The public REST contract documents request-scoped callbacks:

* Payment callbacks through `PaymentRequestDto.callbackUrl`
* Checkout session callbacks through `settings.callbacks.paymentCallbackUrl`
* Tokenization session callbacks through `settings.callbacks.tokenizationCallbackUrl`

This documentation does not treat merchant-wide callback registration, shared callback secrets, or signature headers as part of the public API contract.

Use this guide only for request-scoped callbacks that you send as part of payments or sessions.

## Payment Callbacks

Send `callbackUrl` when creating a payment if your system needs an asynchronous notification.

The callback body is a `PaymentDto`.

```http
POST /v1/payments
Authorization: Basic {credentials}
Content-Type: application/json

{
  "merchantId": 12345,
  "referenceId": "order-1001",
  "invoiceNumber": "INV-1001",
  "amount": {
    "total": 10000,
    "currency": "UYU"
  },
  "paymentMethod": {
    "source": "card",
    "card": {
      "number": "4444333322221111",
      "expMonth": 12,
      "expYear": 2028,
      "cvc": "123",
      "cardholder": {
        "firstName": "Test",
        "lastName": "User",
        "email": "customer@example.com"
      }
    }
  },
  "capture": {
    "method": "automatic"
  },
  "callbackUrl": "https://merchant.example.com/callbacks/payments"
}
```

Use `GET /v1/payments/{paymentId}` if you need to confirm the canonical final resource state after receiving a callback.

## Checkout Session Callbacks

Use session callbacks when the customer is completing a hosted checkout flow.

The callback body is the same `PaymentDto` payload used by payment callbacks.

```http
POST /v1/sessions
Authorization: Basic {credentials}
Content-Type: application/json

{
  "merchantId": 12345,
  "referenceId": "checkout-session-1001",
  "type": "checkout",
  "paymentRequest": {
    "referenceId": "order-1001",
    "invoiceNumber": "INV-1001",
    "amount": {
      "total": 10000,
      "currency": "UYU"
    }
  },
  "settings": {
    "callbacks": {
      "paymentCallbackUrl": "https://merchant.example.com/callbacks/checkout"
    }
  }
}
```

## Tokenization Session Callbacks

Use a tokenization callback when the hosted flow is saving an instrument for later use.

The callback body is not a `PaymentDto`. Tokenization sessions use a tokenization-specific callback payload.

```http
POST /v1/sessions
Authorization: Basic {credentials}
Content-Type: application/json

{
  "merchantId": 12345,
  "referenceId": "tokenization-session-1001",
  "type": "tokenization",
  "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "settings": {
    "tokenization": {
      "type": "store"
    },
    "callbacks": {
      "tokenizationCallbackUrl": "https://merchant.example.com/callbacks/tokenization"
    }
  }
}
```

After receiving the callback, retrieve the current session or customer instruments if your application needs the latest persisted state.

{% hint style="info" %}
If you are tokenizing Google Pay or Apple Pay tokens with your own UI, you can use `POST /v1/tokenizations` instead of hosted sessions. The direct endpoint returns the token synchronously, so you do not need a callback URL. See the [Tokenization Guide](/rest-api/customers-and-saved-methods/tokenization-guide.md#direct-wallet-tokenization-google-pay--apple-pay) for details.
{% endhint %}

## Implementation Guidance

* Return a `2xx` response quickly from your callback endpoint
* Treat callbacks as asynchronous signals, then fetch the resource again if you need confirmation
* Make your callback handling idempotent, because retries can happen in distributed systems
* Keep callback URLs stable and HTTPS-only
* Do not expect a documented public signature header unless Plexo provides one for your specific integration

## Related Resources

* [Payment Processing](/rest-api/payments/payment-processing.md)
* [Tokenization Guide](/rest-api/customers-and-saved-methods/tokenization-guide.md)
* [SessionRequest](/rest-api/api-reference/models.md#sessionrequest)
* [PaymentRequestDto](/rest-api/api-reference/models.md#paymentrequestdto)


---

# 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://plexo.gitbook.io/rest-api/operations/callbacks.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.
