Accept a payment with Revolut Pay
Add support for Revolut Pay to your integration.
We recommend that you use the Mobile Payment Element, an embeddable payment form, to add Revolut Pay (and other payment methods) to your integration with the least amount of effort.
This guide covers how to accept Revolut Pay from your native mobile application using your own custom payment form.
If you accept Revolut Pay from your native mobile application, your customers are redirected to the Revolut Pay mobile application for authentication. The payment is authenticated during the redirect. No additional action is needed in the Revolut Pay mobile application to complete the purchase. The customer is then redirected back to your site.
Set up StripeServer-sideClient-side
First, you need a Stripe account. Register now.
Server-side
This integration requires endpoints on your server that talk to the Stripe API. Use the official libraries for access to the Stripe API from your server:
Client-side
The Stripe Android SDK is open source and fully documented.
To install the SDK, add stripe-android
to the dependencies
block of your app/build.gradle file:
Note
For details on the latest SDK release and past versions, see the Releases page on GitHub. To receive notifications when a new release is published, watch releases for the repository.
Configure the SDK with your Stripe publishable key so that it can make requests to the Stripe API, such as in your Application
subclass:
Note
Stripe samples also use OkHttp and GSON to make HTTP requests to a server.
Create a PaymentIntentServer-sideClient-side
Server-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.
To create and confirm a PaymentIntent
on your server:
- Specify the amount to collect and the currency.
- Add
revolut_
to the list of payment method types for yourpay PaymentIntent
. Make sure Revolut Pay is enabled in the Dashboard.
The returned PaymentIntent includes a client secret, that you’ll use to confirm the PaymentIntent. Send the client secret back to the client so you can use it in the next step.
Client-side
On the client, request a PaymentIntent from your server and store its client secret.
Submit the payment to StripeClient-side
When a customer taps to pay with Revolut Pay, confirm the PaymentIntent
to complete the payment. Configure a ConfirmPaymentIntentParams
object with the PaymentIntent
client secret.
The client secret is different from your API keys that authenticate Stripe API requests. Handle it carefully, because it can complete the charge. Don’t log it, embed it in URLs, or expose it to anyone.
Confirm Revolut Pay payment
Complete the payment by calling PaymentLauncher confirm. This presents a webview where the customer can complete the payment with Revolut Pay. Upon completion, the provided PaymentResultCallback
is called with the result of the payment.
Test your integration
Test your Revolut Pay integration with your test API keys by viewing the redirect page. You can test the successful payment case by authenticating the payment on the redirect page. The PaymentIntent transitions from requires_
to succeeded
.
To test the case where the user fails to authenticate, use your test API keys and view the redirect page. On the redirect page, click Fail test payment. The PaymentIntent transitions from requires_
to requires_
.
For manual capture PaymentIntents in testmode, the uncaptured PaymentIntent auto-expires 7 days after successful authorisation.
Failed payments
Revolut Pay uses multiple data points to determine when to decline a transaction (for example, their AI model detected high fraud risk for the transaction, or the customer has revoked your permission to charge them in Revolut Pay).
In these cases, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_
.
Other than a payment being declined, for a Revolut Pay PaymentIntent with a status of requires_
, customers must complete the payment within 10 minutes after they’re redirected to Revolut Pay. If no action is taken after 10 minutes, the PaymentMethod is detached and the PaymentIntent object’s status automatically transitions to requires_
.
When this happens, the Payment Element renders error messages and instructs your customer to retry using a different payment method.
Error codes
The following table details common error codes and recommended actions:
Error Code | Recommended Action |
---|---|
missing_ | Check the error message for more information about the required parameter. |
payment_ | This code can appear in the last_payment_error.code field of a PaymentIntent. Check the error message for a detailed failure reason and suggestion on error handling. |
payment_ | Provide a return_ when confirming a PaymentIntent with Revolut Pay. |