Ir a contenido
Crea una cuenta
o
Inicia sesión
Logotipo de Stripe Docs
/
Pregúntale a la IA
Crear una cuenta
Iniciar sesión
Empieza ahora
Pagos
Automatización contable
Plataformas y marketplaces
Gestión del dinero
Herramientas para desarrolladores
Empieza ahora
Pagos
Automatización contable
Empieza ahora
Pagos
Automatización contable
Plataformas y marketplaces
Gestión del dinero
Resumen
Billing
    Resumen
    Acerca de las API de facturación
    Suscripciones
      Cómo funcionan las suscripciones
      Inicio rápido
      Casos de uso
      Desarrolla tu integración
      Funcionalidades de la suscripción
        Facturas de suscripciones
        Calendarios de suscripciones
        Precios de suscripciones
        Modelos de tarifas recurrentes
        Inserta un cuadro de tarifas
        Iniciar suscripciones
        Determinar cantidades
        Establecer ciclos de facturación
        Suscripciones con fechas pasadas
        Suscríbete a varios elementos
        Configura períodos de prueba
        Aplica cupones
        Migrar suscripciones a Stripe
        Cómo se calculan los prorrateos de crédito
        Pagos de suscripciones
        Métodos de pago de suscripciones
          Débito directo ACH
          Amazon Pay
          Débito directo Bacs en el Reino Unido
          Transferencia bancaria
          Débito directo BECS en Australia
          Cash App Pay
          PayPal
          Revolut Pay
          Tarjetas coreanas
          Kakao Pay
          Naver Pay
          Débito preautorizado en Canadá
          Débito directo SEPA en la UE
          iDEAL con débito directo SEPA
          Bancontact con débito directo SEPA
          Sofort con débito directo SEPA
        Integra con el procesamiento de pagos de terceros
        Métodos de cobro
        Comparte un enlace para actualizar los datos de pago
        Autenticación reforzada de clientes (SCA)
        Administración de suscripciones
        Modificar suscripciones
        Gestionar actualizaciones pendientes
      Análisis
    Invoicing
    Cobro por consumo
    Connect y Billing
    Tax y Billing
    Presupuestos
    Recuperación de ingresos
    Automatizaciones
    Scripts
    Reconocimiento de ingresos
    Gestión de clientes
    Derechos
    Prueba tu integración
Impuesto
Elaboración de informes
Datos
Constitución de una startup
InicioAutomatización contableBillingSubscriptionsSubscription featuresSubscription payment methods

Nota

Esta página aún no está disponible en este idioma. Estamos trabajando intensamente para que nuestra documentación esté disponible en más idiomas. Ofreceremos la traducción en cuanto esté disponible.

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.

Precaución

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.

Nota

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 de cuentaDescripción
DE89370400440532013000El estado del PaymentIntent pasa de processing a succeeded.
DE08370400440532013003El estado del PaymentIntent pasa de processing a succeeded después de al menos tres minutos.
DE62370400440532013001El estado del PaymentIntent pasa de processing a requires_payment_method.
DE78370400440532013004El estado del PaymentIntent pasa de processing a requires_payment_method después de al menos tres minutos.
DE35370400440532013002El estado del PaymentIntent pasa de processing a succeeded, pero se crea inmediatamente una disputa.
DE65370400440000343434El pago falla con un código de falla charge_exceeds_source_limit debido a que el monto del pago hace que la cuenta exceda su límite de volumen de pago semanal.
DE27370400440000121212El pago falla con un código de error charge_exceeds_weekly_limit debido a que el monto del pago excede el límite de volumen de transacciones de la cuenta.
DE65370400440002222227Se produce un error en el pago con un código de error 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

Consulta también

  • Customize your integration
  • Manage subscriptions with the customer portal
¿Te fue útil esta página?
SíNo
¿Necesitas ayuda? Ponte en contacto con soporte.
Únete a nuestro programa de acceso anticipado.
Echa un vistazo a nuestro registro de cambios.
¿Tienes alguna pregunta? Contacto.
¿LLM? Lee llms.txt.
Con tecnología de Markdoc