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

# Payment requests integration test cases

These are the test cases to help you test your site's integration with CryptoProcessing [payment requests](https://docs.ca.cryptoprocessing.com/payment-requests/integration-guide.md).

For each test case, create a new payment request via the [/payments/v1/requests](https://docs.ca.cryptoprocessing.com/api-reference/endpoints/payments.md) endpoint and then process the [payment\_request](https://docs.ca.cryptoprocessing.com/api-reference/callbacks/payment-request-callbacks.md) callback.

For some test cases, you will need to check that your customer receives an email from CryptoProcessing and can click a link in it. Make sure to specify an email address you can access (`end_user_email`) when creating payment requests for such test cases.

> [!NOTE]
>
> You can test payment requests in the sandbox environment by withdrawing funds from your merchant account instead of sending an external payment. Create a payment request, open the link, and choose a payment currency to get an address, then [withdraw funds](https://docs.ca.cryptoprocessing.com/withdrawals/create-a-withdrawal.md) to that address.

<table>
  <thead>
    <tr>
      <th>Procedure</th>
      <th>Expected results</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td colspan="2">
        **Successfully completed payment**
      </td>
    </tr>

    <tr>
      <td>
        1. Create a payment request.
        2. Open the payment request link on your device.
        3. Place a payment for the exact amount requested.
      </td>

      <td>
        * The site gets a `payment_request` callback.
        * The callback status is `paid`.
        * The customer is redirected to `url_success`.
        * The customer receives an email about the successful payment.
      </td>
    </tr>

    <tr>
      <td colspan="2">
        **Overpayment**
      </td>
    </tr>

    <tr>
      <td>
        1. Create a payment request.
        2. Open the payment request link on your device.
        3. Place a payment for an amount larger than requested (add more than the [minimum withdrawal amount](https://docs.ca.cryptoprocessing.com/confirmations-and-limits.md) plus the [refund fee](https://docs.ca.cryptoprocessing.com/payment-requests/fees.md), or the extra amount can't be refunded).
      </td>

      <td>
        * The site gets a `payment_request` callback.
        * The callback status is `paid`.
        * The customer is redirected to `url_success`.
        * The customer receives an email with a link to an automatic **partial refund**.
      </td>
    </tr>

    <tr>
      <td colspan="2">
        **Underpayment**
      </td>
    </tr>

    <tr>
      <td>
        1. Create a payment request.
        2. Open the payment request link on your device.
        3. Place a payment for an amount less than requested (if you [accept underpayments](https://docs.ca.cryptoprocessing.com/payment-requests/underpayments.md#accept-underpayments), less than your tolerance allows). To get a refund, pay more than the [minimum withdrawal amount](https://docs.ca.cryptoprocessing.com/confirmations-and-limits.md) plus the [refund fee](https://docs.ca.cryptoprocessing.com/payment-requests/fees.md).
        4. Wait until the payment request's lifespan or [rate lock](https://docs.ca.cryptoprocessing.com/payment-requests.md#lifespan-and-rate-lock) ends, whichever comes first.
      </td>

      <td>
        * When the payment request ends, the site gets a `payment_request` callback.
        * The callback status is `failed`.
        * The customer is redirected to `url_failed`.
        * The customer receives an email with a link to an automatic **full refund**.
      </td>
    </tr>

    <tr>
      <td colspan="2">
        **Accepted underpayment** (if you [accept underpayments](https://docs.ca.cryptoprocessing.com/payment-requests/underpayments.md#accept-underpayments))
      </td>
    </tr>

    <tr>
      <td>
        1. Create a payment request.
        2. Open the payment request link on your device.
        3. Place a payment for an amount less than requested, but within your underpayment tolerance.
        4. Wait until the payment request's lifespan or [rate lock](https://docs.ca.cryptoprocessing.com/payment-requests.md#lifespan-and-rate-lock) ends, whichever comes first.
      </td>

      <td>
        * When the payment request ends, the site gets a `payment_request` callback.
        * The callback status is `paid`, and its `status_reason` says the underpayment was accepted.
        * The callback's `currency_received` is the amount actually received, converted to the payment request currency.
      </td>
    </tr>

    <tr>
      <td colspan="2">
        **Payment requests with a late payment**
      </td>
    </tr>

    <tr>
      <td>
        1. Create a payment request with a short lifespan (for example, 5 minutes).
        2. Open the payment request link on your device.
        3. Choose a payment currency and click **Proceed to payment**.
        4. Copy the address or scan the QR code with your device. Do not place the payment yet.
        5. Wait till the payment request expires.
        6. Place a payment for the requested amount.
      </td>

      <td>
        * The site gets a `payment_request` callback with the `expired` status when the payment request expires.
        * After the late payment is confirmed, the site gets another `payment_request` callback. Its status is still `expired`, and the transaction has `late_payment` set to `true`.
        * The customer is redirected to `url_failed`.
        * The customer receives an email with a link to an automatic **full refund**.
      </td>
    </tr>

    <tr>
      <td colspan="2">
        **Payment request expired before the currency selection**
      </td>
    </tr>

    <tr>
      <td>
        1. Create a payment request with a short lifespan (for example, 5 minutes).
        2. Wait till the payment request expires.
      </td>

      <td>
        * The site gets a `payment_request` callback.
        * The callback status is `expired`.
        * The customer is redirected to `url_failed`.
        * The customer does not receive any email.
      </td>
    </tr>

    <tr>
      <td colspan="2">
        **Payment request expired after the currency selection**
      </td>
    </tr>

    <tr>
      <td>
        1. Create a payment request with a short lifespan (for example, 5 minutes).
        2. Open the payment request link on your device.
        3. Choose a payment currency and click **Proceed to payment**. Do not place the payment.
        4. Wait till the payment request expires.
      </td>

      <td>
        * The site gets a `payment_request` callback.
        * The callback status is `expired`.
        * The callback contains the information about the selected currency in the `currency_sent` field.
        * The customer is redirected to `url_failed`.
        * The customer does not receive any email.
      </td>
    </tr>
  </tbody>
</table>


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