Ir a contenido
Crea una cuenta o Inicia sesión
Logotipo de Stripe Docs
/
Pregúntale a la IA
Crear una cuentaIniciar sesión
Empieza ahora
Pagos
Ingresos
Plataformas y marketplaces
Gestión del dinero
Recursos para desarrolladores
API y SDKAyuda
ResumenAcepta un pagoActualiza tu integración
Pagos electrónicos
ResumenEncuentra tu caso de uso
Usa Payment Links
Usar una página del proceso de compra prediseñada
Crear una integración personalizada con Elements
Desarrolla una integración en la aplicación
Usar pagos administradosPagos recurrentes
Pagos en persona
Terminal
Métodos de pago
Agrega métodos de pago
    Resumen
    Opciones de integración de métodos de pago
    Gestiona los métodos de pago predeterminados en el Dashboard
    Tipos de método de pago
    Tarjetas
    Paga con el saldo de Stripe
    Pagos con criptomonedas estables
    Débitos bancarios
      Débito directo ACH
      Débito directo Bacs
      Débito preautorizado en Canadá
      Débito directo BECS de Australia
      Débito directo BECS de Nueva Zelanda
      Débito directo SEPA
        Acepta un pago
        Guardar datos bancarios
    Redireccionamientos bancarios
    Transferencias bancarias
    Transferencias de crédito (API Sources)
    Compra ahora, paga después
    Pagos en tiempo real
    Vales
    Billeteras
    Habilita métodos de pago locales por país
    Métodos de pago personalizados
Gestiona los métodos de pago
Finalización de compra más rápida con Link
Operaciones de pago
Análisis
Saldos y plazos de acreditación de fondos
Cumplimiento de la normativa y seguridad
Otras monedas
Pagos rechazados
Disputas
Prevención de fraude
Protección contra fraudes de Radar
Transferencias
RecibosReembolsos y cancelaciones
Integraciones avanzadas
Flujos de pago personalizados
Capacidad adquirente flexible
Orquestación de varios encargados del tratamiento
Más allá de los pagos
Constituye tu empresa
Criptomonedas
Comercio agéntico
Financial Connections
Climate
Verificar identidades
Estados Unidos
Español (América Latina)
InicioPagosAdd payment methodsBank debitsSEPA Direct Debit

Save SEPA Direct Debit details for future payments

Learn how to save payment method details for future SEPA Direct Debit payments.

You can use the Setup Intents API to collect payment method details in advance, and determine the final amount or payment date later. Use it to:

  • Save payment methods to a wallet to streamline future purchases
  • Collect surcharges after fulfilling a service
  • Start a free trial for a subscription

Configurar Stripe
Lado del servidorLado del cliente

Lado del servidor

Esta integración necesita puntos de conexión en tu servidor que se comuniquen con la API de Stripe. Usa nuestras bibliotecas oficiales para acceder a la API de Stripe desde tu servidor:

Command Line
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
# Available as a gem sudo gem install stripe
Gemfile
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Lado del cliente

El SDK para React Native es de código abierto y está plenamente documentado. Internamente, utiliza SDK para iOS nativo y Android. Para instalar el SDK para React Native de Stripe, ejecuta uno de los siguientes comandos en el directorio del proyecto (según el administrador de paquetes que utilices):

Command Line
yarn add @stripe/stripe-react-native

A continuación, instala otras dependencias necesarias:

  • Para iOS, vaya al directorio ios y ejecute pod install para asegurarse de que también instala las dependencias nativas necesarias.
  • Para Android, no hay más dependencias para instalar.

Nota

Recomendamos seguir la guía oficial de TypeScript para agregar soporte para TypeScript.

Inicialización de Stripe

Para inicializar Stripe en tu aplicación React Native, ajusta tu pantalla de pago con el componente StripeProvider o usa el método de inicialización initStripe. Solo se requiere la clave publicable de la API en publishableKey. El siguiente ejemplo muestra cómo inicializar Stripe usando el componente StripeProvider.

import { useState, useEffect } from 'react'; import { StripeProvider } from '@stripe/stripe-react-native'; function App() { const [publishableKey, setPublishableKey] = useState(''); const fetchPublishableKey = async () => { const key = await fetchKey(); // fetch key from your server here setPublishableKey(key); }; useEffect(() => { fetchPublishableKey(); }, []); return ( <StripeProvider publishableKey={publishableKey} merchantIdentifier="merchant.identifier" // required for Apple Pay urlScheme="your-url-scheme" // required for 3D Secure and bank redirects > {/* Your app code here */} </StripeProvider> ); }

Nota

Usa las claves de prueba de la API durante las pruebas y el desarrollo, y tus claves para modo activo cuando publiques tu aplicación.

Crear o recuperar un objeto Customer
Lado del servidor

Para reutilizar una cuenta de débito directo SEPA para pagos futuros, la cuenta debe estar asociada a un Customer.

You should create a Customer object when your customer creates an account with your business. Associating the ID of the Customer object with your own internal representation of a customer will enable you to retrieve and use the stored payment method details later. If your customer hasn’t created an account, you can still create a Customer object now and associate it with your internal representation of the customer’s account later.

Create a new Customer or retrieve an existing Customer to associate with these payment details. Include the following code on your server to create a new Customer.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl -X POST https://api.stripe.com/v1/customers \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"

Crear un SetupIntent
Lado del servidor

A SetupIntent is an object that represents your intent and tracks the steps to set up your customer’s payment method for future payments. For SEPA Direct Debit, this includes collecting a mandate from the customer and checking the validity of the IBAN.

Create a SetupIntent on your server with payment_method_types set to sepa_debit and specify the Customer’s id.:

Command Line
curl
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/setup_intents \ -u
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:
\ -d "payment_method_types[]"="sepa_debit" \ -d "customer"="{{CUSTOMER_ID}}"

Recopilar los datos del método de pago y la confirmación del mandato
Lado del cliente

Collect the customer’s IBAN in your payment form and display the following standard authorization text for your customer to implicitly sign the mandate.

Muestra el siguiente texto estándar de autorización al cliente para que implícitamente firme el mandato.

Reemplaza Rocket Rides con el nombre de tu empresa.

Plantilla del texto de autorización

By providing your payment information and confirming this payment, you authorise (A) and Stripe, our payment service provider, to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with those instructions. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Your rights are explained in a statement that you can obtain from your bank. You agree to receive notifications for future debits up to 2 days before they occur.

Copiar

La configuración de un método de pago equivale a la aceptación del mandato. Puesto que el cliente ha firmado el mandato implícitamente al aceptar estas condiciones, debes comunicar estas últimas en tu formulario o por correo electrónico.

export default function SepaSetupFuturePaymentScreen() { const [email, setEmail] = useState(''); const [iban, setIban] = useState(''); return ( <Screen> <TextInput placeholder="E-mail" keyboardType="email-address" onChange={(value) => setEmail(value.nativeEvent.text)} style={styles.input} /> <TextInput placeholder="Iban" onChange={(value) => setIban(value.nativeEvent.text.toLowerCase())} style={styles.input} /> <Button variant="primary" onPress={handlePayPress} title="Save IBAN" loading={loading} /> </Screen> ); }

Enviar los datos del método de pago a Stripe
Lado del cliente

Retrieve the client secret from the SetupIntent you created and call confirmSetupIntent.

The client secret should be handled carefully because it can complete the setup. Don’t log it, embed it in URLs, or expose it to anyone but the customer.

Nota

addressCountry and addressLine1 must be provided in the billingDetails for IBANs with the following country codes: AD, PF, TF, GI, GB, GG, VA, IM, JE, MC, NC, BL, PM, SM, CH, WF. See the React Native SDK reference for a list of address fields.

export default function SepaSetupFuturePaymentScreen() { const [iban, setIban] = useState(''); const {confirmSetupIntent, loading} = useConfirmSetupIntent(); const handlePayPress = async () => { const clientSecret = await createSetupIntentOnBackend(email); const billingDetails: PaymentMethodCreateParams.BillingDetails = { name: 'Jenny Rosen', email: 'jenny.rosen@example.com', }; const {error, setupIntent} = await confirmSetupIntent(clientSecret, { paymentMethodType: 'SepaDebit', paymentMethodData: { billingDetails, iban, } }); if (error) { Alert.alert(`Error code: ${error.code}`, error.message); console.log('Setup intent confirmation error', error.message); } else if (setupIntent) { Alert.alert( `Success: Setup intent created. Intent status: ${setupIntent.status}`, ); } }; return <Screen>{/* ... */}</Screen>; }

Probar la integración

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

Prueba los IBAN
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.

OpcionalCustomize mandate references with a prefix

You can customize SEPA Direct Debit mandate references to simplify mandate identification. To do this, provide the optional payment_method_options.sepa_debit.mandate_options.reference_prefix value. We add the reference_prefix to the beginning of a unique sequence to ensure the entire reference remains unique.

The reference_prefix must meet these requirements:

  • Maximum length: 12 characters
  • Must begin with a number or an uppercase letter
  • Allowed characters:
    • Uppercase letters
    • Numbers
    • Spaces
    • Special characters: ., /, &, -, _
  • Can’t begin with STRIPE

Include any desired delimiter in the prefix, as we don’t add one by default. We trim trailing spaces to a maximum of one space. With a valid prefix, the resulting reference is always 24 characters long.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d currency=eur \ -d amount=100 \ -d "payment_method_types[]"=sepa_debit \ -d "payment_method_options[sepa_debit][mandate_options][reference_prefix]"=EX4MPL3-

The generated reference looks like EX4MPL3-19CNCI920C2M02O3.

Error CodeMessage
invalid_sepa_mandate_reference_prefix_formatThe reference_prefix must be at most 12 characters long and can only contain uppercase letters, numbers, spaces, or the special characters /, _, -, &, and .. It can’t begin with STRIPE.

Ver también

  • Manually configure SEPA Direct Debit as a payment
  • Connect payments
¿Te fue útil esta página?
SíNo
  • ¿Necesitas ayuda? Ponte en contacto con soporte.
  • Echa un vistazo a nuestro registro de cambios.
  • ¿Tienes alguna pregunta? Contacto.
  • ¿LLM? Lee llms.txt.
  • Con tecnología de Markdoc