# Pagamentos recorrentes Understand your options for charging customers on a recurring basis. Stripe offers several ways to charge customers on a recurring basis. This guide helps you understand which method or approach best supports your business. This guide offers a few ways to understand your options: - [Use cases](https://docs.stripe.com/recurring-payments.md#use-cases): Find the right use case for your business. - [Types of recurring payments](https://docs.stripe.com/recurring-payments.md#recurring-payment-types): See all the recurring payment types that Stripe supports. - [Stripe products](https://docs.stripe.com/recurring-payments.md#stripe-products): Check which Stripe products support your recurring payment use case. ## Use cases [Aceitar pagamentos recorrentes](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments): Let customers pay you regularly and repeatedly through Stripe. [Split purchases into a few payments](https://docs.stripe.com/recurring-payments.md#installment-plans): Create installment plans to let customers pay you a total amount in a limited number of partial payments. [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal): Set up the customer portal so your customers can create and manage their own subscriptions. [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations): Let customers make donations to your organization on a regular basis. [Migrate existing subscriptions to Stripe](https://docs.stripe.com/recurring-payments.md#migrate-subscriptions): Move your existing subscriptions from a third-party service to Stripe. ## Types of recurring payments The following tabs describe the different types of recurring payments that Stripe supports. #### Subscriptions | | | | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Overview** | Use [Stripe Billing](https://docs.stripe.com/billing.md) to create and manage your subscriptions through the Dashboard or programmatically through the API. - [Create a payment link with a recurring product](https://docs.stripe.com/payment-links/create.md). - Create a subscription through the [Dashboard](https://dashboard.stripe.com/subscriptions) or [build a subscriptions integration](https://docs.stripe.com/billing/subscriptions/build-subscriptions.md). - Create [subscription schedules](https://docs.stripe.com/billing/subscriptions/subscription-schedules.md) for complex subscription use cases. - If you use Connect, [create subscriptions](https://docs.stripe.com/connect/subscriptions.md) for connected accounts and end customers. | | **Features** | - No coding required. (You can optionally use the Subscriptions API and prebuilt components like Stripe Checkout and Elements to build a programmatic subscriptions integration.) - Customize appearance and behavior in your app. - Supports multiple products and prices in different currencies. - Supports responsive web and mobile native. - Website required. You can use Stripe Elements to customize the appearance of payment forms. | | **Use cases** | - [Accept payments from customers on a recurring basis](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) - [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations) - [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal) - [Migrate existing subscriptions to Stripe](https://docs.stripe.com/recurring-payments.md#migrate-subscriptions) | #### Parcelas | | | | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Overview** | Installments let you split a payment into a few recurring charges. They’re good for boosting conversion of high-value goods, increasing average cart size, and reaching new customers. Use subscription schedules to set up an [installment plan](https://docs.stripe.com/billing/subscriptions/subscription-schedules.md#installment-plans). Use *buy now, pay later (BNPL)* (Buy now, pay later (BNPL) allows customers to purchase a product immediately and pay for it over time—often interest free) services, like Klarna, to let customers pay in installments. Learn more about [buy now, pay later options](https://docs.stripe.com/payments/buy-now-pay-later.md). Accept card payments in scheduled installments, if your business is based in Mexico. Learn more about [card payment installments](https://docs.stripe.com/payments/mx-installments.md). (Only available in Mexico) | | **Features** | - Subscription schedules require coding. Most BNPL methods can be enabled through the Dashboard. - Customize appearance and behavior in your app. - Supports multiple products and prices in different currencies. - Supports responsive web and mobile native. - Website required. You can use Stripe Elements to customize the appearance of payment forms. | | **Use cases** | [Split purchases into a few payments](https://docs.stripe.com/recurring-payments.md#installment-plans) | #### Recurring invoices | | | | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Overview** | Invoices let you accept immediate, future, or recurring payments. Create invoices through the Dashboard or API. Set up [automatic charging for your customers](https://docs.stripe.com/invoicing/automatic-charging.md). Automatically schedule and generate recurring invoices by creating subscriptions. Use invoices to collect payment by either [automatically charging customers](https://docs.stripe.com/recurring-payments.md#use-invoices) or [automatically sending invoices to customers](https://docs.stripe.com/recurring-payments.md#schedule-recurring-invoices). To schedule future payments, use the [hosted invoice page](https://docs.stripe.com/invoicing/hosted-invoice-page/scheduled-payments.md). Only available in the US. See the [full list of limitations](https://docs.stripe.com/invoicing/hosted-invoice-page/scheduled-payments.md#limitations). | | **Features** | - Hosted by Stripe. - Requires minimal coding or no coding, depending on the method. - Customize the branding of the invoices, emails, and payment page. - Supports multiple products and prices in different currencies. - Mobile support for responsive web. - No website required. Stripe hosts the payment page. - Supports [Stripe Tax](https://docs.stripe.com/tax.md). | | **Use cases** | - [Accept payments from customers on a recurring basis](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) | #### Charges on saved payment methods | | | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Overview** | Use the *Payment Intents API* (The Payment Intents API tracks the lifecycle of a customer checkout flow and triggers additional authentication steps when required by regulatory mandates, custom Radar fraud rules, or redirect-based payment methods) to save payment method details [as part of the payment flow](https://docs.stripe.com/payments/save-during-payment.md?payment-ui=elements) during the initial payment flow for future, recurring usage. When you’re ready to charge the customer, [charge the saved payment method](https://docs.stripe.com/payments/save-and-reuse.md?platform=web&ui=elements#charge-saved-payment-method). | | **Features** | - Requires some coding. - Customize appearance and behavior in your app. - Supports multiple products and prices in different currencies. - Supports responsive web and mobile native. - Website required. You can use Stripe Elements to customize the appearance of payment forms. | | **Use cases** | - [Accept payments from customers on a recurring basis](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) - [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations) - [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal) | ## Stripe products for recurring payments The following table describes which Stripe products support recurring payments. | Produto | Recursos | Casos de uso | | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Payment Links** | - Sem programação - Personalizar a marca - Um link de pagamento para um ou mais produtos - Mobile support for responsive web - Site não obrigatório; compartilhe links por SMS, e-mail ou redes sociais - [Stripe Tax](https://docs.stripe.com/tax.md) support | - [Accept recurring payments](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) - [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal) - [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations) | | **Faturamento** | - No coding required. (You can optionally use the [Invoices API](https://docs.stripe.com/api/invoices.md) and prebuilt components like Stripe Checkout and Elements to build a programmatic invoicing integration.) - Customize branding and templates. - One invoice for one or more products. Optionally combine one-time and recurring products. - Mobile support for responsive web. - No website required. Share invoices through customer portal, hosted invoice page, or as PDFs. - [Stripe Tax](https://docs.stripe.com/tax.md) support. | - [Accept recurring payments](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) - [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal) - [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations) | | **Subscriptions** | - No coding required. (You can optionally use the [Subscriptions API](https://docs.stripe.com/api/subscriptions.md) and prebuilt components like Stripe Checkout and Elements to build a programmatic subscriptions integration.) - Customize full appearance of payment forms and checkout experience. - Multiple products, prices, pricing models, and currencies. - Mobile support for responsive web. - No website required. You can also add subscriptions to your site. - [Stripe Tax](https://docs.stripe.com/tax.md) support. | - [Accept recurring payments](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) - [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal) - [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations) | | **Checkout** | - Um pouco de programação - Personalizar a marca - Vários produtos e preços em moedas diferentes - Mobile support for responsive web - Site obrigatório, mas a Stripe hospeda a página de pagamentos - [Stripe Tax](https://docs.stripe.com/tax.md) support | - [Accept recurring payments](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) - [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal) - [Split purchases into a few payments](https://docs.stripe.com/recurring-payments.md#installment-plans) - [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations) | | **Elements** | - Mais programação - Personalizar toda a aparência - Vários produtos e preços em moedas diferentes - Web ágil e modo nativo em dispositivos móveis - Site obrigatório; adicione o Elements à página de pagamentos - [Stripe Tax](https://docs.stripe.com/tax.md) supported with your own [tax integration](https://docs.stripe.com/tax/standalone-tax-api.md) | - [Accept recurring payments](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) - [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal) - [Split purchases into a few payments](https://docs.stripe.com/recurring-payments.md#installment-plans) - [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations) | | **API** | - Mais programação - Personalize toda a aparência e aceite pagamentos usando sua própria IU - Vários produtos e preços em moedas diferentes - Site obrigatório; aceite pagamentos pela sua própria IU - [Stripe Tax](https://docs.stripe.com/tax.md) supported with your own [tax integration](https://docs.stripe.com/tax/standalone-tax-api.md) | - [Accept recurring payments](https://docs.stripe.com/recurring-payments.md#accept-recurring-payments) - [Enable customers to manage their own subscriptions](https://docs.stripe.com/recurring-payments.md#enable-customer-portal) - [Split purchases into a few payments](https://docs.stripe.com/recurring-payments.md#installment-plans) - [Accept recurring donations](https://docs.stripe.com/recurring-payments.md#recurring-donations) | ## Accept recurring payments Stripe offers several ways for you to accept recurring payments. Use Subscriptions with Stripe Billing, PaymentIntents, SetupIntents, or Invoicing. ### Use subscriptions to accept recurring payments If you have a business model where your customers pay you on a regular basis, you typically want to offer them subscriptions. Stripe offers several ways to create and manage subscriptions. If you use [Organizations](https://docs.stripe.com/get-started/account/orgs.md), you can view a list of your subscriptions across all of your accounts. You can also filter this list by account. However, you can create and analyze subscriptions only from the Subscriptions page at the account level. > Subscriptions are part of Stripe Billing, which has its own pricing plan. #### Create subscriptions from the Dashboard Para criar uma assinatura: 1. In the Stripe Dashboard, go to the [subscriptions](https://dashboard.stripe.com/test/subscriptions) page. 1. Clique em **+Criar assinatura**. 1. Encontre ou adicione um cliente. 1. Enter the pricing and product information. You can add multiple products. 1. Set the start and end date of the subscription. 1. Set the starting date for the billing cycle. This defines when the next invoice is generated. Depending on your settings, the saved payment method on file might also be charged automatically on the billing cycle date. Learn more about the [billing cycle date](https://docs.stripe.com/billing/subscriptions/billing-cycle.md). 1. (Recommended) [Configure email reminders and notifications](https://docs.stripe.com/invoicing/send-email.md#email-configuration) for subscribers. 1. (Optional) Add the default tax behavior, a coupon, a free trial, or metadata. 1. (Optional) Enable [revenue recovery](https://docs.stripe.com/billing/revenue-recovery.md) features in the Dashboard, which can help you reduce and recover failed subscription payments. You can automatically retry failed payments, build custom automations, configure customer emails, and so on. #### Create subscriptions with Payment Links To create subscriptions with Payment Links, select **Sell a subscription** when you create the payment link. Then, share the link with your customers. Learn more about [creating](https://docs.stripe.com/payment-links/create.md) and [sharing](https://docs.stripe.com/payment-links/share.md) payment links. #### Create subscriptions with Checkout If you’re using *Checkout* (A low-code payment integration that creates a customizable form for collecting payments. You can embed Checkout directly in your website, redirect customers to a Stripe-hosted payment page, or create a customized checkout page with Stripe Elements) as your payment UI, create subscriptions with the [Checkout Sessions API](https://docs.stripe.com/api/checkout/sessions.md#checkout_sessions). In typical integrations, you add a button to your site that calls the backend of your application to create the checkout session. Read the [subscriptions integration guide](https://docs.stripe.com/billing/subscriptions/build-subscriptions.md?payment-ui=checkout&ui=stripe-hosted) to learn more. After a payment succeeds, the subscription becomes active and the [CheckoutSession](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object) object contains references to the `Account` or `Customer` object and the `Subscription` object. To create a subscription with this API, pass `mode=subscription`: #### Ruby ```ruby # Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. # Find your keys at https://dashboard.stripe.com/apikeys. client = Stripe::StripeClient.new('<>') # The price ID passed from the front end. # price_id = params['priceId'] price_id = '{{PRICE_ID}}' session = client.v1.checkout.sessions.create({ success_url: 'https://example.com/success.html?session_id={CHECKOUT_SESSION_ID}', mode: 'subscription', line_items: [{ # For usage-based billing, don't pass quantity quantity: 1, price: price_id }], subscription_data: { billing_mode: { type: 'flexible' } } }) # Redirect to the URL returned on the session # redirect session.url, 303 ``` #### Create subscriptions with Elements If you’re using *Elements* (A set of UI components for building a web checkout flow. They adapt to your customer's locale, validate input, and use tokenization, keeping sensitive customer data from touching your server) as your payment UI, create subscriptions with the [Subscriptions API](https://docs.stripe.com/api/subscriptions.md). Pass the selected price ID and the ID of the customer record to the backend. Then, on the backend, create the subscription with status `incomplete` using `payment_behavior=default_incomplete`. Then return the `client_secret` from the subscription’s first [PaymentIntent](https://docs.stripe.com/payments/paymentintents/lifecycle.md) to the frontend to complete payment. Learn how to [build a subscriptions integration with Elements](https://docs.stripe.com/billing/subscriptions/build-subscriptions.md?payment-ui=elements). O exemplo a seguir cria uma `Assinatura` e expande o `confirmation_secret` da sua fatura mais recente na resposta. Isso permite enviar o segredo para o front-end para confirmar o pagamento. #### Contas v2 ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d "items[0][price]={{PRICE_ID}}" \ -d payment_behavior=default_incomplete \ -d "payment_settings[save_default_payment_method]=on_subscription" \ -d "billing_mode[type]=flexible" \ -d "expand[0]=latest_invoice.confirmation_secret" ``` #### Clientes v1 ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d "items[0][price]={{PRICE_ID}}" \ -d payment_behavior=default_incomplete \ -d "payment_settings[save_default_payment_method]=on_subscription" \ -d "billing_mode[type]=flexible" \ -d "expand[0]=latest_invoice.confirmation_secret" ``` At this point, the subscription is `inactive` and awaiting payment. In the following example response, the minimum fields you *must* store are highlighted. We recommend that you also store any field that your application frequently accesses. #### Contas v2 ```json {"id": "sub_JgRjFjhKbtD2qz", "object": "subscription", "application_fee_percent": null, "automatic_tax": { "disabled_reason": null, "enabled": false, "liability": "null" }, "billing_cycle_anchor": 1623873347, "billing_cycle_anchor_config": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": null, "cancellation_details": { "comment": null, "feedback": null, "reason": null }, "collection_method": "charge_automatically", "created": 1623873347, "currency": "usd","customer_account": identifier("customerAccount"), "days_until_due": null, "default_payment_method": null, "default_source": null, "default_tax_rates": [ ], "discounts": [], "ended_at": null, "invoice_customer_balance_settings": { "account_tax_ids": null, "issuer": { "type": "self" } }, "items": { "object": "list", "data": [ { "id": "si_JgRjmS4Ur1khEx", "object": "subscription_item", "created": 1623873347,"current_period_end": 1626465347, "current_period_start": 1623873347, "discounts": [], "metadata": { }, "plan": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "plan", "active": true, "amount": 2000, "amount_decimal": "2000", "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "tiers": null, "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "livemode": false, "lookup_key": null, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "recurring": { "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed" }, "tiers_mode": null, "transform_quantity": null, "type": "recurring", "unit_amount": 2000, "unit_amount_decimal": "2000" }, "quantity": 1, "subscription": "sub_JgRjFjhKbtD2qz", "tax_rates": [ ] } ], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_JgRjFjhKbtD2qz" }, "latest_invoice": { "id": "in_1J34pzGPZ1iASj5zB87qdBNZ", "object": "invoice", "account_country": "US", "account_name": "Angelina's Store", "account_tax_ids": null, "amount_due": 2000, "amount_overpaid": 0, "amount_paid": 0, "amount_remaining": 2000, "amount_shipping": 0, "attempt_count": 0, "attempted": false, "auto_advance": false, "automatic_tax": { "disabled_reason": null, "enabled": false, "liability": null, "status": null }, "automatically_finalizes_at": null, "billing_reason": "subscription_update", "collection_method": "charge_automatically", "created": 1623873347, "currency": "usd", "custom_fields": null, "customer_account": identifier("customerAccount"), "customer_address": null, "customer_email": "angelina@stripe.com", "customer_name": null, "customer_phone": null, "customer_shipping": { "address": { "city": "", "country": "US", "line1": "Berry", "line2": "", "postal_code": "", "state": "" }, "name": "", "phone": null }, "customer_tax_exempt": "none", "customer_tax_ids": [ ], "default_payment_method": null, "default_source": null, "default_tax_rates": [ ], "description": null, "discounts": [], "due_date": null, "effective_at": "1623873347", "ending_balance": 0, "footer": null, "from_invoice": null, "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1By64KGPZ1iASj5z/invst_JgRjzIOILGeq2MKC9T0KtyXnD5udsLp", "invoice_pdf": "https://pay.stripe.com/invoice/acct_1By64KGPZ1iASj5z/invst_JgRjzIOILGeq2MKC9T0KtyXnD5udsLp/pdf", "last_finalization_error": null, "latest_revision": null, "lines": { "object": "list", "data": [ { "id": "il_1N2CjMBwKQ696a5NeOawRQP2", "object": "line_item", "amount": 2000, "currency": "usd", "description": "1 × Gold Special (at $20.00 / month)", "discount_amounts": [ ], "discountable": true, "discounts": [ ], "invoice": "in_1J34pzGPZ1iASj5zB87qdBNZ", "livemode": false, "metadata": { }, "parent": { "invoice_item_details": null, "subscription_item_details": { "invoice_item": null, "proration": false, "proration_details": { "credited_items": null }, "subscription": "sub_JgRjFjhKbtD2qz", "subscription_item": "si_JgRjmS4Ur1khEx" }, "type": "subscription_item_details" }, "period": { "end": 1626465347, "start": 1623873347 }, "plan": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "plan", "active": true, "amount": 2000, "amount_decimal": "2000", "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "tiers": null, "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "livemode": false, "lookup_key": null, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "recurring": { "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed" }, "tiers_mode": null, "transform_quantity": null, "type": "recurring", "unit_amount": 2000, "unit_amount_decimal": "2000" }, "quantity": 1, "taxes": [] } ], "has_more": false, "total_count": 1, "url": "/v1/invoices/in_1J34pzGPZ1iASj5zB87qdBNZ/lines" }, "livemode": false, "metadata": { }, "next_payment_attempt": null, "number": "C008FC2-0354", "on_behalf_of": null, "parent": { "quote_details": null, "subscription_details": { "metadata": {}, "pause_collection": null, "subscription": "sub_JgRjFjhKbtD2qz" } }, "payment_intent": { "id": "pi_1J34pzGPZ1iASj5zI2nOAaE6", "object": "payment_intent", "allowed_source_types": [ "card" ], "amount": 2000, "amount_capturable": 0, "amount_received": 0, "application": null, "application_fee_amount": null, "canceled_at": null, "cancellation_reason": null, "capture_method": "automatic", "charges": { "object": "list", "data": [ ], "has_more": false, "total_count": 0, "url": "/v1/charges?payment_intent=pi_1J34pzGPZ1iASj5zI2nOAaE6" }, "client_secret": "pi_1J34pzGPZ1iASj5zI2nOAaE6_secret_l7FN6ldFfXiFmJEumenJ2y2wu", "confirmation_method": "automatic", "created": 1623873347, "currency": "usd", "customer": "cus_CMqDWO2xODTZqt", "description": "Subscription creation", "invoice": "in_1J34pzGPZ1iASj5zB87qdBNZ", "last_payment_error": null, "livemode": false, "metadata": { }, "next_action": null, "next_source_action": null, "on_behalf_of": null, "payment_method": null, "payment_method_options": { "card": { "installments": null, "network": null, "request_three_d_secure": "automatic" } }, "payment_method_types": [ "card" ], "receipt_email": null, "review": null, "setup_future_usage": "off_session", "shipping": null, "source": "card_1By6iQGPZ1iASj5z7ijKBnXJ", "statement_descriptor": null, "statement_descriptor_suffix": null, "status": "requires_confirmation", "transfer_data": null, "transfer_group": null }, "payment_settings": { "payment_method_options": null, "payment_method_types": null, "save_default_payment_method": "on_subscription" }, "period_end": 1623873347, "period_start": 1623873347, "post_payment_credit_notes_amount": 0, "pre_payment_credit_notes_amount": 0, "receipt_number": null, "starting_balance": 0, "statement_descriptor": null, "status": "open", "status_transitions": { "finalized_at": 1623873347, "marked_uncollectible_at": null, "paid_at": null, "voided_at": null }, "subscription": "sub_JgRjFjhKbtD2qz", "subtotal": 2000, "tax": null, "tax_percent": null, "total": 2000, "total_discount_amounts": [], "total_tax_amounts": [], "transfer_data": null, "webhooks_delivered_at": 1623873347 }, "livemode": false, "metadata": { }, "next_pending_invoice_item_invoice": null, "pause_collection": null, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "plan": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "plan", "active": true, "amount": 2000, "amount_decimal": "2000", "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "tiers": null, "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "quantity": 1, "schedule": null, "start": 1623873347, "start_date": 1623873347, "status": "incomplete", "tax_percent": null, "transfer_data": null, "trial_end": null, "trial_start": null } ``` #### Clientes v1 ```json {"id": "sub_JgRjFjhKbtD2qz", "object": "subscription", "application_fee_percent": null, "automatic_tax": { "disabled_reason": null, "enabled": false, "liability": "null" }, "billing_cycle_anchor": 1623873347, "billing_cycle_anchor_config": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": null, "cancellation_details": { "comment": null, "feedback": null, "reason": null }, "collection_method": "charge_automatically", "created": 1623873347, "currency": "usd","customer": identifier("customer"), "days_until_due": null, "default_payment_method": null, "default_source": null, "default_tax_rates": [ ], "discounts": [], "ended_at": null, "invoice_customer_balance_settings": { "account_tax_ids": null, "issuer": { "type": "self" } }, "items": { "object": "list", "data": [ { "id": "si_JgRjmS4Ur1khEx", "object": "subscription_item", "created": 1623873347,"current_period_end": 1626465347, "current_period_start": 1623873347, "discounts": [], "metadata": { }, "plan": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "plan", "active": true, "amount": 2000, "amount_decimal": "2000", "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "tiers": null, "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "livemode": false, "lookup_key": null, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "recurring": { "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed" }, "tiers_mode": null, "transform_quantity": null, "type": "recurring", "unit_amount": 2000, "unit_amount_decimal": "2000" }, "quantity": 1, "subscription": "sub_JgRjFjhKbtD2qz", "tax_rates": [ ] } ], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_JgRjFjhKbtD2qz" }, "latest_invoice": { "id": "in_1J34pzGPZ1iASj5zB87qdBNZ", "object": "invoice", "account_country": "US", "account_name": "Angelina's Store", "account_tax_ids": null, "amount_due": 2000, "amount_overpaid": 0, "amount_paid": 0, "amount_remaining": 2000, "amount_shipping": 0, "attempt_count": 0, "attempted": false, "auto_advance": false, "automatic_tax": { "disabled_reason": null, "enabled": false, "liability": null, "status": null }, "automatically_finalizes_at": null, "billing_reason": "subscription_update", "collection_method": "charge_automatically", "created": 1623873347, "currency": "usd", "custom_fields": null, "customer": identifier("customer"), "customer_address": null, "customer_email": "angelina@stripe.com", "customer_name": null, "customer_phone": null, "customer_shipping": { "address": { "city": "", "country": "US", "line1": "Berry", "line2": "", "postal_code": "", "state": "" }, "name": "", "phone": null }, "customer_tax_exempt": "none", "customer_tax_ids": [ ], "default_payment_method": null, "default_source": null, "default_tax_rates": [ ], "description": null, "discounts": [], "due_date": null, "effective_at": "1623873347", "ending_balance": 0, "footer": null, "from_invoice": null, "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1By64KGPZ1iASj5z/invst_JgRjzIOILGeq2MKC9T0KtyXnD5udsLp", "invoice_pdf": "https://pay.stripe.com/invoice/acct_1By64KGPZ1iASj5z/invst_JgRjzIOILGeq2MKC9T0KtyXnD5udsLp/pdf", "last_finalization_error": null, "latest_revision": null, "lines": { "object": "list", "data": [ { "id": "il_1N2CjMBwKQ696a5NeOawRQP2", "object": "line_item", "amount": 2000, "currency": "usd", "description": "1 × Gold Special (at $20.00 / month)", "discount_amounts": [ ], "discountable": true, "discounts": [ ], "invoice": "in_1J34pzGPZ1iASj5zB87qdBNZ", "livemode": false, "metadata": { }, "parent": { "invoice_item_details": null, "subscription_item_details": { "invoice_item": null, "proration": false, "proration_details": { "credited_items": null }, "subscription": "sub_JgRjFjhKbtD2qz", "subscription_item": "si_JgRjmS4Ur1khEx" }, "type": "subscription_item_details" }, "period": { "end": 1626465347, "start": 1623873347 }, "plan": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "plan", "active": true, "amount": 2000, "amount_decimal": "2000", "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "tiers": null, "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "livemode": false, "lookup_key": null, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "recurring": { "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed" }, "tiers_mode": null, "transform_quantity": null, "type": "recurring", "unit_amount": 2000, "unit_amount_decimal": "2000" }, "quantity": 1, "taxes": [] } ], "has_more": false, "total_count": 1, "url": "/v1/invoices/in_1J34pzGPZ1iASj5zB87qdBNZ/lines" }, "livemode": false, "metadata": { }, "next_payment_attempt": null, "number": "C008FC2-0354", "on_behalf_of": null, "parent": { "quote_details": null, "subscription_details": { "metadata": {}, "pause_collection": null, "subscription": "sub_JgRjFjhKbtD2qz" } }, "payment_intent": { "id": "pi_1J34pzGPZ1iASj5zI2nOAaE6", "object": "payment_intent", "allowed_source_types": [ "card" ], "amount": 2000, "amount_capturable": 0, "amount_received": 0, "application": null, "application_fee_amount": null, "canceled_at": null, "cancellation_reason": null, "capture_method": "automatic", "charges": { "object": "list", "data": [ ], "has_more": false, "total_count": 0, "url": "/v1/charges?payment_intent=pi_1J34pzGPZ1iASj5zI2nOAaE6" }, "client_secret": "pi_1J34pzGPZ1iASj5zI2nOAaE6_secret_l7FN6ldFfXiFmJEumenJ2y2wu", "confirmation_method": "automatic", "created": 1623873347, "currency": "usd", "customer": "cus_CMqDWO2xODTZqt", "description": "Subscription creation", "invoice": "in_1J34pzGPZ1iASj5zB87qdBNZ", "last_payment_error": null, "livemode": false, "metadata": { }, "next_action": null, "next_source_action": null, "on_behalf_of": null, "payment_method": null, "payment_method_options": { "card": { "installments": null, "network": null, "request_three_d_secure": "automatic" } }, "payment_method_types": [ "card" ], "receipt_email": null, "review": null, "setup_future_usage": "off_session", "shipping": null, "source": "card_1By6iQGPZ1iASj5z7ijKBnXJ", "statement_descriptor": null, "statement_descriptor_suffix": null, "status": "requires_confirmation", "transfer_data": null, "transfer_group": null }, "payment_settings": { "payment_method_options": null, "payment_method_types": null, "save_default_payment_method": "on_subscription" }, "period_end": 1623873347, "period_start": 1623873347, "post_payment_credit_notes_amount": 0, "pre_payment_credit_notes_amount": 0, "receipt_number": null, "starting_balance": 0, "statement_descriptor": null, "status": "open", "status_transitions": { "finalized_at": 1623873347, "marked_uncollectible_at": null, "paid_at": null, "voided_at": null }, "subscription": "sub_JgRjFjhKbtD2qz", "subtotal": 2000, "tax": null, "tax_percent": null, "total": 2000, "total_discount_amounts": [], "total_tax_amounts": [], "transfer_data": null, "webhooks_delivered_at": 1623873347 }, "livemode": false, "metadata": { }, "next_pending_invoice_item_invoice": null, "pause_collection": null, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "plan": { "id": "price_1J32RfGPZ1iASj5zHHp57z7C", "object": "plan", "active": true, "amount": 2000, "amount_decimal": "2000", "billing_scheme": "per_unit", "created": 1623864151, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": { }, "nickname": null, "product": "prod_JgPF5xnq7qBun3", "tiers": null, "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "quantity": 1, "schedule": null, "start": 1623873347, "start_date": 1623873347, "status": "incomplete", "tax_percent": null, "transfer_data": null, "trial_end": null, "trial_start": null } ``` #### Create subscriptions through the Subscriptions API Use the [Subscriptions API](https://docs.stripe.com/api/subscriptions.md) to create basic subscriptions for recurring prices. Learn how to [build an end-to-end subscriptions integration](https://docs.stripe.com/billing/subscriptions/build-subscriptions.md) or use the [immersive quickstart](https://docs.stripe.com/billing/quickstart.md). Here’s how to create a subscription where the initial payment also includes a one-time purchase (like a service fee): #### Accounts v2 ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d "items[0][price]={{RECURRING_PRICE_ID}}" \ -d "add_invoice_items[0][price]={{ONE_TIME_PRICE_ID}}" ``` #### Customer v1 ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d "items[0][price]={{RECURRING_PRICE_ID}}" \ -d "add_invoice_items[0][price]={{ONE_TIME_PRICE_ID}}" ``` #### Create subscriptions with the Subscription Schedules API For more complex subscription scenarios, use the [Subscription Schedules API](https://docs.stripe.com/api/subscription_schedules.md). Learn more about [subscription schedules](https://docs.stripe.com/billing/subscriptions/subscription-schedules.md) and their [use cases](https://docs.stripe.com/billing/subscriptions/subscription-schedules.md#use-cases). Here’s how to create a recurring subscription: #### Accounts v2 ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d "items[0][price]=price_F52b2UdntfQsfR" \ -d "expand[0]=latest_invoice.payments" \ -d "expand[1]=latest_invoice.confirmation_secret" \ -d off_session=true ``` #### Customers v1 ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d "items[0][price]=price_F52b2UdntfQsfR" \ -d "expand[0]=latest_invoice.payments" \ -d "expand[1]=latest_invoice.confirmation_secret" \ -d off_session=true ``` ### Save and reuse payment information for recurring charges Set up recurring payments by charging a customer’s saved payment information. Capture the payment details with a *PaymentIntent* (API object that represents your intent to collect payment from a customer, tracking charge attempts and payment state changes throughout the process) or *SetupIntent* (The Setup Intents API lets you build dynamic flows for collecting payment method details for future payments. It tracks the lifecycle of a payment setup flow and can trigger additional authentication steps if required by law or by the payment method). Then use the *client secret* (The client secret is a unique key returned from Stripe as part of a PaymentIntent. This key lets the client access important fields from the PaymentIntent (status, amount, currency) while hiding sensitive ones (metadata, customer)) associated with those objects to charge the customer later. This approach is good if you don’t want to use Subscriptions or have implemented your own subscription logic. These steps only cover what’s needed to collect payment method information and to charge it. Read the guide for complete integration details to [save and reuse payment details](https://docs.stripe.com/payments/save-and-reuse.md). - **Use PaymentIntents to capture payment information during a checkout flow.** Charge the customer on-session for their immediate purchase, then charge them later. This flow is good for: charging customers for an initial payment in a series of recurring payments, or charging for a one-time setup fee for a subscription service. - **Use SetupIntents to capture payment information outside of a checkout flow.** Collect the details from the customer and store them in a SetupIntent. This flow is good for: capturing payment information while you onboard a customer that you intend to charge later, or for setting up free trials. #### Save payment details during checkout (PaymentIntents) 1. As part of the checkout process, create a PaymentIntent and pass `setup_future_usage`. In most cases, you want to use `off_session` for recurring payments. Read more about [optimizing future payments](https://docs.stripe.com/payments/payment-intents.md#future-usage). #### Contas v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d amount=1099 \ -d currency=usd \ -d setup_future_usage=off_session \ -d "automatic_payment_methods[enabled]=true" ``` #### Clientes v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d amount=1099 \ -d currency=usd \ -d setup_future_usage=off_session \ -d "automatic_payment_methods[enabled]=true" ``` 1. Save the payment method information and associate it with the customer record. If you’re using Stripe Checkout, pass `setup_future_usage` in the `payment_intent_data` array. See an example of how to [save payment details](https://docs.stripe.com/payments/accept-a-payment.md?payment-ui=checkout&ui=stripe-hosted#save-payment-method-details) with Checkout. If you’re using *Elements* (A set of UI components for building a web checkout flow. They adapt to your customer's locale, validate input, and use tokenization, keeping sensitive customer data from touching your server), capture the information with the [Address Element](https://docs.stripe.com/elements/address-element.md). 1. When you’re ready, retrieve the payment method information for the customer and charge them by creating another PaymentIntent. To reduce the chance of declines, pass `off_session` and `confirm` as `True`. These arguments indicate that the customer isn’t present and enable immediate confirmation. #### Contas v2 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=1099 \ -d currency=usd \ -d "automatic_payment_methods[enabled]=true" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d payment_method={{PAYMENT_METHOD_ID}} \ --data-urlencode "return_url=https://example.com/order/123/complete" \ -d off_session=true \ -d confirm=true ``` #### Clientes v1 ```curl curl https://api.stripe.com/v1/payment_intents \ -u "<>:" \ -d amount=1099 \ -d currency=usd \ -d "automatic_payment_methods[enabled]=true" \ -d "customer={{CUSTOMER_ID}}" \ -d payment_method={{PAYMENT_METHOD_ID}} \ --data-urlencode "return_url=https://example.com/order/123/complete" \ -d off_session=true \ -d confirm=true ``` #### Save payment details outside of checkout (SetupIntents) 1. Create a SetupIntent on your server and attach it to a specific `customer_account` (created with the [Accounts v2 API](https://docs.stripe.com/api/v2/core/accounts/object.md#v2_account_object-configuration-customer-applied)) or `customer` (created with the [Customers API](https://docs.stripe.com/api/customers.md)). 1. Collect payment information: - Collect payment details with the Payment Element. - Collect shipping details with the Address Element. - Optionally, add Link as a payment method to enable faster checkout. 1. Submit the payment details to Stripe. Set up a `return_url` so that Stripe can redirect your customer. If necessary, we redirect them to intermediate sites, like a bank authorization page before redirecting them back to the `return_url`. 1. When you’re ready to complete the payment off-session, use the `Account` or `Customer` ID and the `PaymentMethod` ID to create a `PaymentIntent`. ### Use invoices to automatically charge customers You can use invoices to handle recurring payments. For example, the Powdur company has a monthly landscaping service. Each month, the landscapers send Powdur an invoice and automatically charge the payment method they have on file for Powdur. The following sections describe your options for using invoices for recurring payments. ### Create an invoice through the Dashboard Para criar e enviar uma fatura, realize estas etapas: 1. No Dashboard, acesse a [página Faturas](https://dashboard.stripe.com/invoices) e clique em **Criar fatura** para abrir o [editor de faturas](https://dashboard.stripe.com/invoices/create). Sempre que você sair do editor de faturas, a Stripe salvará um rascunho. (Para excluir uma fatura provisória, clique no menu de navegação (⋯) ao lado de uma fatura na [página Faturas](https://dashboard.stripe.com/invoices).) 1. Selecione um cliente existente ou clique em **Adicionar novo cliente**. Para clientes novos, é preciso inserir um nome. Você também pode adicionar um endereço de e-mail ou outros dados. 1. (Opcional) Clique no menu (⋯) na seção **Itens** para abrir a caixa de diálogo **Opções de item**. Escolha a moeda e a opção de processamento fiscal da fatura. 1. Selecione **Adicionar item avulso** para criar um item único e avulso. Para salvar um produto para uso futuro, selecione **Criar produto**. 1. Insira a **Quantidade** e o **Preço** do seu novo item ou produto. 1. (Opcional) Clique em **Opções de item** abaixo de cada item para adicionar uma alíquota, cupom ou data de fornecimento. Você também pode usar o Dashboard para criar uma [alíquota](https://dashboard.stripe.com/tax-rates) ou [cupom](https://dashboard.stripe.com/coupons/create). 1. (Opcional) Use a caixa **Observação** para fornecer mais informações ao cliente. Para editar a observação em uma fatura, clique em **Editar observação** na página de detalhes. 1. Selecione uma das seguintes opções de entrega da fatura: - **Cobrar automaticamente uma forma de pagamento cadastrada**: cobra imediatamente o valor da fatura da forma de pagamento cadastrada do cliente. - **Enviar fatura ou link para página de pagamento manualmente**: fornece um link de pagamento para você enviar aos clientes após confirmar a fatura. - **Enviar fatura com link por e-mail**: Permite que a Stripe envie um e-mail com uma página de pagamento e um PDF da fatura. - **Enviar fatura sem link por e-mail**: permite que a Stripe envie apenas um PDF da fatura. 1. (Opcional) Para agendar esta fatura para [finalização automática](https://docs.stripe.com/invoicing/scheduled-finalization.md) em alguma data futura, selecione **Agendar a data de envio**. Ou, dependendo do que você selecionou na etapa anterior, **Agendar a data de cobrança** ou **Agendar a data de finalização**. 1. (Opcional) Expanda **Opções avançadas** e adicione [campos personalizados](https://docs.stripe.com/invoicing/customize.md#custom-fields). Para saber mais, consulte [Preços e impostos líquidos](https://docs.stripe.com/invoicing/taxes.md#net-price-taxes). Expanda **Opções avançadas** e adicione [campos personalizados](https://docs.stripe.com/invoicing/customize.md#custom-fields). 1. Clique em **Revisar fatura** e decida se deseja incluir e-mails adicionais ou continuar editando. Envie a fatura. ![](https://d37ugbyn3rpeym.cloudfront.net/videos/invoice-editor-net-price-supply-date.mp4) ### Create an invoice through the API You can create an invoice through the [Invoices API](https://docs.stripe.com/api/invoices.md). You need to create product, price, and customer before you create the invoice because you specify those values for the invoice and invoice items. Read the guide to understand all the steps for [integrating with the Invoicing API](https://docs.stripe.com/invoicing/integration.md). Or see the [quickstart](https://docs.stripe.com/invoicing/integration/quickstart.md) for an immersive, code-first experience. To create an invoice through the API, follow these steps: Defina o atributo [collection_method](https://docs.stripe.com/api/invoices/object.md#invoice_object-collection_method) como `send_invoice`. Para a Stripe marcar uma fatura como vencida, é preciso adicionar o parâmetro [days_until_due](https://docs.stripe.com/api/invoices/create.md#create_invoice-days_until_due). Quando você envia uma fatura, a Stripe envia ao cliente um e-mail com instruções de pagamento. #### Contas v2 ```curl curl https://api.stripe.com/v1/invoices \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d collection_method=send_invoice \ -d days_until_due=30 ``` #### Clientes v1 ```curl curl https://api.stripe.com/v1/invoices \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d collection_method=send_invoice \ -d days_until_due=30 ``` Em seguida, crie um item da fatura informando o ID do cliente, o `preço` do produto e o ID da `fatura`. O número máximo de itens da fatura é 250. #### Contas v2 ```curl curl https://api.stripe.com/v1/invoiceitems \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d "pricing[price]={{PRICE_ID}}" \ -d "invoice={{INVOICE_ID}}" ``` #### Clientes v1 ```curl curl https://api.stripe.com/v1/invoiceitems \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d "pricing[price]={{PRICE_ID}}" \ -d "invoice={{INVOICE_ID}}" ``` Se você definir `auto_advance` como `false`, continue a modificar a fatura até [finalizá-la](https://docs.stripe.com/invoicing/integration/workflow-transitions.md). Para finalizar uma fatura provisória, use o Dashboard para pagá-la ou enviá-la ao cliente. Também é possível usar a API [Finalize](https://docs.stripe.com/api/invoices/finalize.md): ```curl curl -X POST https://api.stripe.com/v1/invoices/{{INVOICE_ID}}/finalize \ -u "<>:" ``` Se você criar uma fatura por engano, [anule-a](https://docs.stripe.com/invoicing/overview.md#void). Também é possível marcar uma fatura como [incobrável](https://docs.stripe.com/invoicing/overview.md#uncollectible). ### Schedule recurring invoices If you want to set up a recurring invoice, create a subscription. You can choose how to collect payment: - Send an invoice to the customer. You can set the collection terms, including due date and accepted payment methods. - Automatically charge a saved payment method. If the customer has a saved payment method, Stripe automatically charges that method. In the Dashboard, you configure payment collection in the subscription editor. In the API, you configure payment collection with the [collection_method](https://docs.stripe.com/api/subscriptions/create.md#create_subscription-collection_method) parameter. You can also configure Stripe to send customers [reminder emails about unpaid recurring invoices](https://docs.stripe.com/billing/revenue-recovery/customer-emails.md#unpaid-recurring-invoice-reminders). Stripe automatically generates an invoice for each [billing cycle](https://docs.stripe.com/billing/subscriptions/billing-cycle.md) in a subscription. Learn more about the [invoice lifecycle for subscriptions](https://docs.stripe.com/billing/invoices/subscription.md#sub-invoice-lifecycle). ## Split purchases into a few payments Offer your customers payment plans in installments with [Subscription Schedules API](https://docs.stripe.com/api/subscription_schedules.md) (part of Stripe Billing) or buy now, pay later methods. If your business is based in Mexico, you can offer card payments in installments. ### Create an installment plan with Subscription Schedules Os planos parcelados permitem que os clientes façam pagamentos parciais por um determinado período até que o valor total seja pago. Por exemplo, quando o Pacific compra novas impressoras rotativas, vende as impressoras usadas para outras publicações. Publicações menores dificilmente têm fundos suficientes para pagar antecipadamente uma impressora rotativa e pagam usando um plano parcelado. Para a maioria das impressoras, o Pacific cobra US$ 1.000 por mês. Logo, é criado um preço reutilizável: ```curl curl https://api.stripe.com/v1/prices \ -u "<>:" \ -d unit_amount=100000 \ -d currency=usd \ -d product=prod_Hh99apo1OViyGW \ -d "recurring[interval]=month" ``` O Pacific cobra valores diferentes de acordo com a marca, modelo e tempo de uso da impressora. Este exemplo cobra US$ 1.000 por mês durante 6 meses, totalizando US$ 6.000. #### Contas v2 ```curl curl https://api.stripe.com/v1/subscription_schedules \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d start_date=now \ -d end_behavior=cancel \ -d "phases[0][items][0][price]={{PRICE_ID}}" \ -d "phases[0][items][0][quantity]=1" \ -d "phases[0][iterations]=6" ``` #### Clientes v1 ```curl curl https://api.stripe.com/v1/subscription_schedules \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d start_date=now \ -d end_behavior=cancel \ -d "phases[0][items][0][price]={{PRICE_ID}}" \ -d "phases[0][items][0][quantity]=1" \ -d "phases[0][iterations]=6" ``` O número de `iterations` é multiplicado pelo intervalo do preço (neste exemplo, 6 pagamentos mensais) para determinar o número de cobranças do cliente. `end_behavior` determina o que acontece com a assinatura após a conclusão da última iteração. Em um plano parcelado, a assinatura não é mais necessária. Portanto, `end_behavior` é definido como `cancel`. Muito raramente, o Pacific cobra menos do que os US$ 1.000 habituais por mês. Nesses casos, a empresa usa `price_data` para criar um preço de uso único. Este exemplo cria um preço de US$ 500 e cobra mensalmente por 6 meses: #### Contas v2 ```curl curl https://api.stripe.com/v1/subscription_schedules \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d start_date=now \ -d end_behavior=cancel \ -d "phases[0][items][0][price_data][currency]=usd" \ -d "phases[0][items][0][price_data][product]=prod_Hh99apo1OViyGW" \ -d "phases[0][items][0][price_data][recurring][interval]=month" \ -d "phases[0][items][0][price_data][unit_amount]=50000" \ -d "phases[0][items][0][quantity]=1" \ -d "phases[0][iterations]=6" ``` #### Clientes v1 ```curl curl https://api.stripe.com/v1/subscription_schedules \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d start_date=now \ -d end_behavior=cancel \ -d "phases[0][items][0][price_data][currency]=usd" \ -d "phases[0][items][0][price_data][product]=prod_Hh99apo1OViyGW" \ -d "phases[0][items][0][price_data][recurring][interval]=month" \ -d "phases[0][items][0][price_data][unit_amount]=50000" \ -d "phases[0][items][0][quantity]=1" \ -d "phases[0][iterations]=6" ``` ### Use a buy now, pay later payment method Stripe supports several different buy now, pay later methods. These methods let customers pay in installments over time. You’re paid immediately and in full. Your customers pay nothing or only a portion of the total purchase. Buy now, pay later methods help retailers boost conversion, increase average cart size, and reach new customers who don’t have credit cards. [Learn more about buy now, pay later methods](https://docs.stripe.com/payments/buy-now-pay-later.md) ### Accept card payments in installments (Only available in Mexico) If your business is based in Mexico, you can offer your customers installments for card payments, or [meses sin intereses](https://docs.stripe.com/payments/meses-sin-intereses/accept-a-payment.md). Using this method [adds an additional fee](https://docs.stripe.com/payments/mx-installments.md#fees) to the standard credit card transaction fee. Accept installments with a Stripe-hosted checkout page ([Stripe Checkout](https://docs.stripe.com/payments/meses-sin-intereses/accept-a-payment.md?platform=web&ui=stripe-hosted)), prebuilt UI components ([Stripe Elements](https://docs.stripe.com/payments/meses-sin-intereses/accept-a-payment.md?platform=web&ui=direct-api)), the [Invoicing API](https://docs.stripe.com/payments/meses-sin-intereses/accept-a-payment.md?platform=web&ui=invoices), or through [Payment Links](https://docs.stripe.com/payments/meses-sin-intereses/accept-a-payment.md?platform=no-code) with no code. Some [connectors and plugins](https://docs.stripe.com/payments/mx-installments.md#connectors-and-plugins) also support installments. #### Requirements for meses sin interes Há restrições sobre quais transações e cartões podem usar meses sin intereses. Você não precisa implementar essas regras por conta própria. A Stripe determina automaticamente a qualificação dos meses sin intereses depois que você configura a forma de pagamento. - A Stripe só aceita parcelamento para contas da Stripe Mexico. - A forma de pagamento precisa ser um cartão de crédito emitido no México. - O cartão precisa ser de consumidor. Não é possível fazer parcelamento em cartões corporativos. - O cartão precisa ser emitido por um dos nossos [emissores aceitos](https://docs.stripe.com/payments/mx-installments.md#supported-cards). - O valor da moeda precisa ser MXN (pesos). - O valor total do pagamento precisa ser superior a um [valor mínimo de transação](https://docs.stripe.com/payments/mx-installments.md#fees). A Stripe fornece um valor mínimo de transação de acordo com o número de meses do plano selecionado. Você pode especificar os planos de parcelamento que deseja habilitar e definir seus próprios valores mínimos e máximos de transação personalizados [definindo as configurações de parcelas personalizadas](https://docs.stripe.com/payments/meses-sin-intereses/accept-a-payment.md#custom-settings) no Dashboard. ## Enable customers to manage their own subscriptions If you want your customers to manage their own accounts and recurring subscriptions, use the customer portal. Stripe hosts the customer portal, which allows your customers to self-manage their payment details, download invoices, and manage their subscriptions in one place. Read the [no-code customer portal guide](https://docs.stripe.com/customer-management/activate-no-code-customer-portal.md) for complete details. [Integrate with the customer portal API](https://docs.stripe.com/customer-management/integrate-customer-portal.md) ### Configurar o portal de clientes 1. In the Stripe Dashboard, activate the customer portal link on the [customer portal settings page](https://dashboard.stripe.com/settings/billing/portal). 1. On the same page, go through the configuration options for the customer portal. [Set up the customer portal without writing any code](https://docs.stripe.com/customer-management/activate-no-code-customer-portal.md). Learn more about all the [configuration options](https://docs.stripe.com/customer-management/configure-portal.md). 1. Share the portal link with your customers. 1. (Opcional) Customize the branding and prefill email addresses by adding the `prefilled_email` URL parameter to the portal link. ![](https://d37ugbyn3rpeym.cloudfront.net/videos/customer_portal/PortalFunctionalityTrimmed.mp4) [Ver demonstração](https://billing.stripe.com/customer-portal-demo) ## Accept recurring donations You can accept recurring donations with Stripe, in the same way as recurring payments. For example, you have a llama rescue organization, Llama House, and want to allow supporters to choose an amount for a recurring, monthly donation. You can use Payment Links to create a link to share on social media and email. From the same payment link, you can also generate a QR code to add to flyers, and an embeddable buy button for your website–all from the Dashboard. ### Accept recurring donations with Payment Links 1. In the Stripe Dashboard, [create a payment link](https://dashboard.stripe.com/test/payment-links/create). 1. Select **Products or subscriptions**. 1. Find or add a recurring product that represents the recurring donation. 1. Under **Advanced options**, toggle the call to action option to **Donate**. 1. Create the link and share it. You can share the link directly, embed it as a button on your site, or generate a QR code. 1. Track payments associated with the payment link in the [payments overview in the Dashboard](https://dashboard.stripe.com/payments). Learn more about [creating](https://docs.stripe.com/payment-links/create.md) and [sharing](https://docs.stripe.com/payment-links/share.md) payment links. ## Migrate existing subscriptions to Stripe If you have existing subscriptions in another system, you can migrate them to Stripe Billing. Read [the guide](https://docs.stripe.com/billing/subscriptions/migrate-subscriptions.md) for more information. ## See also - [Get an overview of subscriptions](https://docs.stripe.com/billing.md) - [Create a payment link](https://docs.stripe.com/payment-links/create.md) - [Get started with no-code invoices](https://docs.stripe.com/invoicing/no-code-guide.md) - [Save payment details during a payment to set up future payments](https://docs.stripe.com/payments/save-during-payment.md) - [Save card details to set up future payments](https://docs.stripe.com/payments/save-and-reuse.md)