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
Revenue
Plataformas y marketplaces
Gestión del dinero
Herramientas para desarrolladores
Resumen
Acerca de Stripe Payments
Actualiza tu integración
Análisis de pagos
Pagos electrónicos
ResumenEncuentra tu caso de usoPagos administrados
Usa Payment Links
Crea una página del proceso de compra
Desarrolla una integración avanzada
Desarrolla una integración en la aplicación
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
    Débitos bancarios
    Redireccionamientos bancarios
    Transferencias bancarias
      Acepta un pago
      Saldo del cliente
      Reembolsos
    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
Interfaces de pago
Payment Links
Checkout
Elements para la web
Elements en la aplicación
Escenarios de pago
Flujos de pago personalizados
Capacidad adquirente flexible
Orquestación
Pagos en persona
Terminal
Otros productos de Stripe
Financial Connections
Criptomonedas
Climate
InicioPagosAdd payment methodsBank transfers

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.

Aceptar una transferencia bancaria

Utiliza la API Payment Intents para aceptar pagos con transferencia bancaria.

Copiar página

La primera vez que aceptas un pago mediante transferencia bancaria de un cliente, Stripe genera una cuenta bancaria virtual para ese cliente, que luego puedes compartir con esa persona directamente. Todos los pagos futuros con transferencia bancaria de ese cliente se envían a esta cuenta bancaria. En algunos países, Stripe también te proporciona un número de referencia para transferencias exclusivo que tu cliente debe incluir en cada transferencia a fin de facilitar la comparación entre la transferencia y los pagos pendientes. En algunos países hay límites en la cantidad de números de cuentas bancarias virtuales que puedes crear gratis.

Puedes encontrar un resumen de los pasos más comunes para aceptar un pago mediante transferencia bancaria en el siguiente diagrama de secuencia:

Manejo de pagos insuficientes y sobrepagos

En el caso de los pagos con transferencia bancaria, es posible que el cliente te envíe un importe mayor o menor que el importe de pago previsto. Si el cliente envía un importe menor, Stripe cubre parte de un Payment Intent abierto. Las facturas no se cubren en parte, sino que quedan abiertas hasta que se reciben fondos para cubrir el importe total.

If the customer sends more than the expected amount, Stripe attempts to reconcile the incoming funds against an open payment and keep the remaining excess amount in the customer cash balance. You can find more details on how Stripe handles reconciliation in the reconciliation section of our documentation.

Cuando un cliente paga un importe inferior:

Cuando un cliente paga un importe superior:

Cómo gestionar varias facturas o pagos abiertos

Puedes tener varias facturas o pagos abiertos que se pueden saldar con una transferencia bancaria. Según la configuración predeterminada, Stripe hará el intento de conciliar automáticamente la transferencia bancaria utilizando datos como el código de referencia de la transferencia o el importe transferido.

Puedes deshabilitar la conciliación automática y conciliar manualmente pagos y facturas tú mismo. Puedes omitir el comportamiento de conciliación automática por cliente configurando el modo de conciliación en manual.

Configurar Stripe
Lado del servidor

First, you need a Stripe account. Register now.

Usa nuestras bibliotecas oficiales para acceder a la API de Stripe desde tu aplicación:

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'

Crear o recuperar un objeto Customer
Lado del servidor

You must associate a Customer object to reconcile each bank transfer payment. If you have an existing Customer object, you can skip this step. Otherwise, create a new Customer object.

Command Line
cURL
curl -X POST https://api.stripe.com/v1/customers \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"

Crear un PaymentIntent
Lado del servidor

A PaymentIntent is an object that represents your intent to collect payment from a customer and tracks the lifecycle of the payment process through each stage. Create a PaymentIntent on the server, specifying the amount and currency you want to collect. You must also populate the customer parameter of the PaymentIntent creation request. Bank transfers aren’t available on PaymentIntents without a customer.

Antes de crear un Payment Intent, asegúrate de activar Transferencia bancaria en la página de configuración de métodos de pago de tu Dashboard.

Nota

With Dynamic payment methods, Stripe handles the return of eligible payment methods based on factors such as the transaction’s amount, currency, and payment flow.

Command Line
cURL
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount=1099 \ -d customer=
{{CUSTOMER_ID}}
\ -d currency=usd \ -d "automatic_payment_methods[enabled]"=true

En la última versión de la API, especificar el parámetro automatic_payment_methods es opcional porque Stripe habilita su funcionalidad de forma predeterminada.

If the customer already has a balance high enough to cover the payment amount, the PaymentIntent immediately succeeds with a succeeded status. Customers can accrue a balance when they accidentally overpay for a transaction—a common occurrence with bank transfers. You must reconcile customer balances within a certain period based on your location.

Recopilar datos de pago
Lado del cliente

Collect payment details on the client with the Payment Element. The Payment Element is a prebuilt UI component that simplifies collecting payment details for a variety of payment methods.

El Payment Element contiene un iframe que envía la información de pago a Stripe de manera segura a través de una conexión HTTPS. Evita colocar el Payment Element dentro de otro iframe porque algunos métodos de pago requieren redirigir a otra página para la confirmación del pago.

The checkout page address must start with https:// rather than http:// for your integration to work. You can test your integration without using HTTPS, but remember to enable it when you’re ready to accept live payments.

Configurar Stripe.js

El Payment Element se encuentra disponible automáticamente como funcionalidad de Stripe.js. Incluye el script de Stripe.js en tu página de finalización de compra agregándolo al head de tu archivo HTML. Siempre debes cargar Stripe.js directamente desde js.stripe.com para cumplir con la normativa PCI. No incluyas el script en un paquete ni alojes una copia en tus sistemas.

checkout.html
<head> <title>Checkout</title> <script src="https://js.stripe.com/v3/"></script> </head>

Crea una instancia de Stripe con el siguiente código JavaScript en tu página de pago:

checkout.js
// Set your publishable key: remember to change this to your live publishable key in production // See your keys here: https://dashboard.stripe.com/apikeys const stripe = Stripe(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
);

Agrega el Payment Element a tu página de pago

El Payment Element necesita un lugar específico en tu página de pago. Crea un nodo DOM vacío (contenedor) con un ID único en tu formulario de pago:

checkout.html
<form id="payment-form"> <div id="payment-element"> <!-- Elements will create form elements here --> </div> <button id="submit">Submit</button> <div id="error-message"> <!-- Display error message to your customers here --> </div> </form>

When the previous form loads, create an instance of the Payment Element and mount it to the container DOM node. Pass the client secret from the previous step into options when you create the Elements instance:

Debes administrar el secreto de cliente con cuidado porque sirve para completar el cargo. No lo registres, no lo insertes en direcciones URL ni lo expongas a nadie que no sea el cliente.

checkout.js
const options = { clientSecret: '{{CLIENT_SECRET}}', // Fully customizable with appearance API. appearance: {/*...*/}, }; // Set up Stripe.js and Elements to use in checkout form, passing the client secret obtained in a previous step const elements = stripe.elements(options); // Create and mount the Payment Element const paymentElementOptions = { layout: 'accordion'}; const paymentElement = elements.create('payment', paymentElementOptions); paymentElement.mount('#payment-element');

Explora Stripe Elements

Stripe Elements is a collection of drop-in UI components. To further customize your form or collect different customer information, browse the Elements docs.

El Payment Element renderiza un formulario dinámico que le permite a tu cliente elegir un método de pago. Para cada método de pago, el formulario le pide automáticamente al cliente que complete todos los datos de pago necesarios.

Personaliza el aspecto

Customize the Payment Element to match the design of your site by passing the appearance object into options when creating the Elements provider.

Recopila las direcciones

By default, the Payment Element only collects the necessary billing address details. To collect a customer’s full billing address (to calculate the tax for digital goods and services, for example) or shipping address, use the Address Element.

Una vez recibida la confirmación, Stripe abre automáticamente un cuadro de diálogo para mostrarle los datos de la transferencia bancaria al cliente.

Enviar pago a Stripe
Lado del cliente

Use stripe.confirmPayment to complete the payment using details from the Payment Element. Provide a return_url to this function to indicate where Stripe should redirect the user after they complete the payment. Your user may be first redirected to an intermediate site, like a bank authorization page, before being redirected to the return_url. Card payments immediately redirect to the return_url when a payment is successful.

If you don’t want to redirect for card payments after payment completion, you can set redirect to if_required. This only redirects customers that check out with redirect-based payment methods.

checkout.js
const form = document.getElementById('payment-form'); form.addEventListener('submit', async (event) => { event.preventDefault(); const {error} = await stripe.confirmPayment({ //`Elements` instance that was used to create the Payment Element elements, confirmParams: { return_url: 'https://example.com/order/123/complete', }, }); if (error) { // This point will only be reached if there is an immediate error when // confirming the payment. Show error to your customer (for example, payment // details incomplete) const messageContainer = document.querySelector('#error-message'); messageContainer.textContent = error.message; } else { // Your customer will be redirected to your `return_url`. For some payment // methods like iDEAL, your customer will be redirected to an intermediate // site first to authorize the payment, then redirected to the `return_url`. } });

Asegúrate de que la return_url corresponda a una página de tu sitio web que proporcione el estado del pago. Cuando Stripe redirige al cliente a la return_url, proporcionamos los siguientes parámetros de consulta de URL:

ParámetroDescripción
payment_intentEl identificador único del PaymentIntent.
payment_intent_client_secretThe client secret of the PaymentIntent object.

Precaución

Si tienes herramientas que rastrean la sesión del navegador del cliente, es posible que debas agregar el dominio stripe.com a la lista de exclusión de referentes. Los redireccionamientos hacen que algunas herramientas creen nuevas sesiones, lo que te impide realizar un seguimiento de la sesión completa.

Use one of the query parameters to retrieve the PaymentIntent. Inspect the status of the PaymentIntent to decide what to show your customers. You can also append your own query parameters when providing the return_url, which persist through the redirect process.

status.js
// Initialize Stripe.js using your publishable key const stripe = Stripe(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
); // Retrieve the "payment_intent_client_secret" query parameter appended to // your return_url by Stripe.js const clientSecret = new URLSearchParams(window.location.search).get( 'payment_intent_client_secret' ); // Retrieve the PaymentIntent stripe.retrievePaymentIntent(clientSecret).then(({paymentIntent}) => { const message = document.querySelector('#message') // Inspect the PaymentIntent `status` to indicate the status of the payment // to your customer. // // Some payment methods will [immediately succeed or fail][0] upon // confirmation, while others will first enter a `processing` state. // // [0]: https://stripe.com/docs/payments/payment-methods#payment-notification switch (paymentIntent.status) { case 'succeeded': message.innerText = 'Success! Payment received.'; break; case 'processing': message.innerText = "Payment processing. We'll update you when payment is received."; break; case 'requires_payment_method': message.innerText = 'Payment failed. Please try another payment method.'; // Redirect your user back to your payment page to attempt collecting // payment again break; default: message.innerText = 'Something went wrong.'; break; } });

OpcionalEnviar correos electrónicos con instrucciones de pago

Confirma que el PaymentIntent se procesó correctamente

El estado del PaymentIntent es requires_action hasta que los fondos llegan a la cuenta bancaria. Cuando los fondos están listos, el estado del PaymentIntent se actualiza y pasa de requires_action a succeeded.

Tu punto de conexión de webhooks debe estar configurado para empezar a recibir el evento payment_intent.partially_funded. Cuando solo se paga parte del PaymentIntent, el estado sigue siendo requires_action.

You can add a webhook from the Dashboard.

Alternatively, you can use the Webhook Endpoints API to start receiving the payment_intent.partially_funded event.

Precaución

The Stripe CLI doesn’t support triggering beta API version events, such as payment_intent.partially_funded.

The following events are sent during the payment funding flow when the PaymentIntent is updated.

EventoDescripciónPróximos pasos
payment_intent.requires_actionSe envía durante la confirmación cuando no hay fondos suficientes en el saldo de cliente para conciliar el PaymentIntent. El estado del PaymentIntent pasa a requires_action.Indícale a tu cliente que envíe una transferencia bancaria con el amount_remaining.
payment_intent.partially_fundedThe customer sent a bank transfer that was applied to the PaymentIntent, but wasn’t enough to complete the payment. This might happen because the customer transferred an insufficient amount (because of a mistaken underpayment or fees charged by their bank) or because a remaining customer balance was applied to this PaymentIntent. PaymentIntents that are partially funded aren’t reflected in your account balance until the payment is complete.Instruct your customer to send another bank transfer with the new amount_remaining to complete the payment. If you want to complete the payment with the partially applied funds, you can update the amount and confirm the PaymentIntent again.
payment_intent.succeededEl pago del cliente se efectuó correctamente.Fulfill the goods or services that the customer purchased.

Precaución

When you change the amount of a partially funded PaymentIntent, the funds are returned to the customer balance. If other PaymentIntents are open, Stripe funds those automatically. If the customer is configured for manual reconciliation, you need to apply the funds again.

We recommend using webhooks to confirm the charge has succeeded and to notify the customer that the payment is complete.

Sample code

Ruby
require 'json' # Using Sinatra post '/webhook' do payload = request.body.read event = nil begin event = Stripe::Event.construct_from( JSON.parse(payload, symbolize_names: true)

Ver pagos pendientes en el Dashboard

You can view all pending bank transfer PaymentIntents in the Dashboard by applying the Waiting on funding filter to Status .

Probar tu integración

Puedes probar tu integración simulando una transferencia bancaria entrante con la API, a través del Dashboard o con una versión beta de la CLI de Stripe.

To simulate a bank transfer using the Dashboard in a sandbox, navigate to the customer’s page in the Dashboard. Under Payment methods, click Add and select Fund cash balance (test only).

Cómo gestionar problemas temporales de disponibilidad

Los siguientes códigos de error indican errores temporales en la disponibilidad del método de pago:

CódigoDescripciónHandling
payment_method_rate_limit_exceededToo many requests were made in quick succession for this payment method, which has stricter limits than the API-wide rate limits.These errors can persist for several API requests when many of your customers try to use the same payment method, such as during an ongoing sale on your website. In this case, ask your customers to choose a different payment method.

Precaución

Si prevés un consumo intensivo en general o debido a un próximo evento, contáctanos tan pronto como lo sepas.

¿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