Accept a Bancontact payment
Learn how to accept Bancontact, a common payment method in Belgium.
Bancontact is a single use payment method where customers are required to authenticate their payment. Customers pay with Bancontact by redirecting from your app, authenticating the payment, then returning to your app where you get immediate notification on whether the payment succeeded or failed.
Note
Your use of Bancontact must be in accordance with the Bancontact Terms of Service.
Set up StripeServer-side
First, you need a Stripe account. Register now.
Use our official libraries for access to the Stripe API from your application:
Create a PaymentIntentServer-side
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 your server and specify the amount to collect and the eur
currency (Bancontact does not support other currencies). If you have an existing Payment Intents integration, add bancontact
to the list of payment method types.
The default language of the Bancontact authorization page is English (en
). You can match the preferred language of your customer by setting preferred_
to fr
, nl
, or de
.
Retrieve the client secret
The PaymentIntent includes a client secret that the client side uses to securely complete the payment process. You can use different approaches to pass the client secret to the client side.
Submit the payment to StripeClient-side
Create a payment on the client side with the client secret of the PaymentIntent
. The client secret is different from your API keys that authenticate Stripe API requests. It should be handled carefully because it can complete the charge. Do not log it, embed it in URLs, or expose it to anyone but the customer.
Handling the redirect
The following URL query parameters are provided when Stripe redirects the customer to the return_
.
Parameter | Description |
---|---|
payment_ | The unique identifier for the PaymentIntent . |
payment_ | The client secret of the PaymentIntent object. |
You may also append your own query parameters when providing the return_
. They persist throughout the redirect process. The return_
should correspond to a page on your website that provides the status of the payment. You should verify the status of the PaymentIntent
when rendering the return page. You can do so by using the retrievePaymentIntent
function from Stripe.js and passing in the payment_
.
(async () => { const url = new URL(window.location); const clientSecret = url.searchParams.get('payment_intent_client_secret'); const {paymentIntent, error} = await stripe.retrievePaymentIntent(clientSecret); if (error) { // Handle error } else if (paymentIntent && paymentIntent.status === 'succeeded') { // Handle successful payment } })();
Bank account details
You can find details about the bank account the customer used to complete the payment on the resulting charge under payment_method_details.
{ "charges": { "data": [ { "payment_method_details": { "bancontact": { "bank_code": "VAPE", "bank_name": "VAN DE PUT & CO", "bics": "VAPEBE22", "iban_last4": "7061", "preferred_language": "en", "verified_name": "Jenny Rosen" }, "type": "bancontact" }, "id": "src_16xhynE8WzK49JbAs9M21jaR", "object": "source",
OptionalHandle post-payment events
Stripe sends a payment_intent.succeeded event when the payment completes. Use the Dashboard, a custom webhook, or a partner solution to receive these events and run actions, like sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow.
Listen for these events rather than waiting on a callback from the client. On the client, the customer could close the browser window or quit the app before the callback executes, and malicious clients could manipulate the response. Setting up your integration to listen for asynchronous events also helps you accept more payment methods in the future. Learn about the differences between all supported payment methods.
Handle events manually in the Dashboard
Use the Dashboard to View your test payments in the Dashboard, send email receipts, handle payouts, or retry failed payments.
Build a custom webhook
Build a custom webhook handler to listen for events and build custom asynchronous payment flows. Test and debug your webhook integration locally with the Stripe CLI.
Integrate a prebuilt app
Handle common business events, such as automation or marketing and sales, by integrating a partner application.
OptionalHandle the Bancontact redirect manually
We recommend relying on Stripe.js to handle Bancontact redirects and payments client-side with confirmBancontactPayment
. Using Stripe.js helps extend your integration to other payment methods. However, you can also manually redirect your customers on your server by following these steps:
Create and confirm a PaymentIntent of type
bancontact
. You must provide thepayment_
property, which you should collect from your customer. Note that, by specifyingmethod_ data. billing_ details. name payment_
, a PaymentMethod is created and immediately used with this PaymentIntent.method_ data You must also provide the URL where your customer is redirected to after they complete their payment in the
return_
field. You may optionally provide your own query parameters in this URL. These parameters will be included in the final URL upon completing the redirect flow.url
- Check that the
PaymentIntent
has a status ofrequires_
and the type foraction next_
isaction redirect_
.to_ url
{ "status": "requires_action", "next_action": { "type": "redirect_to_url", "redirect_to_url": { "url": "https://hooks.stripe.com/...", "return_url": "https://example.com/checkout/complete" } }, "id": "pi_1G1sgdKi6xqXeNtkldRRE6HT", "object": "payment_intent", ... }
- Redirect the customer to the URL provided in the
next_
property. This code example is approximate—the redirect method might be different in your web framework.action. redirect_ to_ url. url
Your customer is redirected to the return_
when they complete the payment process. The payment_
and payment_
URL query parameters are included along with any of your own query parameters. Stripe recommends setting up a webhook endpoint to programmatically confirm the status of a payment.