# Configure uma assinatura com o débito automático SEPA Saiba como criar e cobrar uma assinatura com o débito automático SEPA. # Página hospedada > This is a Página hospedada for when platform is web and payment-ui is stripe-hosted. View the full page at https://docs.stripe.com/billing/subscriptions/sepa-debit?platform=web&payment-ui=stripe-hosted. Confira o [exemplo no GitHub](https://github.com/stripe-samples/checkout-single-subscription) ou explore a [demonstração](https://checkout.stripe.dev/checkout). Uma [sessão do Checkout](https://docs.stripe.com/api/checkout/sessions.md) representa os detalhes da intenção do cliente de fazer a compra. Você cria uma sessão do Checkout quando seu cliente quer iniciar uma *assinatura* (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). Após redirecionar seu cliente para uma sessão do Checkout, a Stripe apresenta um formulário de pagamento onde seu cliente pode concluir a compra. Assim que o cliente tiver finalizado uma compra, ele é redirecionado de volta para o seu site. ## Configurar a Stripe [Lado do servidor] Instale o cliente Stripe de sua escolha: #### Ruby ```bash # Available as a gem sudo gem install stripe ``` ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` Instale a Stripe CLI (opcional). A CLI fornece [testes de webhook](https://docs.stripe.com/webhooks.md#test-webhook) e você pode executá-la para criar produtos e preços. Para obter opções de instalação adicionais, consulte [Comece a usar o Stripe CLI](https://docs.stripe.com/stripe-cli.md). ## Criar o modelo de preços [Dashboard] [Stripe CLI] [Modelos de planos de preços recorrentes](https://docs.stripe.com/products-prices/pricing-models.md) representam os produtos ou serviços que você vende, quanto custam, quais moedas você aceita para pagamentos e o período de serviço para assinaturas. Para montar o modelo de preços, crie [produtos](https://docs.stripe.com/api/products.md) (o que você vende) e [ preços](https://docs.stripe.com/api/prices.md) (quanto e com que frequência cobrar pelos seus produtos). Este exemplo utiliza um plano de preços de taxa fixa com duas opções de nível de serviço diferentes: básico e premium. Para cada opção de nível de serviço, você precisa criar um produto e um preço recorrente. Para adicionar uma cobrança pontual, como uma tarifa de abertura, crie um terceiro produto com um preço pontual. Cada produto fatura em intervalos mensais. O preço do produto básico é 5 EUR. O preço do produto premium é 15 EUR. Consulte o guia de [plano de preços de taxa fixa](https://docs.stripe.com/subscriptions/pricing-models/flat-rate-pricing.md) para ver um exemplo com três níveis. #### Dashboard Acesse a página [Adicionar um produto](https://dashboard.stripe.com/test/products/create) e crie dois produtos. Adicione um preço para cada produto, cada um com um período de faturamento mensal recorrente: - Produto premium: serviço premium com recursos extras - Preço: Tarifa fixa | 15 EUR - Produto básico: serviço básico com recursos mínimos - Preço: Tarifa fixa | 5 EUR Depois de criar os preços, registre o ID deles para utilizá-los em outras etapas. Os IDs de preço têm esta estrutura: `price_G0FvDp6vZvdwRZ`. Quando tudo estiver pronto, use o botão **Copiar para modo de produção**, no canto superior direito, para clonar seu produto de [uma área restrita para o modo de produção](https://docs.stripe.com/keys.md#test-live-modes). #### API Você pode usar a API para criar os [produtos](https://docs.stripe.com/api/products.md) e os [ preços](https://docs.stripe.com/api/prices.md). Criar o produto premium: ```curl curl https://api.stripe.com/v1/products \ -u "<>:" \ --data-urlencode "name=Billing Guide: Premium Service" \ -d "description=Premium service with extra features" ``` Criar o produto básico: ```curl curl https://api.stripe.com/v1/products \ -u "<>:" \ --data-urlencode "name=Billing Guide: Basic Service" \ -d "description=Basic service with minimum features" ``` Registre os IDs de cada produto. Eles têm esta estrutura: ```json { "id": "prod_H94k5odtwJXMtQ", "object": "product", "active": true, "attributes": [ ], "created": 1587577341, "description": "Premium service with extra features", "images": [ ], "livemode": false, "metadata": { }, "name": "Billing Guide: Premium Service", "statement_descriptor": null, "type": "service", "unit_label": null, "updated": 1587577341 } ``` Use os IDs de produto para criar um preço para cada produto. O número [unit_amount](https://docs.stripe.com/api/prices/object.md#price_object-unit_amount) está em centavos. Por exemplo, `1500` = 15 EUR. Criar o preço premium: ```curl curl https://api.stripe.com/v1/prices \ -u "<>:" \ -d product={{PREMIUM_PRODUCT_ID}} \ -d unit_amount=1500 \ -d currency=usd \ -d "recurring[interval]=month" ``` Criar o preço básico: ```curl curl https://api.stripe.com/v1/prices \ -u "<>:" \ -d product={{BASIC_PRODUCT_ID}} \ -d unit_amount=500 \ -d currency=usd \ -d "recurring[interval]=month" ``` Registre os IDs de cada preço, para que possam ser usados em etapas subsequentes. Eles têm esta estrutura: ```json { "id": "price_HGd7M3DV3IMXkC", "object": "price", "product": "prod_HGd6W1VUqqXGvr", "type": "recurring", "currency": "eur", "recurring": { "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed" }, "active": true, "billing_scheme": "per_unit", "created": 1589319695, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "unit_amount": 1500, "unit_amount_decimal": "1500", "tiers": null, "tiers_mode": null, "transform_quantity": null } ``` Para outros modelos de preços, consulte os [exemplos de faturamento](https://docs.stripe.com/products-prices/pricing-models.md). ## Criar uma sessão do Checkout [Do lado do cliente] [Lado do servidor] Adicione um botão de checkout ao seu site para chamar um endpoint do lado do servidor e criar uma Sessão do Checkout. ```html Checkout
``` ### Parâmetros da sessão do Checkout Consulte [Criar uma sessão do Checkout](https://docs.stripe.com/api/checkout/sessions/create.md) para ver a lista completa de parâmetros que podem ser usados. Crie uma sessão do Checkout com o ID de um *Preço* (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) existente. Certifique-se de que o modo esteja definido como `subscription` e você passe pelo menos um preço recorrente. Você pode adicionar preços avulsos além de preços recorrentes. Depois de criar a sessão do Checkout, redirecione o cliente para o [URL](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-url) retornado na resposta. #### cURL ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[][price]"="{{PRICE_ID}}" \ -d "line_items[][quantity]"=1 \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ ``` Quando o cliente finaliza um pagamento, é redirecionado para o `success_url`, uma página no seu site que informa ao cliente que o pagamento foi bem-sucedido. Disponibilize o ID da sessão na página de sucesso incluindo a variável de modelo `{CHECKOUT_SESSION_ID}` no `success_url` como no exemplo acima. Se o cliente clicar no seu logotipo durante uma sessão de Checkout sem finalizar o pagamento, o Checkout o redirecionará de volta para a página do seu site visitada antes do redirecionamento para o Checkout. As Sessões do Checkout expiram 24 horas após a criação por padrão. No [Dashboard](https://dashboard.stripe.com/settings/payment_methods), ative as formas de pagamento que deseja aceitar de seus clientes. O checkout aceita [várias formas de pagamento](https://docs.stripe.com/payments/payment-methods/payment-method-support.md#product-support). > Não confie apenas no redirecionamento para a `success_url` para detectar o início do pagamento, porque: > > - Usuários mal-intencionados podem acessar diretamente o `success_url` sem pagar e acessar seus produtos ou serviços. - Após um pagamento bem-sucedido, os clientes podem fechar a aba do navegador antes de serem redirecionados para a `success_url`. ## Confirmar a finalização do pagamento Quando o cliente conclui um pagamento, a Stripe o redireciona para o URL que você especificou no parâmetro `success_url`. Normalmente, é uma página no site que informa seu cliente de que o pagamento foi bem-sucedido. No entanto, é um método de notificação posterior pagamento, o que significa que fundos não estão imediatamente disponíveis. Por isso, atrase o pedido*fulfillment* (Fulfillment is the process of providing the goods or services purchased by a customer, typically after payment is collected) até que os fundos estejam disponíveis. Após o pagamento ser bem-sucedido, o status subjacente *PaymentIntent* (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) muda de`processando` para`sucedido`. Você pode confirmar a realização do pagamento de várias maneiras: #### Dashboard Pagamentos concluídos aparecem na [lista de pagamentos](https://dashboard.stripe.com/payments) do Dashboard. Ao selecionar um pagamento, você é direcionado à página com os detalhes desse pagamento. A seção **Checkout summary** inclui as informações de faturamento e a relação de itens adquiridos, que podem ser usadas para executar o pedido manualmente. ![](https://b.stripecdn.com/docs-statics-srv/assets/source.16d3029596357c80a8efdbbfe106108a.png) > A Stripe ajuda você a acompanhar a entrada de pagamentos com o envio de notificações por e-mail sempre que um cliente efetua um. Use o Dashboard para [configurar notificações por e-mail](https://dashboard.stripe.com/settings/user). #### Webhooks Enviamos os eventos de Checkout abaixo sempre que o status do pagamento sofre alguma alteração: | Nome do evento | Descrição | Próximas etapas | | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | [checkout.session.completed](https://docs.stripe.com/api/events/types.md#event_types-checkout.session.completed) | O cliente autorizou o pagamento por débito enviando o formulário do Checkout. | Aguarde a confirmação ou falha do pagamento. | | [checkout.session.async_payment_succeeded](https://docs.stripe.com/api/events/types.md#event_types-checkout.session.async_payment_succeeded) | O método de pagamento atrasado foi bem-sucedido. | Execute o pedido de mercadorias ou serviços do cliente. | | [checkout.session.async_payment_failed](https://docs.stripe.com/api/events/types.md#event_types-checkout.session.async_payment_failed) | O método de pagamento atrasado acabou falhando. | Envie um e-mail ao cliente pedindo que ele tente realizar o pagamento novamente. | | [invoice.paid](https://docs.stripe.com/api/events/types.md#event_types-invoice.paid) | O pagamento do cliente foi confirmado. | Execute o pedido de mercadorias ou serviços do cliente. | | [invoice.payment_failed](https://docs.stripe.com/api/events/types.md#event_types-invoice.payment_failed) | O pagamento do cliente foi recusado ou houve outro erro. | Entre em contato com o cliente por e-mail e solicite que seja feita uma nova tentativa de pagamento. | Seu Webhook precisa suportar com todos esses eventos de checkout. Cada conteúdo de webhook do Checkout contém o [objeto Checkout Session](https://docs.stripe.com/api/checkout/sessions.md), e os webhooks de fatura contêm o objeto [Invoice](https://docs.stripe.com/api/invoices/object.md). Ambos contêm informações sobre o *Cliente* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) e o *PaymentIntent* (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). A Stripe envia o webhook `checkout.session.completed` ao seu servidor antes de redirecionar o cliente. O reconhecimento do webhook (qualquer código de status `2xx`) aciona o redirecionamento do cliente para o `success_url`. Se a Stripe não receber o reconhecimento correto em 10 segundos após um pagamento bem-sucedido, o cliente é automaticamente redirecionado para a página `success_url`. Recomendamos [usar webhooks](https://docs.stripe.com/webhooks.md) para confirmar que o pagamento foi realizado e processar os produtos ou serviços comprados pelo cliente. Veja a seguir um exemplo de endpoint de webhook que gerencia a efetivação ou não de um pagamento. #### 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('<>') # You can find your endpoint's secret in your webhook settings endpoint_secret = 'whsec_...' # Using Sinatra post '/webhook' do payload = request.body.read event = nil # Verify webhook signature and extract the event # See https://stripe.com/docs/webhooks#verify-events for more information. sig_header = request.env['HTTP_STRIPE_SIGNATURE'] begin event = Stripe::Webhook.construct_event( payload, sig_header, endpoint_secret ) rescue JSON::ParserError => e # Invalid payload status 400 return rescue Stripe::SignatureVerificationError => e # Invalid signature status 400 return end case event['type'] when 'checkout.session.completed' session = event['data']['object'] subscription_id = session.subscription # Find the subscription or save it to your database. # invoice.paid may have fired before this so there # could already be a subscription. find_or_create_subscription(subscription_id) when 'invoice.paid' invoice = event['data']['object'] subscription_id = invoice.parent.subscription_details.subscription # Find the subscription or save it to your database. # checkout.session.completed may not have fired yet # so we may need to create the subscription. subscription = find_or_create_subscription(subscription_id) # Fulfill the purchase fulfill_order(invoice) # Record that the subscription has been paid for # this payment period. invoice.paid will fire every # time there is a payment made for this subscription. record_as_paid_for_this_period(subscription) when 'invoice.payment_failed' invoice = event['data']['object'] # Send an email to the customer asking them to retry their payment email_customer_about_failed_payment(invoice) end status 200 end ``` As informações sobre o cliente, o pagamento ou a assinatura podem ser obtidas acessando os objetos `Customer`, `PaymentIntent` ou `Subscription`, referenciados pelas propriedades `customer`, `payment_intent` e `subscription` no conteúdo do Webhook. ### Recuperar itens de linha do webhook Por padrão, os webhooks do Checkout não retornam `line_items`. Para recuperar os itens criados com a sessão do Checkout, faça uma solicitação adicional com o ID da sessão do Checkout: #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions/{{CHECKOUT_SESSION_ID}}/line_items \ -u <>: ``` #### Stripe CLI ```bash stripe get /v1/checkout/sessions/{{CHECKOUT_SESSION_ID}}/line_items ``` ### Testar webhooks localmente Para testar webhooks localmente, você pode usar o [Stripe CLI](https://docs.stripe.com/stripe-cli.md). Após a instalação, você pode encaminhar eventos ao servidor: ```bash stripe listen --forward-to localhost:4242/webhook Ready! Your webhook signing secret is '{{WEBHOOK_SIGNING_SECRET}}' (^C to quit) ``` Saiba mais sobre [configuração de webhooks](https://docs.stripe.com/webhooks.md). #### Plugins de terceiros É possível usar plugins como o [Zapier](https://stripe.com/works-with/zapier) para automatizar a atualização dos sistemas responsáveis pela execução das compras usando as informações provenientes dos pagamentos processados pela Stripe. Alguns exemplos de automação aceitas por plugins incluem: - Atualizar planilhas usadas para acompanhamento de pedidos em resposta a pagamentos efetivados - Atualizar sistemas de gerenciamento de inventário em resposta a pagamentos efetivados - Acionar notificações a equipes internas de atendimento ao cliente usando e-mail ou aplicativos de conversa ## Testar a integração Você pode testar a integração usando os IBANs abaixo. Os dados da forma de pagamento são coletados para todos os IBANs, mas cada um deles terá um comportamento diferente na cobrança. ##### IBANs de teste Use estes IBANs de teste com o Payment Element para testar sua integração de débito automático SEPA. O Payment Element valida automaticamente o IBAN e exibe a instrução quando você informa um desses valores de teste. ### AT | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | AT611904300234573201 | pm_success_at | The PaymentIntent status transitions from `processing` to `succeeded`. | | AT321904300235473204 | pm_successDelayed_at | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | AT861904300235473202 | pm_failed_at | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | AT051904300235473205 | pm_failedDelayed_at | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | AT591904300235473203 | pm_disputed_at | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | AT981904300000343434 | pm_exceedsWeeklyVolumeLimit_at | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | AT601904300000121212 | pm_exceedsWeeklyTransactionLimit_at | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | AT981904300002222227 | pm_insufficientFunds_at | The payment fails with an `insufficient_funds` failure code. | ### BE | Account Number | Token | Description | | ---------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | BE62510007547061 | pm_success_be | The PaymentIntent status transitions from `processing` to `succeeded`. | | BE78510007547064 | pm_successDelayed_be | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | BE68539007547034 | pm_failed_be | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | BE51510007547065 | pm_failedDelayed_be | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | BE08510007547063 | pm_disputed_be | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | BE90510000343434 | pm_exceedsWeeklyVolumeLimit_be | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | BE52510000121212 | pm_exceedsWeeklyTransactionLimit_be | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | BE90510002222227 | pm_insufficientFunds_be | The payment fails with an `insufficient_funds` failure code. | ### HR | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | HR7624020064583467589 | pm_success_hr | The PaymentIntent status transitions from `processing` to `succeeded`. | | HR6323600002337876649 | pm_successDelayed_hr | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | HR2725000096983499248 | pm_failed_hr | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | HR6723600004878117427 | pm_failedDelayed_hr | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | HR8724840081455523553 | pm_disputed_hr | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | HR7424020060000343434 | pm_exceedsWeeklyVolumeLimit_hr | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | HR3624020060000121212 | pm_exceedsWeeklyTransactionLimit_hr | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | HR7424020060002222227 | pm_insufficientFunds_hr | The payment fails with an `insufficient_funds` failure code. | ### EE | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | EE382200221020145685 | pm_success_ee | The PaymentIntent status transitions from `processing` to `succeeded`. | | EE222200221020145682 | pm_successDelayed_ee | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | EE762200221020145680 | pm_failed_ee | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | EE922200221020145683 | pm_failedDelayed_ee | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | EE492200221020145681 | pm_disputed_ee | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | EE672200000000343434 | pm_exceedsWeeklyVolumeLimit_ee | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | EE292200000000121212 | pm_exceedsWeeklyTransactionLimit_ee | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | EE672200000002222227 | pm_insufficientFunds_ee | The payment fails with an `insufficient_funds` failure code. | ### FI | Account Number | Token | Description | | ------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | FI2112345600000785 | pm_success_fi | The PaymentIntent status transitions from `processing` to `succeeded`. | | FI3712345600000788 | pm_successDelayed_fi | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | FI9112345600000786 | pm_failed_fi | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | FI1012345600000789 | pm_failedDelayed_fi | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | FI6412345600000787 | pm_disputed_fi | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | FI6712345600343434 | pm_exceedsWeeklyVolumeLimit_fi | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | FI2912345600121212 | pm_exceedsWeeklyTransactionLimit_fi | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | FI6712345602222227 | pm_insufficientFunds_fi | The payment fails with an `insufficient_funds` failure code. | ### FR | Account Number | Token | Description | | --------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | FR1420041010050500013M02606 | pm_success_fr | The PaymentIntent status transitions from `processing` to `succeeded`. | | FR3020041010050500013M02609 | pm_successDelayed_fr | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | FR8420041010050500013M02607 | pm_failed_fr | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | FR7920041010050500013M02600 | pm_failedDelayed_fr | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | FR5720041010050500013M02608 | pm_disputed_fr | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | FR9720041010050000000343434 | pm_exceedsWeeklyVolumeLimit_fr | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | FR5920041010050000000121212 | pm_exceedsWeeklyTransactionLimit_fr | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | FR9720041010050000002222227 | pm_insufficientFunds_fr | The payment fails with an `insufficient_funds` failure code. | ### DE | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | DE89370400440532013000 | pm_success_de | The PaymentIntent status transitions from `processing` to `succeeded`. | | DE08370400440532013003 | pm_successDelayed_de | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | DE62370400440532013001 | pm_failed_de | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | DE78370400440532013004 | pm_failedDelayed_de | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | DE35370400440532013002 | pm_disputed_de | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | DE65370400440000343434 | pm_exceedsWeeklyVolumeLimit_de | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | DE27370400440000121212 | pm_exceedsWeeklyTransactionLimit_de | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | DE65370400440002222227 | pm_insufficientFunds_de | The payment fails with an `insufficient_funds` failure code. | ### GI | Account Number | Token | Description | | ----------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | GI60MPFS599327643783385 | pm_success_gi | The PaymentIntent status transitions from `processing` to `succeeded`. | | GI08RRNW626436291644533 | pm_successDelayed_gi | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | GI41SAFA461293238477751 | pm_failed_gi | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | GI50LROG772261344693297 | pm_failedDelayed_gi | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | GI26KJBC361883934534696 | pm_disputed_gi | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | GI14NWBK000000000343434 | pm_exceedsWeeklyVolumeLimit_gi | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | GI73NWBK000000000121212 | pm_exceedsWeeklyTransactionLimit_gi | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | GI14NWBK000000002222227 | pm_insufficientFunds_gi | The payment fails with an `insufficient_funds` failure code. | ### IE | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | IE29AIBK93115212345678 | pm_success_ie | The PaymentIntent status transitions from `processing` to `succeeded`. | | IE24AIBK93115212345671 | pm_successDelayed_ie | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | IE02AIBK93115212345679 | pm_failed_ie | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | IE94AIBK93115212345672 | pm_failedDelayed_ie | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | IE51AIBK93115212345670 | pm_disputed_ie | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | IE10AIBK93115200343434 | pm_exceedsWeeklyVolumeLimit_ie | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | IE69AIBK93115200121212 | pm_exceedsWeeklyTransactionLimit_ie | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | IE10AIBK93115202222227 | pm_insufficientFunds_ie | The payment fails with an `insufficient_funds` failure code. | ### LI | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LI0508800636123378777 | pm_success_li | The PaymentIntent status transitions from `processing` to `succeeded`. | | LI4408800387787111369 | pm_successDelayed_li | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LI1208800143823175626 | pm_failed_li | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LI4908800356441975566 | pm_failedDelayed_li | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LI7708800125525347723 | pm_disputed_li | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LI2408800000000343434 | pm_exceedsWeeklyVolumeLimit_li | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LI8308800000000121212 | pm_exceedsWeeklyTransactionLimit_li | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LI2408800000002222227 | pm_insufficientFunds_li | The payment fails with an `insufficient_funds` failure code. | ### LT | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LT121000011101001000 | pm_success_lt | The PaymentIntent status transitions from `processing` to `succeeded`. | | LT281000011101001003 | pm_successDelayed_lt | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LT821000011101001001 | pm_failed_lt | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LT981000011101001004 | pm_failedDelayed_lt | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LT551000011101001002 | pm_disputed_lt | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LT591000000000343434 | pm_exceedsWeeklyVolumeLimit_lt | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LT211000000000121212 | pm_exceedsWeeklyTransactionLimit_lt | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LT591000000002222227 | pm_insufficientFunds_lt | The payment fails with an `insufficient_funds` failure code. | ### LU | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LU280019400644750000 | pm_success_lu | The PaymentIntent status transitions from `processing` to `succeeded`. | | LU440019400644750003 | pm_successDelayed_lu | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LU980019400644750001 | pm_failed_lu | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LU170019400644750004 | pm_failedDelayed_lu | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LU710019400644750002 | pm_disputed_lu | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LU900010000000343434 | pm_exceedsWeeklyVolumeLimit_lu | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LU520010000000121212 | pm_exceedsWeeklyTransactionLimit_lu | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LU900010000002222227 | pm_insufficientFunds_lu | The payment fails with an `insufficient_funds` failure code. | ### NL | Account Number | Token | Description | | ------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | NL39RABO0300065264 | pm_success_nl | The PaymentIntent status transitions from `processing` to `succeeded`. | | NL55RABO0300065267 | pm_successDelayed_nl | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | NL91ABNA0417164300 | pm_failed_nl | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | NL28RABO0300065268 | pm_failedDelayed_nl | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | NL82RABO0300065266 | pm_disputed_nl | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | NL27RABO0000343434 | pm_exceedsWeeklyVolumeLimit_nl | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | NL86RABO0000121212 | pm_exceedsWeeklyTransactionLimit_nl | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | NL55RABO0300065267 | pm_insufficientFunds_nl | The payment fails with an `insufficient_funds` failure code. | ### NO | Account Number | Token | Description | | --------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | NO9386011117947 | pm_success_no | The PaymentIntent status transitions from `processing` to `succeeded`. | | NO8886011117940 | pm_successDelayed_no | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | NO6686011117948 | pm_failed_no | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | NO6186011117941 | pm_failedDelayed_no | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | NO3986011117949 | pm_disputed_no | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | NO0586010343434 | pm_exceedsWeeklyVolumeLimit_no | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | NO0586010343434 | pm_exceedsWeeklyTransactionLimit_no | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | NO0586012222227 | pm_insufficientFunds_no | The payment fails with an `insufficient_funds` failure code. | ### PT | Account Number | Token | Description | | ------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | PT50000201231234567890154 | pm_success_pt | The PaymentIntent status transitions from `processing` to `succeeded`. | | PT66000201231234567890157 | pm_successDelayed_pt | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | PT23000201231234567890155 | pm_failed_pt | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | PT39000201231234567890158 | pm_failedDelayed_pt | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | PT93000201231234567890156 | pm_disputed_pt | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | PT05000201230000000343434 | pm_exceedsWeeklyVolumeLimit_pt | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | PT64000201230000000121212 | pm_exceedsWeeklyTransactionLimit_pt | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | PT05000201230000002222227 | pm_insufficientFunds_pt | The payment fails with an `insufficient_funds` failure code. | ### ES | Account Number | Token | Description | | ------------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | ES0700120345030000067890 | pm_success_es | The PaymentIntent status transitions from `processing` to `succeeded`. | | ES2300120345030000067893 | pm_successDelayed_es | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | ES9121000418450200051332 | pm_failed_es | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | ES9300120345030000067894 | pm_failedDelayed_es | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | ES5000120345030000067892 | pm_disputed_es | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | ES1700120345000000343434 | pm_exceedsWeeklyVolumeLimit_es | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | ES7600120345000000121212 | pm_exceedsWeeklyTransactionLimit_es | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | ES1700120345000002222227 | pm_insufficientFunds_es | The payment fails with an `insufficient_funds` failure code. | ### SE | Account Number | Token | Description | | ------------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | SE3550000000054910000003 | pm_success_se | The PaymentIntent status transitions from `processing` to `succeeded`. | | SE5150000000054910000006 | pm_successDelayed_se | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | SE0850000000054910000004 | pm_failed_se | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | SE2450000000054910000007 | pm_failedDelayed_se | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | SE7850000000054910000005 | pm_disputed_se | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | SE2850000000000000343434 | pm_exceedsWeeklyVolumeLimit_se | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | SE8750000000000000121212 | pm_exceedsWeeklyTransactionLimit_se | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | SE2850000000000002222227 | pm_insufficientFunds_se | The payment fails with an `insufficient_funds` failure code. | ### CH | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | CH9300762011623852957 | pm_success_ch | The PaymentIntent status transitions from `processing` to `succeeded`. | | CH8656663438253651553 | pm_successDelayed_ch | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | CH5362200119938136497 | pm_failed_ch | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | CH1843597160341964438 | pm_failedDelayed_ch | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | CH1260378413965193069 | pm_disputed_ch | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | CH1800762000000343434 | pm_exceedsWeeklyVolumeLimit_ch | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | CH7700762000000121212 | pm_exceedsWeeklyTransactionLimit_ch | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | CH1800762000002222227 | pm_insufficientFunds_ch | The payment fails with an `insufficient_funds` failure code. | ### GB | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | GB82WEST12345698765432 | pm_success_gb | The PaymentIntent status transitions from `processing` to `succeeded`. | | GB98WEST12345698765435 | pm_successDelayed_gb | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | GB55WEST12345698765433 | pm_failed_gb | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | GB71WEST12345698765436 | pm_failedDelayed_gb | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | GB28WEST12345698765434 | pm_disputed_gb | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | GB70WEST12345600343434 | pm_exceedsWeeklyVolumeLimit_gb | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | GB32WEST12345600121212 | pm_exceedsWeeklyTransactionLimit_gb | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | GB70WEST12345602222227 | pm_insufficientFunds_gb | The payment fails with an `insufficient_funds` failure code. | ## Optional: Adicionar uma tarifa de configuração avulsa [Lado do servidor] Além de passar os preços recorrentes, é possível adicionar preços avulsos no modo `subscription`. Eles só são incluídos na *fatura* (Invoices are statements of amounts owed by a customer. They track the status of payments from draft through paid or otherwise finalized. Subscriptions automatically generate invoices, or you can manually create a one-off invoice) inicial criada pela assinatura. Isso é útil para adicionar tarifas de configuração ou tarifas avulsas associadas com uma assinatura. É possível adicionar um *preço* (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) avulso a um produto existente ou criar um *produto* (Products represent items your customer can subscribe to with a Subscription. An associated Price object describes the pricing and other terms of the subscription) com um novo preço. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[0][price]"="{{RECURRING_PRICE_ID}}" \ -d "line_items[0][quantity]"=1 \ -d "line_items[1][price]"="{{ONE_TIME_PRICE_ID}}" \ -d "line_items[1][quantity]"=1 \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" ``` ## Optional: Criar preços e produtos em linha [Lado do servidor] Além de passar os IDs de preço existentes, você pode criar novos preços na criação da sessão de Checkout. Primeiro, defina um *Product* (Products represent what your business sells—whether that's a good or a service) e depois crie uma Checkout Session usando o ID do produto. Certifique-se de passar[price_data](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-line_items-price_data) com o`unit_amount`, `moedas`, e detalhes `recorrentes`: #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"=sepa_debit \-d line_items[0][price_data][unit_amount]=5000 \ -d line_items[0][price_data][currency]=eur\ -d line_items[0][price_data][product]="{{PRODUCT_ID}}" \ -d line_items[0][price_data][recurring][interval]=month \ -d line_items[0][quantity]=1 \ -d mode=subscription \ -d success_url="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ ``` Se você também precisa criar produtos em linha, use [product_data](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-line_items-price_data-product_data): #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"=sepa_debit \-d "line_items[][price_data][currency]"=eur\ -d "line_items[][price_data][product_data][name]"=T-shirt \ -d "line_items[][price_data][unit_amount]"=2000 \ -d "line_items[][quantity]"=1 \ -d "mode"="subscription" \ -d success_url="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ ``` ## Optional: Clientes existentes [Lado do servidor] Se você já criou anteriormente um objeto Customer** para representar um cliente, use o[cliente](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer) argumento para passar o ID de Cliente ao criar uma sessão Checkout. Isso garante que todos os objetos criados durante a Sessão estejam associados ao objeto Customer correto. Quando você passa um ID de cliente, a Stripe também usa o e-mail armazenado no objeto Customer para preencher o campo de e-mail na página de checkout. Se o cliente trocar o e-mail na página de checkout, este será atualizado no objeto Customer quando o pagamento for concluído. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "customer"="{{CUSTOMER_ID}}" \ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[][price]"="{{PRICE_ID}}" \ -d "line_items[][quantity]"=1 \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success" ``` ## Optional: Preencher dados do cliente [Lado do servidor] Se você já coletou o e-mail do cliente e quer preenchê-lo antecipadamente na sessão de checkout, passe [customer_email](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-customer_email) ao criar uma sessão de checkout. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \-d customer_email="customer@example.com" \ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price]"="{{PRICE_ID}}" \ -d "line_items[][quantity]"=1 \ -d mode=subscription \ -d success_url="https://example.com/success" \ ``` ## Optional: Gerenciar períodos de avaliação [Lado do servidor] É possível usar [trial_end](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-trial_end) ou [trial_period_days](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-trial_period_days) na sessão do Checkout para especificar a duração do período de avaliação. Neste exemplo, usamos `trial_period_days` para criar uma sessão do Checkout para uma assinatura com um período de avaliação de 30 dias. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price]"="{{PRICE_ID}}" \ -d "line_items[][quantity]"=1 \-d "subscription_data[trial_period_days]"=30 \ -d mode=subscription \ -d success_url="https://example.com/success?session_id={CHECKOUT_SESSION_ID}" \ ``` O Checkout exibe as seguintes informações automaticamente para assinaturas com períodos de avaliação: - Período de avaliação - Frequência e valor das cobranças após o vencimento da avaliação Para mais informações sobre requisitos de conformidade, consulte os guias [Gerenciar requisitos de conformidade](https://docs.stripe.com/billing/subscriptions/trials/manage-trial-compliance.md) ou o [suporte](https://support.stripe.com/questions/2020-visa-trial-subscription-requirement-changes-guide). ## Optional: Alíquotas [Lado do servidor] Você pode especificar [alíquotas de impostos](https://docs.stripe.com/billing/taxes/tax-rates.md) (sobre vendas, IVA, GST e outros) nas sessões de checkout para aplicar impostos às *assinaturas* (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). - Use alíquotas fixas quando você souber qual a alíquota exata que deve ser cobrada dos clientes antes do início do checkout (por exemplo, você vende apenas para clientes no Reino Unido e sempre cobra 20% de IVA). - Com a API *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), você pode usar alíquotas dinâmicas quando precisar de mais dados do cliente (por exemplo, endereço de cobrança ou entrega) para determinar a alíquota a ser cobrada. As alíquotas dinâmicas podem ser atribuídas a regiões diferentes (por exemplo, uma alíquota de 20% de IVA para clientes no Reino Unido e uma alíquota de 7,25% sobre vendas para clientes na Califórnia). A Stripe tenta associar o local do cliente a uma dessas alíquotas. #### Alíquotas fixas Defina [subscription_data.default_tax_rates](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-default_tax_rates) para aplicar uma alíquota padrão a uma assinatura iniciada com o Checkout. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price]"="{{PRICE_ID}}" \ -d "line_items[][quantity]"=1 \-d "subscription_data[default_tax_rates][]"="{{TAX_RATE_ID}}" \ -d mode=subscription \ -d success_url="https://example.com/success" \ ``` Você também pode especificar [line_items.tax_rates](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-line_items-tax_rates) ou [subscription_data.items.tax_rates](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-items-tax_rates) para aplicar alíquotas de imposto a planos ou itens de linha de fatura específicos. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[][price]"="{{PRICE_ID}}" \ -d "line_items[][quantity]"=1 \-d "line_items[][tax_rates][0]"="{{TAX_RATE_ID}}" \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success" \ ``` #### Alíquotas dinâmicas Passe uma matriz de [alíquotas](https://docs.stripe.com/api/tax_rates/object.md) para [line_items.dynamic_tax_rates](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-line_items-dynamic_tax_rates). Cada alíquota deve ter um `country` (para os EUA, também um `state`) [aceito](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-line_items-dynamic_tax_rates). Esta lista associa alíquotas ao [endereço de entrega](https://docs.stripe.com/payments/collect-addresses.md), endereço de cobrança ou país do cliente. Para determinar a alíquota a ser cobrada, o endereço de entrega tem precedência sobre o endereço de cobrança. Quando você não coleta endereços de entrega ou cobrança, o país do cliente (e o código postal, se for o caso) é usado para determinar a alíquota. Se você não passou uma alíquota correspondente ao endereço de entrega, endereço de cobrança ou país do cliente, nenhuma alíquota é aplicada. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[][price]"="{{PRICE_ID}}" \ -d "line_items[][quantity]"=1 \-d "line_items[][dynamic_tax_rates][]"="{{FIRST_TAX_RATE_ID}}" \ -d "line_items[][dynamic_tax_rates][]"="{{SECOND_TAX_RATE_ID}}" \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success" \ ``` > [subscription_data.default_tax_rates](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-default_tax_rates) e [line_items.tax_rates](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-line_items-tax_rates) não podem ser usados em combinação com [line_items.dynamic_tax_rates](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-line_items-dynamic_tax_rates). Você pode usar as exportações de dados da Stripe para preencher as declarações periódicas necessárias para o repasse. Acesse [Declarações e remessas fiscais](https://docs.stripe.com/billing/taxes/tax-rates.md#remittance) para obter mais informações. ## Optional: Adicionar cupons [Lado do servidor] Você pode aplicar [cupons](https://docs.stripe.com/billing/subscriptions/coupons.md) a assinaturas em uma sessão do Checkout configurando [descontos](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-discounts). Este cupom substitui qualquer cupom no cliente. Se você estiver criando uma assinatura com um [cliente existente](https://docs.stripe.com/billing/subscriptions/sepa-debit.md#handling-existing-customers), qualquer cupom associado ao cliente é aplicado às *faturas* (Invoices are statements of amounts owed by a customer. They track the status of payments from draft through paid or otherwise finalized. Subscriptions automatically generate invoices, or you can manually create a one-off invoice) da assinatura. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"=sepa_debit \ -d "line_items[][price]"="{{PRICE_ID}}" \ -d "line_items[][quantity]"=1 \-d "discounts[][coupon]"="{{COUPON_ID}}" \ -d "mode"="subscription" \ -d success_url="https://example.com/success" \ ``` ### Adicionar códigos de promoção voltados para o cliente Também é possível ativar [códigos promocionais](https://docs.stripe.com/billing/subscriptions/coupons.md#promotion-codes) resgatáveis pelo usuário utilizando o parâmetro [allow_promotion_codes](https://docs.stripe.com/api/checkout/sessions/object.md#checkout_session_object-allow_promotion_codes) em sessões do Checkout. Com `allow_promotion_codes` ativado em uma sessão do Checkout, o Checkout inclui uma caixa de resgate de código de promoção para uso pelos clientes. Crie seus [cupons](https://docs.stripe.com/billing/subscriptions/coupons.md) e códigos promocionais no Dashboard ou na API para que seus clientes possam resgatá-los no Checkout. #### curl ```bash curl https://api.stripe.com/v1/checkout/sessions \ -u <>: \ -d "payment_method_types[]"="sepa_debit" \ -d "line_items[0][price_data][unit_amount]"=2000 \ -d "line_items[0][price_data][currency]"="eur" \ -d "line_items[0][price_data][product]={{PRODUCT_ID}}" \ -d "line_items[0][price_data][recurring][interval]=month" \ -d "line_items[0][quantity]"=1 \-d "allow_promotion_codes"="true" \ -d "mode"="subscription" \ -d "success_url"="https://example.com/success" \ ``` ## See also - [Personalizar sua integração](https://docs.stripe.com/payments/checkout/customization.md) - [Gerenciar assinaturas com o portal do cliente](https://docs.stripe.com/billing/subscriptions/build-subscriptions.md?payment-ui=checkout&ui=stripe-hosted) # Integração avançada > This is a Integração avançada for when platform is web and payment-ui is elements. View the full page at https://docs.stripe.com/billing/subscriptions/sepa-debit?platform=web&payment-ui=elements. Saiba como criar e cobrar uma *assinatura* (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) com o débito automático SEPA. > Se você é um usuário novo, use o[Payment Element](https://docs.stripe.com/payments/payment-element.md) em vez de usar Stripe Elements como descrito neste guia. O Payment Element oferece um caminho de integração low-code com otimizações de conversão integradas. Para instruções, veja[Criar uma assinatura](https://docs.stripe.com/billing/subscriptions/build-subscriptions.md?payment-ui=elements). ## Criar produto e preço [Dashboard] [Produtos](https://docs.stripe.com/api/products.md) representam o item ou serviço que você está vendendo. [Preços](https://docs.stripe.com/api/prices.md) definem quanto e com que frequência você cobra por um produto. Você estabelece quanto custa o produto, qual moeda você aceita e se a cobrança é avulsa ou recorrente. Se você tiver apenas alguns produtos e preços, crie e gerencie-os no Dashboard. Este guia usa um serviço de banco de imagens como exemplo e cobra dos clientes uma assinatura mensal de 15 EUR. Para modelar isso: 1. Vá para a página [Produtos](https://dashboard.stripe.com/products?active=true) e clique em **Criar produto**. 1. Insira um **Nome** para o produto. Opcionalmente, você pode adicionar uma **Descrição** e fazer o upload de uma imagem do produto. 1. Selecione um **Código fiscal de produto**. Saiba mais sobre [códigos fiscais de produto](https://docs.stripe.com/tax/tax-codes.md). 1. Selecione **Recorrente**. Em seguida, insira **15** como preço e selecione **EUR** como moeda. 1. Escolha se deseja **Incluir imposto no preço**. Você pode usar o valor padrão das suas [configurações fiscais](https://dashboard.stripe.com/test/settings/tax) ou definir o valor manualmente. Neste exemplo, selecione **Automático**. 1. Em **Período de faturamento**, selecione **Mensal**. 1. Clique em **Mais opções de planos de preços**. Em seguida, selecione **Taxa fixa** como o modelo de preço para este exemplo. Saiba mais sobre [taxa fixa](https://docs.stripe.com/products-prices/pricing-models.md#flat-rate) e outros [modelos de planos de preços](https://docs.stripe.com/products-prices/pricing-models.md). 1. Adicione uma **Descrição de preço** interna e uma [Chave de pesquisa](https://docs.stripe.com/products-prices/manage-prices.md#lookup-keys) para organizar, consultar e atualizar preços específicos no futuro. 1. Clique em **Próximo**. Em seguida, clique em **Adicionar produto**. Depois de criar o produto e o preço, registre o ID do preço para utilizá-lo nas etapas subsequentes. A página de preços exibe o ID, que tem esta estrutura: `price_G0FvDp6vZvdwRZ`. ## Criar um cliente [Lado do servidor] Uma assinatura precisa de um *cliente* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) para que possa reutilizar formas de pagamento e acompanhar pagamentos recorrentes. Crie um objeto `Customer` quando seu cliente criar uma conta com sua empresa. ```curl curl -X POST https://api.stripe.com/v1/customers \ -u "<>:" ``` ## Criar a assinatura [Lado do servidor] Crie a *assinatura* (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) usando os IDs de cliente e de preço. Devolva no lado do cliente o `client_secret` do [confirmation_secret.client_secret](https://docs.stripe.com/api/invoices/object.md#invoice_object-confirmation_secret) da última fatura ou, para assinaturas que não cobram um pagamento antecipado, o [pending_setup_intent](https://docs.stripe.com/api/subscriptions/object.md#subscription_object-pending_setup_intent). Além disso, defina: - Defina [payment_behavior](https://docs.stripe.com/api/subscriptions/create.md#create_subscription-payment_behavior) como `default_incomplete` para simplificar a coleta da instrução de débito automático SEPA. - Use [save_default_payment_method](https://docs.stripe.com/api/subscriptions/object.md#subscription_object-payment_settings-save_default_payment_method) para `on_subscription` para salvar a forma de pagamento como o padrão para a assinatura quando o pagamento for bem-sucedido. Salvar uma forma de pagamento padrão aumenta o sucesso de futuros pagamentos de assinatura. #### Rubi ```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('<>') post '/create-subscription' do content_type 'application/json' data = JSON.parse(request.body.read) customer_id = cookies[:customer] price_id = data['priceId'] subscription = client.v1.subscriptions.create( customer: customer_id, items: [{ price: price_id, }], payment_behavior: 'default_incomplete', payment_settings: {save_default_payment_method: 'on_subscription'}, expand: ['latest_invoice.confirmation_secret', 'pending_setup_intent'] ) if subscription.pending_setup_intent != nil { type: 'setup', clientSecret: subscription.pending_setup_intent.client_secret }.to_json else { type: 'payment', clientSecret: subscription.latest_invoice.confirmation_secret.client_secret }.to_json end end ``` ## Coletar detalhes de forma de pagamento e reconhecimento de mandato [Lado do cliente] Você já pode coletar dados de pagamento do cliente com o [Stripe Elements](https://docs.stripe.com/payments/elements.md). O Elements é um conjunto de componentes de IU pré-integrados para coletar dados de pagamento. Um Stripe Element contém um iframe que envia com segurança os dados de pagamento para a Stripe por uma conexão HTTPS. O endereço da página de checkout também deve iniciar com https://, e não http://, para que sua integração funcione. Você pode testar sua integração sem usar HTTPS. [Habilite-o](https://docs.stripe.com/security/guide.md#tls) quando estiver pronto para aceitar pagamentos no modo de produção. ### Configurar o Stripe Elements #### HTML + JS O Stripe Elements é disponibilizado automaticamente como recurso do script Stripe.js, que deve ser inserido em sua página de pagamento no `head` do arquivo HTML. Sempre carregue o Stripe.js diretamente de js.stripe.com para manter a conformidade com o PCI. Não insira o script em um pacote nem hospede sua própria cópia. ```html Submit Payment ``` Crie uma instância de Elements com o JavaScript abaixo na sua página de pagamento. Informe `mode` e `currency` para permitir que o Payment Element recolha detalhes de pagamento do débito automático SEPA: ```javascript const stripe = Stripe('<>'); const options = { mode: 'setup', currency: 'eur', }; const elements = stripe.elements(options); ``` ### Adicionar o Payment Element O Payment Element precisa de um lugar no seu formulário de pagamento. Crie um nó DOM vazio (container) com um ID exclusivo no seu formulário. O Payment Element exibe automaticamente o formulário de débito automático SEPA e o texto de aceitação da instrução quando o débito automático SEPA estiver habilitado: ```html
``` Quando o formulário carregar, [crie uma instância](https://docs.stripe.com/js/elements_object/create_element?type=payment) do Payment Element e faça o mount no container do Element. O Payment Element recolhe automaticamente o nome do cliente, e-mail, IBAN e exibe o texto de aceitação da instrução: ```javascript // Create and mount the Payment Element const paymentElement = elements.create('payment'); paymentElement.mount('#payment-element'); ``` #### React Instale o [React Stripe.js](https://www.npmjs.com/package/@stripe/react-stripe-js) e o [carregador Stripe.js](https://www.npmjs.com/package/@stripe/stripe-js) do registro público npm: ```bash npm install --save @stripe/react-stripe-js @stripe/stripe-js ``` Envie os detalhes de configuração (`mode: 'setup'`, `currency`) para o [Elements Provider](https://docs.stripe.com/sdks/stripejs-react.md#elements-provider): ```jsx import React from 'react'; import {loadStripe} from '@stripe/stripe-js'; import {Elements} from '@stripe/react-stripe-js'; import PaymentSetupForm from './PaymentSetupForm'; // Make sure to call `loadStripe` outside of a component's render to avoid // recreating the `Stripe` object on every render. const stripePromise = loadStripe('<>'); export default function App() { const options = { mode: 'setup', currency: 'eur', }; return ( ); } ``` Crie um componente de formulário de configuração que renderiza o [PaymentElement](https://docs.stripe.com/sdks/stripejs-react.md#element-components): ```jsx import React from 'react'; import {PaymentElement} from '@stripe/react-stripe-js'; export default function PaymentSetupForm() { return (
); } ``` ## Enviar os detalhes da forma de pagamento para a Stripe [Lado do cliente] Use [confirmSepaDebitPayment](https://docs.stripe.com/js/payment_intents/confirm_sepa_debit_payment#stripe_confirm_sepa_debit_payment-with_element) ou, para assinaturas que não cobram pagamento antecipado, [confirmSepaDebitSetup](https://docs.stripe.com/js/setup_intents/confirm_sepa_debit_setup#stripe_confirm_sepa_debit_setup-with_element) para confirmar a assinatura e criar um [PaymentMethod](https://docs.stripe.com/api/payment_methods.md) de débito automático SEPA. Inclua o nome e endereço de e-mail do cliente nas propriedades `payment_method.billing_details`. #### HTML + JS ```javascript // Define stripe with your publishable key var stripe = Stripe('pk_test_1234'); // Get the IBAN information from your element var iban = document.getElementById('iban-element'); const form = document.getElementById('payment-form'); const accountholderName = document.getElementById('accountholder-name'); const email = document.getElementById('email'); form.addEventListener('submit', async(event) => { event.preventDefault(); // Create the subscription const res = await fetch('/create-subscription', { method: 'POST', }); const {type, clientSecret} = await res.json(); const confirmIntent = type === 'setup' ? stripe.confirmSepaDebitSetup : stripe.confirmSepaDebitPayment; const {error} = await confirmIntent( clientSecret, { payment_method: { sepa_debit: iban, billing_details: { name: accountholderName.value, email: email.value, }, }, } ); }); ``` #### React ```jsx import React, {useState} from 'react'; import {useStripe, useElements, IbanElement} from '@stripe/react-stripe-js'; import IbanForm from './IbanForm'; export default function PaymentSetupForm() { const stripe = useStripe(); const elements = useElements(); const handleSubmit = async (event) => { // We don't want to let default form submission happen here, // which would refresh the page. event.preventDefault(); if (!stripe || !elements) { // Stripe.js hasn't yet loaded. // Make sure to disable form submission until Stripe.js has loaded. return; } const iban = elements.getElement(IbanElement); // For brevity, this example is using uncontrolled components for // the accountholder's name and email. In a real world app, you'd // probably want to use controlled components. // https://reactjs.org/docs/uncontrolled-components.html // https://reactjs.org/docs/forms.html#controlled-components const accountholderName = event.target['accountholder-name']; const email = event.target.email; // Create the subscription const res = await fetch('/create-subscription', { method: 'POST', }); const {type, clientSecret} = await res.json(); const confirmIntent = type === 'setup' ? stripe.confirmSepaDebitSetup : stripe.confirmSepaDebitPayment; const {error} = await confirmIntent(clientSecret, { payment_method: { sepa_debit: iban, billing_details: { name: accountholderName.value, email: email.value, }, }, }); if (res.error) { // Show error to your customer console.log(res.error.message); } else { // Show a confirmation message to your customer } }; return ( ); } ``` ## Definir a forma de pagamento padrão [Lado do servidor] Você precisa armazenar uma forma de pagamento para o cliente para processar pagamentos futuros. Para isso, defina a forma de pagamento cobrada no nível superior do objeto *Customer* (Customer objects represent customers of your business. They let you reuse payment methods and give you the ability to track multiple payments) e como [forma de pagamento padrão](https://docs.stripe.com/api/customers/update.md#update_customer-invoice_settings-default_payment_method) para *faturas* (Invoices are statements of amounts owed by a customer. They track the status of payments from draft through paid or otherwise finalized. Subscriptions automatically generate invoices, or you can manually create a one-off invoice): ```curl curl https://api.stripe.com/v1/customers/cus_Gk0uVzT2M4xOKD \ -u "<>:" \ -d "invoice_settings[default_payment_method]=pm_1F0c9v2eZvKYlo2CJDeTrB4n" ``` ## Gerenciar o status da assinatura [Lado do cliente] Quando o pagamento inicial for realizado, o status da assinatura ** (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) estará `active` e nenhuma outra ação será necessária. Quando os pagamentos falharem, o status será alterado para **Status da assinatura** definido nas suas [configurações de cobrança automática](https://docs.stripe.com/invoicing/automatic-collection.md). Notifique o cliente após uma falha e [cobre-o com uma forma de pagamento diferente](https://docs.stripe.com/billing/subscriptions/overview.md#requires-payment-method). ## Testar a integração Você pode testar a integração usando os IBANs abaixo. Os dados da forma de pagamento são coletados para todos os IBANs, mas cada um deles terá um comportamento diferente na cobrança. ##### IBANs de teste Use estes IBANs de teste com o Payment Element para testar sua integração de débito automático SEPA. O Payment Element valida automaticamente o IBAN e exibe a instrução quando você informa um desses valores de teste. ### AT | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | AT611904300234573201 | pm_success_at | The PaymentIntent status transitions from `processing` to `succeeded`. | | AT321904300235473204 | pm_successDelayed_at | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | AT861904300235473202 | pm_failed_at | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | AT051904300235473205 | pm_failedDelayed_at | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | AT591904300235473203 | pm_disputed_at | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | AT981904300000343434 | pm_exceedsWeeklyVolumeLimit_at | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | AT601904300000121212 | pm_exceedsWeeklyTransactionLimit_at | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | AT981904300002222227 | pm_insufficientFunds_at | The payment fails with an `insufficient_funds` failure code. | ### BE | Account Number | Token | Description | | ---------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | BE62510007547061 | pm_success_be | The PaymentIntent status transitions from `processing` to `succeeded`. | | BE78510007547064 | pm_successDelayed_be | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | BE68539007547034 | pm_failed_be | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | BE51510007547065 | pm_failedDelayed_be | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | BE08510007547063 | pm_disputed_be | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | BE90510000343434 | pm_exceedsWeeklyVolumeLimit_be | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | BE52510000121212 | pm_exceedsWeeklyTransactionLimit_be | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | BE90510002222227 | pm_insufficientFunds_be | The payment fails with an `insufficient_funds` failure code. | ### HR | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | HR7624020064583467589 | pm_success_hr | The PaymentIntent status transitions from `processing` to `succeeded`. | | HR6323600002337876649 | pm_successDelayed_hr | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | HR2725000096983499248 | pm_failed_hr | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | HR6723600004878117427 | pm_failedDelayed_hr | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | HR8724840081455523553 | pm_disputed_hr | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | HR7424020060000343434 | pm_exceedsWeeklyVolumeLimit_hr | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | HR3624020060000121212 | pm_exceedsWeeklyTransactionLimit_hr | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | HR7424020060002222227 | pm_insufficientFunds_hr | The payment fails with an `insufficient_funds` failure code. | ### EE | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | EE382200221020145685 | pm_success_ee | The PaymentIntent status transitions from `processing` to `succeeded`. | | EE222200221020145682 | pm_successDelayed_ee | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | EE762200221020145680 | pm_failed_ee | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | EE922200221020145683 | pm_failedDelayed_ee | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | EE492200221020145681 | pm_disputed_ee | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | EE672200000000343434 | pm_exceedsWeeklyVolumeLimit_ee | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | EE292200000000121212 | pm_exceedsWeeklyTransactionLimit_ee | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | EE672200000002222227 | pm_insufficientFunds_ee | The payment fails with an `insufficient_funds` failure code. | ### FI | Account Number | Token | Description | | ------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | FI2112345600000785 | pm_success_fi | The PaymentIntent status transitions from `processing` to `succeeded`. | | FI3712345600000788 | pm_successDelayed_fi | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | FI9112345600000786 | pm_failed_fi | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | FI1012345600000789 | pm_failedDelayed_fi | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | FI6412345600000787 | pm_disputed_fi | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | FI6712345600343434 | pm_exceedsWeeklyVolumeLimit_fi | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | FI2912345600121212 | pm_exceedsWeeklyTransactionLimit_fi | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | FI6712345602222227 | pm_insufficientFunds_fi | The payment fails with an `insufficient_funds` failure code. | ### FR | Account Number | Token | Description | | --------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | FR1420041010050500013M02606 | pm_success_fr | The PaymentIntent status transitions from `processing` to `succeeded`. | | FR3020041010050500013M02609 | pm_successDelayed_fr | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | FR8420041010050500013M02607 | pm_failed_fr | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | FR7920041010050500013M02600 | pm_failedDelayed_fr | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | FR5720041010050500013M02608 | pm_disputed_fr | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | FR9720041010050000000343434 | pm_exceedsWeeklyVolumeLimit_fr | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | FR5920041010050000000121212 | pm_exceedsWeeklyTransactionLimit_fr | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | FR9720041010050000002222227 | pm_insufficientFunds_fr | The payment fails with an `insufficient_funds` failure code. | ### DE | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | DE89370400440532013000 | pm_success_de | The PaymentIntent status transitions from `processing` to `succeeded`. | | DE08370400440532013003 | pm_successDelayed_de | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | DE62370400440532013001 | pm_failed_de | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | DE78370400440532013004 | pm_failedDelayed_de | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | DE35370400440532013002 | pm_disputed_de | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | DE65370400440000343434 | pm_exceedsWeeklyVolumeLimit_de | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | DE27370400440000121212 | pm_exceedsWeeklyTransactionLimit_de | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | DE65370400440002222227 | pm_insufficientFunds_de | The payment fails with an `insufficient_funds` failure code. | ### GI | Account Number | Token | Description | | ----------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | GI60MPFS599327643783385 | pm_success_gi | The PaymentIntent status transitions from `processing` to `succeeded`. | | GI08RRNW626436291644533 | pm_successDelayed_gi | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | GI41SAFA461293238477751 | pm_failed_gi | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | GI50LROG772261344693297 | pm_failedDelayed_gi | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | GI26KJBC361883934534696 | pm_disputed_gi | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | GI14NWBK000000000343434 | pm_exceedsWeeklyVolumeLimit_gi | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | GI73NWBK000000000121212 | pm_exceedsWeeklyTransactionLimit_gi | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | GI14NWBK000000002222227 | pm_insufficientFunds_gi | The payment fails with an `insufficient_funds` failure code. | ### IE | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | IE29AIBK93115212345678 | pm_success_ie | The PaymentIntent status transitions from `processing` to `succeeded`. | | IE24AIBK93115212345671 | pm_successDelayed_ie | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | IE02AIBK93115212345679 | pm_failed_ie | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | IE94AIBK93115212345672 | pm_failedDelayed_ie | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | IE51AIBK93115212345670 | pm_disputed_ie | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | IE10AIBK93115200343434 | pm_exceedsWeeklyVolumeLimit_ie | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | IE69AIBK93115200121212 | pm_exceedsWeeklyTransactionLimit_ie | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | IE10AIBK93115202222227 | pm_insufficientFunds_ie | The payment fails with an `insufficient_funds` failure code. | ### LI | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LI0508800636123378777 | pm_success_li | The PaymentIntent status transitions from `processing` to `succeeded`. | | LI4408800387787111369 | pm_successDelayed_li | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LI1208800143823175626 | pm_failed_li | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LI4908800356441975566 | pm_failedDelayed_li | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LI7708800125525347723 | pm_disputed_li | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LI2408800000000343434 | pm_exceedsWeeklyVolumeLimit_li | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LI8308800000000121212 | pm_exceedsWeeklyTransactionLimit_li | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LI2408800000002222227 | pm_insufficientFunds_li | The payment fails with an `insufficient_funds` failure code. | ### LT | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LT121000011101001000 | pm_success_lt | The PaymentIntent status transitions from `processing` to `succeeded`. | | LT281000011101001003 | pm_successDelayed_lt | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LT821000011101001001 | pm_failed_lt | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LT981000011101001004 | pm_failedDelayed_lt | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LT551000011101001002 | pm_disputed_lt | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LT591000000000343434 | pm_exceedsWeeklyVolumeLimit_lt | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LT211000000000121212 | pm_exceedsWeeklyTransactionLimit_lt | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LT591000000002222227 | pm_insufficientFunds_lt | The payment fails with an `insufficient_funds` failure code. | ### LU | Account Number | Token | Description | | -------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | LU280019400644750000 | pm_success_lu | The PaymentIntent status transitions from `processing` to `succeeded`. | | LU440019400644750003 | pm_successDelayed_lu | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | LU980019400644750001 | pm_failed_lu | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | LU170019400644750004 | pm_failedDelayed_lu | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | LU710019400644750002 | pm_disputed_lu | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | LU900010000000343434 | pm_exceedsWeeklyVolumeLimit_lu | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | LU520010000000121212 | pm_exceedsWeeklyTransactionLimit_lu | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | LU900010000002222227 | pm_insufficientFunds_lu | The payment fails with an `insufficient_funds` failure code. | ### NL | Account Number | Token | Description | | ------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | NL39RABO0300065264 | pm_success_nl | The PaymentIntent status transitions from `processing` to `succeeded`. | | NL55RABO0300065267 | pm_successDelayed_nl | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | NL91ABNA0417164300 | pm_failed_nl | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | NL28RABO0300065268 | pm_failedDelayed_nl | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | NL82RABO0300065266 | pm_disputed_nl | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | NL27RABO0000343434 | pm_exceedsWeeklyVolumeLimit_nl | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | NL86RABO0000121212 | pm_exceedsWeeklyTransactionLimit_nl | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | NL55RABO0300065267 | pm_insufficientFunds_nl | The payment fails with an `insufficient_funds` failure code. | ### NO | Account Number | Token | Description | | --------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | NO9386011117947 | pm_success_no | The PaymentIntent status transitions from `processing` to `succeeded`. | | NO8886011117940 | pm_successDelayed_no | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | NO6686011117948 | pm_failed_no | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | NO6186011117941 | pm_failedDelayed_no | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | NO3986011117949 | pm_disputed_no | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | NO0586010343434 | pm_exceedsWeeklyVolumeLimit_no | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | NO0586010343434 | pm_exceedsWeeklyTransactionLimit_no | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | NO0586012222227 | pm_insufficientFunds_no | The payment fails with an `insufficient_funds` failure code. | ### PT | Account Number | Token | Description | | ------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | PT50000201231234567890154 | pm_success_pt | The PaymentIntent status transitions from `processing` to `succeeded`. | | PT66000201231234567890157 | pm_successDelayed_pt | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | PT23000201231234567890155 | pm_failed_pt | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | PT39000201231234567890158 | pm_failedDelayed_pt | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | PT93000201231234567890156 | pm_disputed_pt | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | PT05000201230000000343434 | pm_exceedsWeeklyVolumeLimit_pt | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | PT64000201230000000121212 | pm_exceedsWeeklyTransactionLimit_pt | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | PT05000201230000002222227 | pm_insufficientFunds_pt | The payment fails with an `insufficient_funds` failure code. | ### ES | Account Number | Token | Description | | ------------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | ES0700120345030000067890 | pm_success_es | The PaymentIntent status transitions from `processing` to `succeeded`. | | ES2300120345030000067893 | pm_successDelayed_es | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | ES9121000418450200051332 | pm_failed_es | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | ES9300120345030000067894 | pm_failedDelayed_es | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | ES5000120345030000067892 | pm_disputed_es | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | ES1700120345000000343434 | pm_exceedsWeeklyVolumeLimit_es | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | ES7600120345000000121212 | pm_exceedsWeeklyTransactionLimit_es | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | ES1700120345000002222227 | pm_insufficientFunds_es | The payment fails with an `insufficient_funds` failure code. | ### SE | Account Number | Token | Description | | ------------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | SE3550000000054910000003 | pm_success_se | The PaymentIntent status transitions from `processing` to `succeeded`. | | SE5150000000054910000006 | pm_successDelayed_se | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | SE0850000000054910000004 | pm_failed_se | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | SE2450000000054910000007 | pm_failedDelayed_se | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | SE7850000000054910000005 | pm_disputed_se | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | SE2850000000000000343434 | pm_exceedsWeeklyVolumeLimit_se | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | SE8750000000000000121212 | pm_exceedsWeeklyTransactionLimit_se | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | SE2850000000000002222227 | pm_insufficientFunds_se | The payment fails with an `insufficient_funds` failure code. | ### CH | Account Number | Token | Description | | --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | CH9300762011623852957 | pm_success_ch | The PaymentIntent status transitions from `processing` to `succeeded`. | | CH8656663438253651553 | pm_successDelayed_ch | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | CH5362200119938136497 | pm_failed_ch | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | CH1843597160341964438 | pm_failedDelayed_ch | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | CH1260378413965193069 | pm_disputed_ch | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | CH1800762000000343434 | pm_exceedsWeeklyVolumeLimit_ch | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | CH7700762000000121212 | pm_exceedsWeeklyTransactionLimit_ch | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | CH1800762000002222227 | pm_insufficientFunds_ch | The payment fails with an `insufficient_funds` failure code. | ### GB | Account Number | Token | Description | | ---------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | GB82WEST12345698765432 | pm_success_gb | The PaymentIntent status transitions from `processing` to `succeeded`. | | GB98WEST12345698765435 | pm_successDelayed_gb | The PaymentIntent status transitions from `processing` to `succeeded` after at least three minutes. | | GB55WEST12345698765433 | pm_failed_gb | The PaymentIntent status transitions from `processing` to `requires_payment_method`. | | GB71WEST12345698765436 | pm_failedDelayed_gb | The PaymentIntent status transitions from `processing` to `requires_payment_method` after at least three minutes. | | GB28WEST12345698765434 | pm_disputed_gb | The PaymentIntent status transitions from `processing` to `succeeded`, but a dispute is immediately created. | | GB70WEST12345600343434 | pm_exceedsWeeklyVolumeLimit_gb | The payment fails with a `charge_exceeds_source_limit` failure code due to payment amount causing account to exceed its weekly payment volume limit. | | GB32WEST12345600121212 | pm_exceedsWeeklyTransactionLimit_gb | The payment fails with a `charge_exceeds_weekly_limit` failure code due to payment amount exceeding account's transaction volume limit. | | GB70WEST12345602222227 | pm_insufficientFunds_gb | The payment fails with an `insufficient_funds` failure code. | ## Optional: Definir o período de cobrança Ao criar uma assinatura, ela define automaticamente o ciclo de cobrança por padrão. Por exemplo, se um cliente assina um plano mensal em 7 de setembro, ele será cobrado no dia 7 de cada mês subsequente. Algumas empresas preferem definir manualmente o ciclo de cobrança, de modo a cobrar todos os clientes ao mesmo tempo. O argumento [âncora do ciclo de cobrança](https://docs.stripe.com/api/subscriptions/create.md#create_subscription-billing_cycle_anchor) permite que você faça isso. ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d "items[0][price]={{PRICE_ID}}" \ -d billing_cycle_anchor=1611008505 ``` A definição manual do ciclo de cobrança gera cobra o cliente proporcionalmente pelo tempo decorrido da criação da assinatura até o primeiro dia do ciclo de cobrança. Se não quiser cobrar esse período dos clientes, defina o argumento [proration_behavior](https://docs.stripe.com/api/subscriptions/create.md#create_subscription-proration_behavior) como `none`. Você também pode combinar a âncora do ciclo de cobrança com [períodos de avaliação](https://docs.stripe.com/billing/subscriptions/sepa-debit.md#trial-periods) para oferecer acesso gratuito ao seu produto e depois cobrar um valor proporcional. ## Optional: Avaliações de assinaturas As avaliações oferecem acesso gratuito ao seu produto por um período. Usar avaliações gratuitas é diferente de definir [proration_behavior](https://docs.stripe.com/api/subscriptions/create.md#create_subscription-proration_behavior) como `none`, porque você pode personalizar a duração do período gratuito. Passe um carimbo de data e hora em [fim do teste](https://docs.stripe.com/api/subscriptions/create.md#create_subscription-trial_end) para definir o período do teste. #### Accounts v2 ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer_account={{CUSTOMERACCOUNT_ID}}" \ -d "items[0][price]={{PRICE_ID}}" \ -d trial_end=1610403705 ``` #### Clientes v1 ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d "items[0][price]={{PRICE_ID}}" \ -d trial_end=1610403705 ``` Também é possível combinar uma [âncora de ciclo de faturamento](https://docs.stripe.com/billing/subscriptions/sepa-debit.md#billing-cycle) com um período de teste gratuito. Por exemplo, digamos que seja 15 de setembro e você queira oferecer um teste gratuito de sete dias e começar o ciclo de cobrança normal em 1º de outubro. Você pode definir o teste gratuito para terminar em 22 de setembro e a âncora do ciclo de faturamento para 1º de outubro. Assim, o cliente ganha um teste de sete dias e depois paga um valor proporcional do fim do teste até 1º de outubro. Em 1º de outubro, você cobra o valor normal da assinatura pelo primeiro ciclo de faturamento completo. ## Optional: Criar pagamentos com débito automático SEPA usando outras formas de pagamento > Esta documentação refere-se a um recurso *Legacy* (Technology that's no longer recommended) (o `idealBank` Element) que não está mais disponível na versão mais recente do Stripe.js. Recomendamos usar o [Payment Element](https://docs.stripe.com/payments/payment-element.md), um componente de IU para a web que aceita mais de 40 formas de pagamento, valida as entradas e gerencia erros. Você pode criar pagamentos de débito automático SEPA usando outras formas de pagamento, como [Bancontact](https://docs.stripe.com/payments/bancontact/set-up-payment.md) e [iDEAL](https://docs.stripe.com/payments/ideal/set-up-payment.md). Usar essas formas de pagamento exige alguns passos adicionais. Para o iDEAL: 1. Use um [idealBank Element](https://docs.stripe.com/js/elements_object/create_element?type=idealBank) para coletar informações de pagamento. 1. Confirme a assinatura usando [confirmIdealPayment](https://docs.stripe.com/js/payment_intents/confirm_ideal_payment) ou, para assinaturas que não cobram um pagamento antecipado, [confirmIdealSetup](https://docs.stripe.com/js/setup_intents/confirm_ideal_setup). 1. [Liste as formas de pagamento do cliente](https://docs.stripe.com/api/payment_methods/customer_list.md), localize a forma de pagamento por débito automático SEPA e defina-a como [forma de pagamento padrão](https://docs.stripe.com/billing/subscriptions/sepa-debit.md#set-default-payment-method) do cliente. Para Bancontact, substitua: - `confirmIdealPayment` para [confirmBancontactPayment](https://docs.stripe.com/js/payment_intents/confirm_bancontact_payment) - `confirmIdealSetup` para [confirmBancontactSetup](https://docs.stripe.com/js/setup_intents/confirm_bancontact_setup)