# Accept a one-time payment

Learn how to accept a Pix one-time payment, a common payment method in Brazil.

# Checkout


Stripe users can accept Pix payments from customers in Brazil. Customers pay by copying and pasting a Pix string or scanning a QR code directly in their bank apps.

## Determine compatibility

**Supported business locations**: BR, US, EU, CA, GB, AU, SG, CH

**Supported currencies**: `brl`

**Presentment currencies**: `brl`

**Payment mode**: Yes

**Setup mode**: Yes

**Subscription mode**: Yes

A Checkout Session must satisfy all of the following conditions to support Pix payments:

- *Prices* (Prices define how much and how often to charge for products. This includes how much the product costs, what currency to use, and the interval if the price is for subscriptions) for all line items must be in the `brl` currency.
- You can only use one-time line items for Pix one-time payments. Setup mode and recurring *subscription* (A Subscription represents the product details associated with the plan that your customer subscribes to. Allows you to charge the customer on a recurring basis) plans are supported through [Pix Automático](https://docs.stripe.com/payments/pix/pix-automatico.md).

## Accept a payment

> Build an integration to [accept a payment](https://docs.stripe.com/payments/accept-a-payment.md?integration=checkout) with Checkout before using this guide.

### Enable Pix as a payment method

When creating a new [Checkout Session](https://docs.stripe.com/api/checkout/sessions.md), you need to:

1. [Enable Pix](https://dashboard.stripe.com/settings/payment_methods) in your Dashboard. Stripe automatically displays Pix to eligible customers using [dynamic payment methods](https://docs.stripe.com/payments/payment-methods/dynamic-payment-methods.md). If you currently specify `payment_method_types`, see the [migration guide](https://docs.stripe.com/payments/dashboard-payment-methods.md).
2. Make sure all your `line_items` use the `brl` currency.

#### Stripe-hosted page

```curl
curl https://api.stripe.com/v1/checkout/sessions \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "line_items[0][price_data][currency]=brl" \
  -d "line_items[0][price_data][product_data][name]=T-shirt" \
  -d "line_items[0][price_data][unit_amount]=2000" \
  -d "line_items[0][quantity]=1" \
  -d mode=payment \
  --data-urlencode "success_url=https://example.com/success"
```

#### Full embedded page

```curl
curl https://api.stripe.com/v1/checkout/sessions \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "line_items[0][price_data][currency]=brl" \
  -d "line_items[0][price_data][product_data][name]=T-shirt" \
  -d "line_items[0][price_data][unit_amount]=2000" \
  -d "line_items[0][quantity]=1" \
  -d mode=payment \
  --data-urlencode "return_url=https://example.com/return" \
  -d ui_mode=embedded_page
```

### Additional payment method options

You can set the number of seconds before a pending Pix payment expires by specifying the optional [expires_after_seconds](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-payment_method_options-pix-expires_after_seconds) parameter in the `payment_method_options`. For example, if a customer completes the Checkout Session with `expires_after_seconds` set to `600` on Monday at 14:00, they have until Monday at 14:10 to transfer the funds and complete the payment.

You can set `expires_after_seconds` to a value from 60 to 1209600 seconds (14 days), inclusive. If you don’t set it, the Pix expires 14400 seconds (4 hours) after PaymentIntent confirmation.

#### Stripe-hosted page

```curl
curl https://api.stripe.com/v1/checkout/sessions \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "line_items[0][price_data][currency]=brl" \
  -d "line_items[0][price_data][product_data][name]=T-shirt" \
  -d "line_items[0][price_data][unit_amount]=2000" \
  -d "line_items[0][quantity]=1" \
  -d mode=payment \
  -d "payment_method_options[pix][expires_after_seconds]=600" \
  --data-urlencode "success_url=https://example.com/success"
```

#### Full embedded page

```curl
curl https://api.stripe.com/v1/checkout/sessions \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "line_items[0][price_data][currency]=brl" \
  -d "line_items[0][price_data][product_data][name]=T-shirt" \
  -d "line_items[0][price_data][unit_amount]=2000" \
  -d "line_items[0][quantity]=1" \
  -d mode=payment \
  -d "payment_method_options[pix][expires_after_seconds]=600" \
  --data-urlencode "return_url=https://example.com/return" \
  -d ui_mode=embedded_page
```

### Fulfill your orders

After accepting a payment, learn how to [fulfill orders](https://docs.stripe.com/checkout/fulfillment.md).

## Test your integration

To test your integration:

1. Select Pix.
2. Enter the customer’s details and tap **Pay**. In a testing environment, use `000.000.000-00` as a test tax identifier (CPF or CNPJ).
3. Click **Simulate scan** to open a Stripe-hosted Pix test payment page. From this page, you can either authorize or expire the test payment.

In live mode, the **Pay** button displays a Pix QR code. You need a Brazilian bank account with Pix enabled to complete or cancel this payment flow.

You can also set [payment_method.billing_details.email](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_data-billing_details-email) to the following values to test different scenarios.

| Email                                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{any_prefix}@{any_domain}`                    | Simulates a Pix that a customer pays after 3 minutes. The [payment_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.succeeded) *webhook* (A webhook is a real-time push notification sent to your application as a JSON payload through HTTPS requests) arrives after approximately 3 minutes. In production, this webhook arrives immediately after the Pix is paid.

  Stripe ignores the [payment_method_options.pix.expires_at](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_at) and [payment_method_options.pix.expires_after_seconds](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_after_seconds) parameters in this case.

  Example: `anything@example.com` |
| `{any_prefix}succeed_immediately@{any_domain}` | Simulates a Pix that your customer pays immediately. The [payment_intent.succeeded](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.succeeded) webhook arrives within several seconds. In production, this webhook arrives immediately after the Pix is paid.

  Stripe ignores the [payment_method_options.pix.expires_at](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_at) and [payment_method_options.pix.expires_after_seconds](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_after_seconds) parameters in this case.

  Example: `succeed_immediately@example.com`                                                                                                               |
| `{any_prefix}expire_immediately@{any_domain}`  | Simulates a Pix that expires before your customer pays. The [payment_intent.payment_failed](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.payment_failed) webhook arrives within several seconds.

  Stripe ignores the [payment_method_options.pix.expires_at](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_at) and [payment_method_options.pix.expires_after_seconds](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_after_seconds) parameters in this case.

  Example: `expire_immediately@example.com`                                                                                                                                                                          |
| `{any_prefix}expire_with_delay@{any_domain}`   | Simulates a Pix that expires before your customer pays. The [payment_intent.payment_failed](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.payment_failed) webhook arrives after approximately 3 minutes.

  Stripe ignores the [payment_method_options.pix.expires_at](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_at) and [payment_method_options.pix.expires_after_seconds](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_after_seconds) parameters in this case.

  Example: `expire_with_delay@example.com`                                                                                                                                                                    |
| `{any_prefix}fill_never@{any_domain}`          | Simulates a Pix that never succeeds. It expires according to the [payment_method_options.pix.expires_at](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_at) or [payment_method_options.pix.expires_after_seconds](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_after_seconds) parameter. The [payment_intent.payment_failed](https://docs.stripe.com/api/events/types.md#event_types-payment_intent.payment_failed) webhook arrives after the simulation completes.

  Example: `fill_never@example.com`                                                                                                                                                                                                      |

## Optional: Refunds [Server-side]

You can refund Pix payments through the [Dashboard](https://dashboard.stripe.com/test/payments) or [API](https://docs.stripe.com/api.md#create_refund).

## See also

- [Checkout fulfillment](https://docs.stripe.com/checkout/fulfillment.md)
- [Customizing Checkout](https://docs.stripe.com/payments/checkout/customization.md)


## Expiration

Pix codes expire after the specified `expires_at` UNIX timestamp. After the Pix expires, confirm the PaymentIntent with another payment method or cancel it. Set expiration parameters in the [payment method options](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix) under the `pix` key.

A customer can’t pay a Pix after it expires.

| Field | Value | Default value | Required | Example |
| --- | --- | --- | --- | --- |
| `expires_after_seconds` | The number of seconds after `PaymentIntent` confirmation when a pending Pix payment expires. Valid values are from 60 to 1209600 seconds (14 days), inclusive. | 14400 seconds (4 hours), only when neither expiration option is supplied. | No | If you create a Pix payment on Monday at 13:50, confirm the `PaymentIntent` at 14:00, and set `expires_after_seconds` to 600, the Pix expires on Monday at 14:10. |
| `expires_at` | An absolute Unix timestamp when the pending Pix payment expires. It must be between 60 and 1209600 seconds (14 days) from the current time when validated, inclusive. | None. If neither expiration option is supplied, the Pix expires 14400 seconds (4 hours) after `PaymentIntent` confirmation. | No | If you set `expires_at` on Monday at 14:00 to the Unix timestamp for Wednesday at 14:00, the Pix expires at that timestamp. |

You can’t set both `expires_after_seconds` and `expires_at`. Attempting to do so returns an error. If you don’t set either one, the Pix expires 14400 seconds (4 hours) after the `PaymentIntent` is confirmed.

> The value returned on `expires_at` from the `next_action` response is the same as the input set on [payment_method_options.expires_at](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-payment_method_options-pix-expires_at). Although, in real scenarios, the actual expiration timestamp might differ. This doesn’t impact your customer’s experience paying with Pix, but it’s recommended to rely on the [payment_intent.payment_failed](https://docs.stripe.com/api/events/types.md?event_types-payment_intent.payment_failed) event to consider if the payment intent has expired.

## Cancellation

You can cancel Pix payments before they expire by [canceling the PaymentIntent](https://docs.stripe.com/api/payment_intents/cancel.md) associated with the Pix payment.
