> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hellopay.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a BREB payin

> Use BREB to collect a payin with a BREB key.

Use `rail: "BRE_B"` when you want to collect a payin through the BREB flow.

Before implementing this rail:

* Review [How to create your first payin](/guides/how-to-create-first-payin) for the shared request fields and lifecycle.
* Configure [webhooks](/getting-started/webhooks) so your system receives the final payin status.
* Treat `callbackUrl` as the payer return URL only. The definitive payment result is delivered asynchronously.

## Recommended BREB flow

1. Create the payin with `rail: "BRE_B"` and the desired `breb.keyType`.
2. HelloPay creates the payin in `PROCESSING`.
3. For `SINGLE_USE`, HelloPay returns the generated BREB key in `sourceData.keyString`.
4. For `QR_CODE`, HelloPay also returns `sourceData.qrString` with a base64 image that you can render as a QR.
5. Poll the payin or wait for webhook events until HelloPay updates the transaction with the BREB-specific data and final status.
6. Track the final state through webhook events such as `payin.confirmed`, `payin.canceled`, or `payin.declined`.

## Request examples

<Tabs>
  <Tab title="SINGLE_USE" icon="key">
    Use `breb.keyType: "SINGLE_USE"` when you want HelloPay to return only the generated BREB key.

    ```bash theme={null}
    curl --location 'https://api.stg.hellopay.com.co/payins' \
    --header 'Content-Type: application/json' \
    --header 'x-api-key: ••••••' \
    --data-raw '{
      "amountInCents": 10000,
      "currency": "COP",
      "rail": "BRE_B",
      "reference": "1dwDmHerYL5NBQZ",
      "inlineCustomer": {
        "name": "John Doe",
        "idType": "CO_CC",
        "idNumber": "1000000001",
        "email": "john.doe@doe.com",
        "phone": "+573137772121"
      },
      "breb": {
        "keyType": "SINGLE_USE"
      },
      "callbackUrl": "https://portal.hellopay.com.co"
    }'
    ```
  </Tab>

  <Tab title="QR_CODE" icon="qrcode">
    Use `breb.keyType: "QR_CODE"` when you want HelloPay to also return a QR image in the payin response.

    ```bash theme={null}
    curl --location 'https://api.stg.hellopay.com.co/payins' \
    --header 'Content-Type: application/json' \
    --header 'x-api-key: ••••••' \
    --data-raw '{
      "amountInCents": 10000,
      "currency": "COP",
      "rail": "BRE_B",
      "reference": "1dwDmHerYL5NBQZ",
      "inlineCustomer": {
        "name": "John Doe",
        "idType": "CO_CC",
        "idNumber": "1000000001",
        "email": "john.doe@doe.com",
        "phone": "+573137772121"
      },
      "breb": {
        "keyType": "QR_CODE"
      },
      "callbackUrl": "https://portal.hellopay.com.co"
    }'
    ```
  </Tab>
</Tabs>

## Request fields

* `amountInCents`: amount to collect, expressed in cents.
* `currency`: currently `COP`.
* `rail`: must be `BRE_B`.
* `reference`: your internal identifier for this payin.
* `inlineCustomer`: customer information used during the payment flow. Supported document types are listed in [How to create your first payin](/guides/how-to-create-first-payin).
* `breb.keyType`: BREB key mode to generate. Use `SINGLE_USE` for a key-only flow or `QR_CODE` to also receive `sourceData.qrString`.
* `callbackUrl`: URL where the payer is redirected after the payment flow is completed.

## Response examples

<Tabs>
  <Tab title="SINGLE_USE" icon="key">
    ```json theme={null}
    {
      "id": "373b1080-62ec-4e65-a4d3-0158f339ca37",
      "amount": 100,
      "confirmedAmount": null,
      "currency": "COP",
      "status": "PROCESSING",
      "rail": "BRE_B",
      "reference": "1dwDmHerYL5NBQZ",
      "inlineCustomer": {
        "name": "John Doe",
        "email": "john.doe@doe.com",
        "phone": "+573137772121",
        "idType": "CO_CC",
        "idNumber": "1000000001"
      },
      "errorCode": null,
      "createdAt": "2026-03-23T22:28:08.724Z",
      "updatedAt": "2026-03-23T22:28:08.729Z",
      "resultAt": null,
      "chargebackAt": null,
      "organizationId": "db6a6f4f-444a-4221-ac32-695998236e50",
      "sourceData": {
        "keyType": "SINGLE_USE",
        "keyString": "@SANDBOX5AF43BE4F5",
        "checkoutUrl": "http://localhost:5151/transaction?payinId=373b1080-62ec-4e65-a4d3-0158f339ca37&token=UDJLMFNGSVpLQklpwcH8bjlGnUUDCItxUD0v8loz3w"
      },
      "callbackUrl": "https://portal.hellopay.com.co"
    }
    ```
  </Tab>

  <Tab title="QR_CODE" icon="qrcode">
    ```json theme={null}
    {
      "id": "373b1080-62ec-4e65-a4d3-0158f339ca37",
      "amount": 100,
      "confirmedAmount": null,
      "currency": "COP",
      "status": "PROCESSING",
      "rail": "BRE_B",
      "reference": "1dwDmHerYL5NBQZ",
      "inlineCustomer": {
        "name": "John Doe",
        "email": "john.doe@doe.com",
        "phone": "+573137772121",
        "idType": "CO_CC",
        "idNumber": "1000000001"
      },
      "errorCode": null,
      "createdAt": "2026-03-23T22:28:08.724Z",
      "updatedAt": "2026-03-23T22:28:08.729Z",
      "resultAt": null,
      "chargebackAt": null,
      "organizationId": "db6a6f4f-444a-4221-ac32-695998236e50",
      "sourceData": {
        "keyType": "QR_CODE",
        "qrString": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnsAAAJ7AQMAAACh+...",
        "keyString": "@SANDBOX5AF43BE4F5",
        "checkoutUrl": "http://localhost:5151/transaction?payinId=373b1080-62ec-4e65-a4d3-0158f339ca37&token=UDJLMFNGSVpLQklpwcH8bjlGnUUDCItxUD0v8loz3w"
      },
      "callbackUrl": "https://portal.hellopay.com.co"
    }
    ```
  </Tab>
</Tabs>

## What the response means

* `status: "PROCESSING"` means the payin was created successfully and is waiting for the BREB flow to complete.
* `sourceData.keyType` tells you which BREB key mode was used for the transaction.
* `sourceData.keyString` is available in both variants so you can identify the generated BREB key.
* `sourceData.qrString` is returned only for `QR_CODE` payins and contains a `data:image/png;base64,...` payload ready to render.
* The creation response is not the final outcome. Rely on webhooks to learn whether the payin was confirmed, canceled, or declined.
