Skip to content

revolut-engineering/revolut-checkout-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Revolut Pay example

This repository contains an example integration of Revolut Pay, demonstrating how to integrate Revolut Pay's payment processing capabilities in your web application. It includes setup instructions, webhook configuration, and testing guidelines using Revolut's Merchant API.

System requirements

  • Node.js 16 or later

Setup

  1. Clone this repo

    $ git clone [email protected]:revolut-engineering/revolut-checkout-example.git
    $ cd revolut-checkout-example/server
  2. Install dependencies

    $ npm install
  3. Create a Revolut Business sandbox account

  4. Update your API keys

    Copy and rename .env.example file to .env and update it with your keys

    REVOLUT_API_PUBLIC_KEY=<your_revolut_public_key>
    REVOLUT_API_SECRET_KEY=<your_revolut_secret_key>
    
  5. Run the server

    $ npm start

Tip

For testing purposes you can use our test cards. For testing other environments you can change the REVOLUT_API_URL, update you Revolut keys and start the server again.

Webhooks

The Revolut Merchant API supports webhooks to push event notifications corresponding to order and payment status changes to an specified URL.

Set up webhooks for your localhost

  1. Set a public URL for your localhost

    Use ngrok or any similar tool to obtain a public URL.

    $ npm install ngrok -g
    $ ngrok http 5177
  2. Set up a webhook URL in the Merchant API

    Check the Create a webhook endpoint in the Merchant API specification.

    Replace <yourSecretApiKey> with the same key you used in the .env file (REVOLUT_API_SECRET_KEY) and <yourPublicUrl> with the public URL obtained in the previous step.

    curl -L -X POST 'https:/sandbox-merchant.revolut.com/api/1.0/webhooks' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer <yourSecretApiKey>' \
    --data-raw '{
      "url": "<yourPublicUrl>",
      "events": [
        "ORDER_COMPLETED",
        "ORDER_AUTHORISED"
      ]
    }'

    The response has the following JSON structure:

    {
      "id": "396a4d93-70c3-44ca-8fb9-ca903a5505d7",
      "url": "<your_public_url>/webhook",
      "events": ["ORDER_COMPLETED", "ORDER_AUTHORISED"],
      "signing_secret": "<signing_secret_key>"
    }
  3. Use the signing_secret in your .env file (REVOLUT_WEBHOOK_SECRET) and start the server.

  4. You should see events logged in the console where the CLI is running.

Documentation

Read more about Revolut Pay on our official Developer Portal.

Related


© Revolut LTD

About

Revolut Pay - Integration Example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published