# SPEI Offline

### What is SPEI Offline?

The **SPEI Offline** feature offers a streamlined deposit process for your customers in Mexico. It allows them to make payments by directly transferring funds to a previously used unique CLABE account, completely bypassing the standard checkout flow.

When a customer makes a transfer, our system is instantly notified. We then analyze the transaction details to create a formal deposit record, which is sent to you for approval or rejection. This provides a faster, more convenient payment experience for repeat customers.

### How It Works

1. A customer transfers money to their unique CLABE account number.
2. We receive a notification of the incoming transfer.
3. We send a `POST` request to a webhook URL that you provide, containing all the transaction details.
4. Your system receives the request and returns a response to either **approve** or **reject** the deposit.

### Getting started

{% stepper %}
{% step %}

#### Contact your account manager

To enable this feature, please reach out to your designated Account Manager or Technical Account Manager.
{% endstep %}

{% step %}

#### Provide a webhook URL

You must provide us with a secure URL endpoint that can accept `POST` requests from our system. This URL will be used to notify you of every new SPEI Offline transaction.

When we detect a new deposit, we will send a `POST` request to your URL with the following JSON body:

```json
{
  "deposit_id": 123456789,
  "payer_account_number": "123456789123456789",
  "country": "MX",
  "document": "84932568207",
  "full_name": "John Doe",
  "date_of_birth": "19871027",
  "address": "Ruta 13, Mexico",
  "email": "jon.doe@example.com",
  "amount": 200,
  "currency": "MXN",
  "payment_method": "SEOF"
}

```

<table><thead><tr><th width="223.3359375">Field</th><th width="102.53125">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>deposit_id</code></td><td>Integer</td><td>Our unique identifier for the payment deposit.</td></tr><tr><td><code>payer_account_number</code></td><td>String</td><td>The CLABE of the customer who made the payment.</td></tr><tr><td><code>country</code></td><td>String</td><td>The country of the transaction. Always "MX".</td></tr><tr><td><code>document</code></td><td>String</td><td>The identification document of the payer.</td></tr><tr><td><code>full_name</code></td><td>String</td><td>The full name of the payer.</td></tr><tr><td><code>date_of_birth</code></td><td>String</td><td>The payer's date of birth in <code>YYYYMMDD</code> format.</td></tr><tr><td><code>address</code></td><td>String</td><td>The address of the payer.</td></tr><tr><td><code>email</code></td><td>String</td><td>The email address of the payer.</td></tr><tr><td><code>amount</code></td><td>Number</td><td>The transaction amount.</td></tr><tr><td><code>currency</code></td><td>String</td><td>The currency of the payment. Always "MXN".</td></tr><tr><td><code>payment_method</code></td><td>String</td><td>The payment method used. Always "SEOF" for SPEI Offline.</td></tr></tbody></table>

{% endstep %}

{% step %}

#### Handle deposit notifications

Your webhook URL must be configured to handle our requests and send back a response indicating your decision.

**Approving or rejecting a deposit**

Your system's response determines the status of the payment:

* **To Approve:** Return an <mark style="color:$success;">**HTTP**</mark><mark style="color:$success;">**&#x20;**</mark><mark style="color:$success;">**`200`**</mark> status code.
* **To Reject:** Return an <mark style="color:$danger;">**HTTP**</mark><mark style="color:$danger;">**&#x20;**</mark><mark style="color:$danger;">**`400`**</mark> status code.

{% hint style="danger" %}
*Any other HTTP status code will be treated as a rejection.*
{% endhint %}

{% endstep %}

{% step %}
***(Optional)*****&#x20;Overriding default information**

By default, we generate a random **`invoice_id`** and use your account's default notification URL for these deposits. However, you can override these values by including them in the body of your `200` (Approve) response.

If you wish to provide your own identifiers, your response body should look like this:

```json
{
   "invoice_id" : "YOUR_CUSTOM_INVOICE_ID",
   "notification_url" : "https://merchant.com/notifications/deposit/YOUR_ID"
}
```

If this body is returned, we will use the `invoice_id` and `notification_url` you provide instead of our defaults.
{% endstep %}
{% endstepper %}
