Pular para o conteúdo
Criar conta
ou
Entrar
O logotipo da documentação da Stripe
/
Pergunte à IA
Criar conta
Login
Comece já
Pagamentos
Automação de finanças
Plataformas e marketplaces
Gestão de valores
Ferramentas para desenvolvedores
Comece já
Pagamentos
Automação de finanças
Comece já
Pagamentos
Automação de finanças
Plataformas e marketplaces
Gestão de valores
Visão geral
Billing
    Visão geral
    Sobre as APIs do Billing
    Assinaturas
      Como funcionam as assinaturas
      Início rápido
      Casos de uso
      Crie sua integração
      Recursos de assinatura
        Faturas de assinatura
        Cronogramas de assinatura
        Preços de assinatura
        Modelos de preço recorrente
        Incorporar uma tabela de preços
        Iniciar assinaturas
        Definir quantidades
        Defina ciclos de faturamento
        Inicie assinaturas com data passada
        Inscrever-se em vários itens
        Definir períodos de avaliação
        Aplicar cupons
        Migrar assinaturas para a Stripe
        Como cobranças proporcionais de crédito são calculadas
        Pagamentos de assinaturas
        Formas de pagamento de assinaturas
          Débito automático ACH
          Amazon Pay
          Débito automático Bacs no Reino Unido
          Transferência bancária
          Débito automático BECS na Austrália
          Cash App Pay
          PayPal
          Revolut Pay
          Cartões coreanos
          Kakao Pay
          Naver Pay
          Débito pré-autorizado no Canadá
          Débito automático SEPA na UE
          iDEAL com débito automático SEPA
          Bancontact com débito automático SEPA
          Sofort com débito automático SEPA
        Integrar com processamento de pagamentos externo
        Métodos de cobrança
        Compartilhe um link para atualizar dados de pagamento
        SCA (autenticação forte de cliente)
        Gerenciar assinaturas
        Modifique assinaturas
        Gerencie atualizações pendentes
      Análises
    Invoicing
    Cobrança por uso
    Connect e Billing
    Tax e Billing
    Cotações
    Recuperação de receitas
    Automações
    Scripts
    Reconhecimento de receitas
    Gerenciamento de clientes
    Direitos
    Teste sua integração
Tributos
Relatórios
Dados
Incorporação de startups
Página inicialAutomação de finançasBillingSubscriptionsSubscription featuresSubscription payment methods

Observação

Esta página ainda não está disponível no idioma desejado. Estamos trabalhando para tornar nossa documentação disponível em mais idiomas e vamos disponibilizar a tradução assim possível.

Set up a subscription with SEPA Direct Debit

Learn how to create and charge a subscription with SEPA Direct Debit.

Copiar página

Stripe sample

Check out the sample on GitHub or explore the demo.

A Checkout Session represents the details of your customer’s intent to purchase. You create a Checkout Session when your customer wants to start a subscription. After redirecting your customer to a Checkout Session, Stripe presents a payment form where your customer can complete their purchase. Once your customer has completed a purchase, they will be redirected back to your site.

Set up Stripe
Server-side

Install the Stripe client of your choice:

Command Line
Ruby
# Available as a gem sudo gem install stripe
Gemfile
Ruby
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Install the Stripe CLI (optional). The CLI provides webhook testing, and you can run it to create your products and prices.

Command Line
homebrew
# Install Homebrew to run this command: https://brew.sh/ brew install stripe/stripe-cli/stripe # Connect the CLI to your dashboard stripe login

For additional install options, see Get started with the Stripe CLI.

Create the pricing model
Dashboard
Stripe CLI

Create your products and their prices in the Dashboard or with the Stripe CLI.

This example uses a fixed-price service with two different service-level options: Basic and Premium. For each service-level option, you need to create a product and a recurring price. (If you want to add a one-time charge for something like a setup fee, create a third product with a one-time price. To keep things simple, this example doesn’t include a one-time charge.)

In this example, each product bills at monthly intervals. The price for the Basic product is 5 EUR. The price for the Premium product is 15 EUR.

Go to the Add a product page and create two products. Add one price for each product, each with a monthly recurring billing period:

  • Premium product: Premium service with extra features

    • Price: Standard pricing | 15 EUR
  • Basic product: Basic service with minimum features

    • Price: Standard pricing | 5 EUR

After you create the prices, record the price IDs so you can use them in other steps. Price IDs look like this: price_G0FvDp6vZvdwRZ.

When you’re ready, use the Copy to live mode button at the top right of the page to clone your product from a sandbox to live mode.

For other pricing models, see Billing examples.

Create a Checkout Session
Client-side
Server-side

Add a checkout button to your website that calls a server-side endpoint to create a Checkout Session.

index.html
<html> <head> <title>Checkout</title> </head> <body> <form action="/create-checkout-session" method="POST"> <button type="submit">Checkout</button> </form> </body> </html>

Checkout Session parameters

See Create a Checkout Session for a complete list of parameters that can be used.

Create a Checkout Session with the ID of an existing Price. Ensure that mode is set to subscription and you pass at least one recurring price. You can add one-time prices in addition to recurring prices. After creating the Checkout Session, redirect your customer to the URL returned in the response.

Command Line
cURL
curl https://api.stripe.com/v1/checkout/sessions \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -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}" \ -d "cancel_url"="https://example.com/cancel" \

When your customer successfully completes their payment, they’re redirected to the success_url, a page on your website that informs the customer that their payment was successful. Make the Session ID available on your success page by including the {CHECKOUT_SESSION_ID} template variable in the success_url as in the above example.

When your customer clicks on your logo in a Checkout Session without completing a payment, Checkout redirects them back to your website by navigating to the cancel_url. Typically, this is the page on your website that the customer viewed prior to redirecting to Checkout.

Checkout Sessions expire 24 hours after creation by default.

From your Dashboard, enable the payment methods you want to accept from your customers. Checkout supports several payment methods.

Cuidado

Don’t rely on the redirect to the success_url alone for detecting payment initiation, as:

  • Malicious users could directly access the success_url without paying and gain access to your goods or services.
  • Customers may not always reach the success_url after a successful payment—they might close their browser tab before the redirect occurs.

Confirm the payment is successful

When your customer completes a payment, Stripe redirects them to the URL that you specified in the success_url parameter. Typically, this is a page on your website that informs your customer that their payment was successful.

However, SEPA Direct Debit is a delayed notification payment method, which means that funds aren’t immediately available. Because of this, delay order fulfillment until the funds are available. After the payment succeeds, the underlying PaymentIntent status changes from processing to succeeded.

You can confirm the payment is successful in several ways:

Successful payments appear in the Dashboard’s list of payments. When you click a payment, it takes you to the payment details page. The Checkout summary section contains billing information and the list of items purchased, which you can use to manually fulfill the order.

Observação

Stripe can help you keep up with incoming payments by sending you email notifications whenever a customer successfully completes one. Use the Dashboard to configure email notifications.

Test the integration

You can test your integration using the IBANs below. The payment method details are successfully collected for each IBAN but exhibit different behavior when charged.

Test IBANs
Número da contaDescrição
DE89370400440532013000O status do PaymentIntent muda de processing para succeeded.
DE08370400440532013003O status do PaymentIntent muda de processing para succeeded após pelo menos três minutos.
DE62370400440532013001O status do PaymentIntent muda de processing para requires_payment_method.
DE78370400440532013004O status do PaymentIntent muda de processing para requires_payment_method após pelo menos três minutos.
DE35370400440532013002O status do PaymentIntent muda de processing para succeeded, mas uma contestação é imediatamente criada.
DE65370400440000343434O pagamento falha com um código de falha charge_exceeds_source_limit devido ao valor do pagamento fazer com que a conta exceda o limite de volume de pagamentos semanal.
DE27370400440000121212O pagamento falha com um código de falha charge_exceeds_weekly_limit quando o valor do pagamento excedeu o limite de volume de transações da conta.
DE65370400440002222227O pagamento falha com um código de falha insufficient_funds.

OpcionalAdding a one-time setup fee
Server-side

OpcionalCreate prices and products inline
Server-side

OpcionalExisting customers
Server-side

OpcionalPrefill customer data
Server-side

OpcionalHandling trials
Server-side

OpcionalTax rates
Server-side

OpcionalAdding coupons
Server-side

Veja também

  • Customize your integration
  • Manage subscriptions with the customer portal
Esta página foi útil?
SimNão
Precisa de ajuda? Fale com o suporte.
Participe do nosso programa de acesso antecipado.
Confira nosso changelog.
Dúvidas? Fale com a equipe de vendas.
LLM? Read llms.txt.
Powered by Markdoc