> ## Documentation Index
> Fetch the complete documentation index at: https://devs.tapipay.la/llms.txt
> Use this file to discover all available pages before exploring further.

# Orders

> What an order is, how it is created depending on the payment method, which statuses it goes through and which notices you receive.

An **order** is the collection of an amount from a user, managed by Tapipay end to end: Tapipay requests the charge from the payment provider, follows its result and notifies you of every change through a webhook.

## How an order is created

It depends on the payment method. Some methods need the user to take part in every payment; others only the first time, to register the method.

> [card] [You, through the API](https://devs.tapipay.la/en/resources/payment-orders.md)
>
> With a **captured** payment method: the user registered it once and from then on you can charge them without their involvement. You create the order with a **payment order**. Today the only captured method is direct debit.

> [card] [Your user, in the portal or the SDK](https://devs.tapipay.la/en/payment-portal/payment-methods-sdk.md)
>
> With a method that requires the user to confirm every payment, such as CoDi or BBVA direct payment. The user pays in the Tapipay portal or SDK, and that creates the order.

## Order payment methods

| Value | Method | Capturable? | Who creates the order |
| - | - | - | - |
| `BANK_ACCOUNT` | Direct debit to the user's bank account | Yes | You, through the API |
| `CODI` | CoDi, Banxico's digital collection | No | Your user, in the portal or the SDK |
| `DIRECT_PAYMENT` | BBVA direct payment | No | Your user, in the portal or the SDK |

A **capturable** method is one the user registers once with Tapipay and that stays saved with its `externalPaymentMethodId`. Only capturable methods can be used in a [payment order](https://devs.tapipay.la/en/resources/payment-orders.md), and to create one the user must have already registered their method.

In the webhooks, the order's method comes in `paymentProcessor`. If it is capturable, `paymentMethod` also carries its `type` and its `externalPaymentMethodId`; if not, `paymentMethod` arrives empty (`{}`).

## Which notices you receive

| Webhook | Orders that emit it |
| - | - |
| [Order creation](https://devs.tapipay.la/en/webhooks/order-creation.md) | The ones you create through the API with a payment order. |
| [Order payment](https://devs.tapipay.la/en/webhooks/order-payment.md) | All of them: the result of every charge, whatever the method. |

Orders your user creates in the portal or the SDK do not emit the creation notice: you learn about them through the order payment.

## Order statuses

| `status` | Meaning |
| - | - |
| `PROCESSING` | The charge was requested and is not confirmed yet. |
| `PAID` | The charge was collected. |
| `FAILED` | The charge could not be collected. |
| `CHARGED_BACK` | The charge was collected and then reversed (chargeback). |

Every order starts in `PROCESSING`. When the payment provider responds, it moves to `PAID` if the charge was collected or to `FAILED` if it could not be collected. A `PAID` order can later move to `CHARGED_BACK` if the charge is reversed. `FAILED` and `CHARGED_BACK` do not change anymore.

Every status change of the charge reaches you with the [order payment](https://devs.tapipay.la/en/webhooks/order-payment.md) webhook. You can also query a payment order with [`GET /v2/debts/orders`](https://devs.tapipay.la/en/resources/payment-orders#query-an-order).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.