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

# Test onboarding in the sandbox

> Drive every onboarding outcome on purpose in the sandbox: approvals, background-check and document rejections, biometric approvals and refusals, and both correction journeys.

The sandbox runs the whole onboarding flow, link included, with deterministic outcomes. Two values you control decide them: the last digit of the merchant contact's **phone number** decides the affiliation, and the last digit of the person's **CPF** decides the biometric verification. The same data works from your integration all the way to the provider's sandbox.

Sandbox requests go to `https://api-sandbox.rinne.com.br/core` with a sandbox API key, as in the [testing guide](/guides/testing#sandbox-environment). Onboarding links issued in the sandbox open on `sandbox.cadastro.rinne.com.br`.

## Affiliation outcomes

The last digit of `contact.phone` decides a `CELCOIN` affiliation once its requirements are satisfied and Rinne submits it:

| Phone ends in | Outcome |
| - | - |
| `1` | Approved: background check and documents pass, and the affiliation becomes `ACTIVE` |
| `2` | Rejected at the background check, once the documents are submitted |
| `3` | Background check passes, documents rejected |

Any other digit runs the provider's real checks, which need real data.

```bash cURL theme={null}
curl -X POST https://api-sandbox.rinne.com.br/core/v1/merchants \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "full_name": "Padaria Doce Sabor LTDA",
    "name": "Padaria Doce Sabor",
    "document_number": "12345678000195",
    "document_type": "CNPJ",
    "document_tax_type": "PJ",
    "mcc": "5462",
    "contact": {
      "first_name": "Mariana",
      "last_name": "Souza",
      "phone": "+5511987650001",
      "email": "mariana.souza@docesabor.com.br",
      "mother_name": "Helena Souza",
      "birth_date": "22-03-1988",
      "document_number": "52998224806",
      "role": "PARTNER",
      "address": {
        "street": "Rua Augusta",
        "street_number": "1500",
        "neighborhood": "Consolação",
        "zipcode": "01304001",
        "country": "076",
        "state": "SP",
        "city": "São Paulo"
      }
    },
    "address": {
      "street": "Rua Augusta",
      "street_number": "1502",
      "neighborhood": "Consolação",
      "zipcode": "01304001",
      "country": "076",
      "state": "SP",
      "city": "São Paulo"
    },
    "transfer_configurations": {
      "automatic_transfer_enabled": true,
      "transfer_frequency": "DAILY",
      "transfer_date": 1,
      "rail": "PIX"
    }
  }'
```

The contact's phone ends in `1`, so this merchant's `CELCOIN` affiliations are approved once their requirements are satisfied.

<Warning>
  The sandbox refuses an affiliation whose contact e-mail, phone number or merchant document is already linked to an account at the provider: `POST` on the affiliation answers `409` and the affiliation is kept as `FAILED`. Use fresh contact data for every merchant you test.
</Warning>

## Biometric outcomes

A biometric verification resolves only after a person completes the capture on `verification_url`, so the sandbox capture takes a real person with a camera. The person's CPF then decides:

| CPF ends in | Outcome |
| - | - |
| An even digit, such as `52998224806` | `APPROVED` |
| An odd digit, such as `71428793275` | `REPROVED`, with `rejection_reason` |

The sandbox `verification_url` lasts about one hour. Read `verification_url_expires_at` rather than assuming it, here and in production.

## Rejection reviews

The provider's sandbox sends no rejection text, so a sandbox rejection is reviewed automatically with a fixed outcome per scenario:

| Phone ends in | `rejection_reasons` | Correction journey |
| - | - | - |
| `2` | `COMPANY_DATA_MISMATCH`, `action` `FIX_COMPANY_DATA` | Correct the merchant, then create a new affiliation |
| `3` | `DOCUMENT_UNREADABLE` on the contact's identity document, `action` `RESUBMIT_DOCUMENT` | Upload a new identity document, then create a new affiliation |

The phone's last digit decides every attempt, so a correction journey ends by changing the contact's phone to end in `1` with `PATCH /v1/merchants/{merchantId}` (or `PATCH /v1/companies/me`) before you create the new affiliation. With the same digit the sandbox rejects again.

## A full run

<Steps>
  <Step title="Create the merchant">
    A merchant with a fresh CNPJ, contact e-mail and phone, the phone ending in `3` to exercise a document rejection, and a contact CPF ending in an even digit.
  </Step>

  <Step title="Create the affiliation">
    `POST /v1/merchants/{merchantId}/affiliations` with `"provider": "CELCOIN"`. It is created `WAITING_DOCUMENTS` with an `onboarding_url`.
  </Step>

  <Step title="Complete it through the link or the API">
    Open `onboarding_url` on a phone and go through it, or upload the documents and run the biometric verification [through the API](/onboarding/api). When the last item arrives, Rinne submits the affiliation on its own.
  </Step>

  <Step title="Watch the rejection and its review">
    `affiliation.status-changed` reports `REJECTED`, and `affiliation.requirements-changed` follows with the review: `DOCUMENT_UNREADABLE` on the contact's identity document.
  </Step>

  <Step title="Correct and try again">
    Change the contact's phone to end in `1`, upload a new identity document and create a new affiliation. Only the identity document was pending, so the new one is submitted as soon as it is created.
  </Step>

  <Step title="Check the approval">
    The new affiliation becomes `ACTIVE`, and the documents it sent become `VALIDATED`.
  </Step>
</Steps>

<Check>
  The run exercised the link or the API, a rejection, its review, the reuse of the approved biometric verification and an approval, with the same events production sends.
</Check>


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