Accept a payment with Revolut Pay
Add support for Revolut Pay to your integration.
Revolut Pay is a reusable payment method where customers are required to authenticate their payment. Customers pay by being redirected from your website or app, authorising the payment with Revolut Pay, then returning to your website or app. You get immediate notification of whether the payment succeeded or failed.
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 your customer and tracks the lifecycle of the payment process. Create a PaymentIntent
on your server and specify the amount to collect and a supported currency. If you have an existing Payment Intents integration, add revolut_
to the list of payment method types.
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.
Redirect to the Revolut Pay walletClient-side
When a customer clicks to pay with Revolut Pay, use Stripe.js to submit the payment to Stripe. Stripe.js is the foundational JavaScript library for building payment flows. It automatically handles complexities like the redirect described below, and enables you to extend your integration to other payment methods. Include the Stripe.js script on your checkout page by adding it to the head
of your HTML file.
<head> <title>Checkout</title> <script src="https://js.stripe.com/basil/stripe.js"></script> </head>
Create an instance of Stripe.js with the following JavaScript on your checkout page.
// 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'
Use the client secret of the PaymentIntent
and call stripe.
to handle the Revolut Pay redirect. Add a return_
to determine where Stripe redirects the customer after they complete the payment.
const form = document.getElementById('payment-form'); form.addEventListener('submit', async function(event) { event.preventDefault(); // Set the clientSecret of the PaymentIntent const { error } = await stripe.confirmPayment({ clientSecret: clientSecret, confirmParams: { payment_method_data: { type: 'revolut_pay', }, // Return URL where the customer should be redirected after the authorization return_url: `${window.location.href}`, }, }); if (error) { // Inform the customer that there was an error. const errorElement = document.getElementById('error-message'); errorElement.textContent = result.error.message; } });
The return_
corresponds to a page on your website that displays the result of the payment. You can determine what to display by verifying the status of the PaymentIntent
. To verify the status, the Stripe redirect to the return_
includes the following URL query parameters. You can also append your own query parameters to the return_
. They persist throughout the redirect process.
Parameter | Description |
---|---|
payment_ | The unique identifier for the PaymentIntent . |
payment_ | The client secret of the PaymentIntent object. |
OptionalHandle the redirect manuallyServer-side
The best way to handle redirects is to use Stripe.js with confirmPayment
. If you need to manually redirect your customers:
- Provide the URL to redirect your customers to after they complete their payment.
- Confirm the
PaymentIntent
has a status ofrequires_
. The type for theaction next_
will be redirect_to_url.action
"next_action": { "type": "redirect_to_url", "redirect_to_url": { "url": "https://hooks.stripe.com/...", "return_url": "https://example.com/checkout/complete" } }
- Redirect the customer to the URL provided in the
next_
property.action
When the customer finishes the payment process, they’re sent to the return_
destination. The payment_
and payment_
URL query parameters are included and you can pass through your own query parameters, as described above.
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.
Receive events and run business actions
There are a few options for receiving and running business actions.
Manually
Use the Stripe Dashboard to view all your Stripe payments, send email receipts, handle payouts, or retry failed payments.
Custom code
Build a webhook handler to listen for events and build custom asynchronous payment flows. Test and debug your webhook integration locally with the Stripe CLI.
Prebuilt apps
Handle common business events, such as automation or marketing and sales, by integrating a partner application.
Supported currencies
You can create Revolut Pay payments in the currencies that map to your country. Currently, we support gbp
and eur
. The default local currency for Revolut Pay UK customers is gbp
and for other EU customers it’s eur
.
Currency | Country |
---|---|
gbp | United Kingdom |
eur | Austria, Belgium, Bulgaria, Croatia, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Ireland, Italy, Latvia, Liechtenstein, Lithuania, Luxembourg, Malta, Netherlands, Norway, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden |