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

# Test Documents

> Use these test documents to simulate different payin scenarios in the sandbox environment. Each CPF number triggers specific charge outcomes for testing your integration.

## Successful Charges

For charges that should be **approved and credited**, use one of the following CPF documents:

| Document (CPF)  | Final Status | Flow                      | Description                               |
| --------------- | ------------ | ------------------------- | ----------------------------------------- |
| **58713371126** | Credited     | Created → Paid → Credited | Charge approved and credited successfully |
| **59730932395** | Credited     | Created → Paid → Credited | Charge approved and credited successfully |

### Example - Successful Charge

```json theme={null}
{
  "pix": {
    "expire_date": "2025-12-31T23:59:59"
  },
  "buyer": {
    "name": "João Silva",
    "document": {
      "type": "CPF",
      "number": "58713371126"
    },
    "email": "joao.silva@example.com"
  },
  "amount": 10000,
  "invoice": "unique-invoice-id",
  "country": "BR",
  "currency": "BRL",
  "payment_method": "pix"
}
```

## Rejected Charges

To test a **rejected charge**, use the following CPF document:

| Document (CPF)  | Final Status | Flow               | Rejection Reason                                       |
| --------------- | ------------ | ------------------ | ------------------------------------------------------ |
| **90836247060** | Rejected     | Created → Rejected | The payment was made from an unauthorized institution. |

### Example - Rejected Charge

```json theme={null}
{
  "pix": {
    "expire_date": "2025-12-31T23:59:59"
  },
  "buyer": {
    "name": "Maria Santos",
    "document": {
      "type": "CPF",
      "number": "90836247060"
    },
    "email": "maria.santos@example.com"
  },
  "amount": 5000,
  "invoice": "unique-invoice-id",
  "country": "BR",
  "currency": "BRL",
  "payment_method": "pix"
}
```

## Error Simulation

To simulate a **400 error response**, use the following CPF document:

| Document (CPF)  | Response        | Error Message                     |
| --------------- | --------------- | --------------------------------- |
| **76145193026** | 400 Bad Request | Failed to send payin to processor |

### Example - Error Response

```json Request theme={null}
{
  "pix": {
    "expire_date": "2025-12-31T23:59:59"
  },
  "buyer": {
    "name": "Carlos Oliveira",
    "document": {
      "type": "CPF",
      "number": "76145193026"
    },
    "email": "carlos.oliveira@example.com"
  },
  "amount": 7500,
  "invoice": "unique-invoice-id",
  "country": "BR",
  "currency": "BRL",
  "payment_method": "pix"
}
```

```json Response (400) theme={null}
{
  "message": "Failed to send payin to processor"
}
```

## Testing Flow

<Steps>
  <Step title="Choose test scenario">
    Decide whether to test a successful charge, rejection, or error response
  </Step>

  <Step title="Select test document">
    Choose the appropriate CPF document from the tables above
  </Step>

  <Step title="Create charge">
    Use the [Create Charge](/api-reference/cash-in/payin/create-charge) endpoint with the test document
  </Step>

  <Step title="Monitor status">
    Check the charge status using webhooks or the [Get Unique Charge](/api-reference/cash-in/payin/get-unique-charge) endpoint
  </Step>

  <Step title="Verify completion">
    Confirm the charge reaches the expected final status
  </Step>
</Steps>

## Best Practices

<Note>
  **Sandbox Environment**: Always use test documents in the sandbox environment. These documents are specifically configured for testing purposes.
</Note>

<Tip>
  **Unique Invoice**: Always use a unique invoice ID for each charge to avoid duplicates and ensure proper tracking.
</Tip>

## Common Test Scenarios

<AccordionGroup>
  <Accordion title="Successful Charge - Credited">
    **Document**: 58713371126

    **Expected Flow**: Created → Paid → Credited

    **Expected Result**: Charge approved and credited successfully

    ```json theme={null}
    {
      "pix": {
        "expire_date": "2025-12-31T23:59:59"
      },
      "buyer": {
        "name": "João Silva",
        "document": {
          "type": "CPF",
          "number": "58713371126"
        },
        "email": "joao.silva@example.com"
      },
      "amount": 15000,
      "invoice": "test-charge-success-001",
      "country": "BR",
      "currency": "BRL",
      "payment_method": "pix"
    }
    ```
  </Accordion>

  <Accordion title="Rejected Charge - Unauthorized Institution">
    **Document**: 90836247060

    **Expected Flow**: Created → Rejected

    **Expected Result**: Charge rejected with reason "The payment was made from an unauthorized institution."

    ```json theme={null}
    {
      "pix": {
        "expire_date": "2025-12-31T23:59:59"
      },
      "buyer": {
        "name": "Maria Santos",
        "document": {
          "type": "CPF",
          "number": "90836247060"
        },
        "email": "maria.santos@example.com"
      },
      "amount": 5000,
      "invoice": "test-charge-rejected-001",
      "country": "BR",
      "currency": "BRL",
      "payment_method": "pix"
    }
    ```
  </Accordion>

  <Accordion title="Error Response - Processor Failure">
    **Document**: 76145193026

    **Expected Response**: 400 Bad Request

    **Expected Result**: Error message "Failed to send payin to processor"

    ```json theme={null}
    {
      "pix": {
        "expire_date": "2025-12-31T23:59:59"
      },
      "buyer": {
        "name": "Carlos Oliveira",
        "document": {
          "type": "CPF",
          "number": "76145193026"
        },
        "email": "carlos.oliveira@example.com"
      },
      "amount": 7500,
      "invoice": "test-charge-error-001",
      "country": "BR",
      "currency": "BRL",
      "payment_method": "pix"
    }
    ```
  </Accordion>
</AccordionGroup>

## Charge Status Flow

### Successful Flow

After creating a charge with a successful test document, the charge will go through:

<Steps>
  <Step title="Created">
    Initial status - Charge created and awaiting payment
  </Step>

  <Step title="Paid">
    Payment received from payer
  </Step>

  <Step title="Credited">
    Amount credited to your account ✓
  </Step>
</Steps>

### Rejection Flow

After creating a charge with the rejection test document, the charge will go through:

<Steps>
  <Step title="Created">
    Initial status - Charge created and awaiting payment
  </Step>

  <Step title="Rejected">
    Charge rejected with specific reason ✗
  </Step>
</Steps>

## Testing Boleto Payments

For boleto payments, the testing flow is different. After creating a boleto charge, you need to make an additional request to simulate the payment.

### Boleto Testing Process

<Steps>
  <Step title="Create boleto charge">
    Use the [Create Charge](/api-reference/cash-in/payin/create-charge) endpoint with `payment_method: "boleto"`
  </Step>

  <Step title="Get our_number">
    Extract the `our_number` from the boleto creation response
  </Step>

  <Step title="Simulate payment">
    Make a POST request to `v1/payin/payments/pay/{our_number}` to simulate the boleto payment
  </Step>

  <Step title="Monitor status">
    The charge will follow: Created → Paid → Credited
  </Step>
</Steps>

### Boleto Payment Simulation

To simulate a boleto payment and achieve the "Credited" status:

```bash theme={null}
curl --location 'https://api.sandbox.wepayout.co/v1/payin/payments/pay/{our_number}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE' \
--data-raw '{}'
```

**Replace `{our_number}`** with the actual `our_number` value from your boleto creation response.

<Note>
  **Important**: This endpoint only simulates the status change (Created → Paid → Credited). It does not calculate interest, fines, or discounts configured in the boleto.
</Note>

### Example - Complete Boleto Flow

1. **Create Boleto Charge**:

```json theme={null}
{
  "payment_method": "boleto",
  "invoice": "YOUR-INVOICE-CODE",
  "currency": "BRL",
  "amount": 500,
  "country": "BR",
  "buyer": {
    "name": "Buyer Name",
    "email": "buyer@example.com",
    "document": {
      "type": "CPF",
      "number": "12345678901"
    },
    "address": {
      "street": "Street Name",
      "number": "123",
      "complement": "Apt 456",
      "zipcode": "12345000",
      "city": "City Name",
      "district": "District Name",
      "state_code": "SP"
    }
  },
  "originator_legal_entity": {
    "name": "Company Name",
    "document": "12345678901",
    "helpdesk": "company.com"
  },
  "boleto": {
    "expire_date": "2025-12-31"
  }
}
```

2. **Extract our\_number** from response (example: `"our_number": "991763554947"`)

3. **Simulate Payment**:

```bash theme={null}
curl --location 'https://api.sandbox.wepayout.co/v1/payin/payments/pay/991763554947' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_TOKEN_HERE' \
--data-raw '{}'
```

4. **Expected Status Flow**: Created → Paid → Credited

## Important Notes

<CardGroup cols={3}>
  <Card title="Successful Documents" icon="circle-check">
    **2 approved documents**

    Use these CPF numbers for charges that complete successfully
  </Card>

  <Card title="Rejection Document" icon="circle-xmark">
    **1 rejection document**

    Use this CPF to test rejection handling
  </Card>

  <Card title="Error Document" icon="triangle-exclamation">
    **1 error document**

    Use this CPF to test error responses
  </Card>
</CardGroup>

<Warning>
  **Production Environment**: Never use these test documents in production. They are only valid in the sandbox environment.
</Warning>

## Related Resources

<CardGroup cols={2}>
  <Card title="Create Charge" icon="plus" href="/api-reference/cash-in/payin/create-charge">
    Create a new payin charge
  </Card>

  <Card title="Charge Status" icon="list-check" href="/cash-in/status-flow">
    Understanding charge status flow
  </Card>

  <Card title="Rejection Reasons" icon="circle-xmark" href="/cash-in/rejection-reasons">
    Common rejection reasons and solutions
  </Card>

  <Card title="About Charges" icon="circle-info" href="/cash-in/about-charges">
    Learn about payin charges
  </Card>
</CardGroup>
