eWallets

eWallet is a secure and easy payment method which is expected to surpass credit card usage in the next five years.

Tap Into One of the Most Widely Used Payment Methods in the World

Enable your customers to use their preferred eWallet to pay for purchases on your website or app.

How It Works

📘

If you are using Rapyd Hosted Checkout, simply select eWallet as one of your accepted payment methods.

Follow the steps below to see how your customer can use an eWallet to complete a purchase.

Find Available eWallets

Note: For illustration purposes, we will use SG (Singapore) and SGD (Singapore Dollar) for country and currency in the sample codes below.

To identify eWallets that are available in SG and SGD, use List Payment Methods by Country with the following parameters:

Query Parameter

Description

country

Enter SG as the country code.

currency

Enter SGD as the currency code.

List Payment Methods by Country Request

Request a list of all payment methods available in SG that support SGD.

// Request URL: GET https://sandboxapi.rapyd.net/v1/payment_methods/country?country=SG&currency=SGD

// Message body absent

List Payment Methods by Country Response

The response is generated below:

Note: See Payment Object for a description of the fields in the response.

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "53776342-3d2d-4f20-b54b-8b402f6ef88c"
    },
    "data": 
    [
        {
            "type": "sg_grabpay_ewallet",
            "name": "Grabpay eWallet Payments Singapore",
            "category": "ewallet",
            "image": "",
            "country": "sg",
            "payment_flow_type": "redirect_url",
            "currencies": [
                "SGD"
            ],
            "status": 1,
            "is_cancelable": false,
            "payment_options": [],
            "is_expirable": false,
            "is_online": false,
            "minimum_expiration_seconds": null,
            "maximum_expiration_seconds": null
        }
    ]
}

The data section of this response shows that sg_grabpay_ewallet is an acceptable eWallet payment method.

Note: A real response usually lists many payment methods.

Find the Required Fields for the Payment Method

Identify the fields that your customer needs to complete for the payment method. To do that, use Get Payment Method Required Fields with the following parameter:

Path Parameter

Description

type

Enter sg_grabpay_ewallet as the payment method type.

Get Payment Method Required Fields Request

Request a set of required fields for sg_grabpay_ewallet.

// Request URL: GET https://sandboxapi.rapyd.net/v1/payment_methods/required_fields/sg_grabpay_ewallet

// Message body absent

Get Payment Method Required Fields Response

The response is generated below:

Note: See Payment Object for a description of the fields in the response.

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "4d0d21b9-8cc0-4e93-81c3-27a184fdd8c2"
    },
    "data": {
        "type": "sg_grabpay_ewallet",
        "fields": [],
        "payment_method_options": [],
        "payment_options": [],
        "minimum_expiration_seconds": null,
        "maximum_expiration_seconds": null
    }
}

The response shows that for sg_grabpay_ewallet, the customer does not need to complete any additional fields.

Process the Payment

When your customer checks out on your website, use Create Payment with the following parameters to get Rapyd to process your customer's bank payment:

Body Parameter

Description

amount

Enter 19.99 as the payment amount.

currency

Enter SGD as the currency code.

payment_method

Enter an object with the following fields:
type - sg_grabpay_ewallet
fields - An empty object.

complete_payment_url

Replace the https://success_example.net example with your real website URL where you want to redirect the customer to when the payment succeeds.

error_payment_url

Replace the https://error_example.net example with your real website URL where you want to redirect the customer to when the payment fails.

Create Payment Request

Request Rapyd to process the customer's eWallet payment (SGD 19.99 in this case) and to collect the payment for you.

// Request URL: POST https://sandboxapi.rapyd.net/v1/payments

// Message body: 
{
    "amount": 19.99,
    "currency": "SGD",
    "payment_method": {
        "type": "sg_grabpay_ewallet",
        "fields": {}
    },
    "complete_payment_url":"http://www.example.com/complete",
    "error_payment_url":"http://www.example.com/error"
}

Create Payment Response

The response is generated below:

Note: See Payment Object for a description of the fields in the response.

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "f3b3a4f5-1713-460b-a770-ec8f4c2ccbb2"
    },
    "data": {
        "id": "payment_56410597a0196e1eec00954b3440461b",
        "amount": 0,
        "original_amount": 19.99,
        "is_partial": false,
        "currency_code": "SGD",
        "country_code": "sg",
        "status": "ACT",
        "description": "",
        "merchant_reference_id": "",
        "customer_token": "cus_1daa2cf4216845afdd277bb6d8f9dadf",
        "payment_method": "other_6afd4e09b6a2d22b7460a5dc3810112a",
        
//      ...          
          
        "redirect_url": "https://sandboxdashboard.rapyd.net/complete-bank-payment?token=payment_56410597a0196e1eec00954b3440461b&complete_payment_url=https://success_example.net&error_payment_url=https://error_example.net",
        "complete_payment_url": "https://success_example.net",
        "error_payment_url": "https://error_example.net",
        
//      ...          
          
        "created_at": 1591620906,
        
//      ...          
          
        "ewallet_id": "ewallet_1a867a32b47158b30a8c17d42f12f3f1",
        "ewallets": [
            {
                "ewallet_id": "ewallet_1a867a32b47158b30a8c17d42f12f3f1",
                "amount": 19.99,
                "percent": 100,
                "refunded_amount": 0
            }
        ],
        "payment_method_options": {},
        "payment_method_type": "sg_grabpay_ewallet",
        "payment_method_type_category": "ewallet",
          
//     ...  
          
    }
}

The response shows:

  • The payment id is payment_56410597a0196e1eec00954b3440461b. When you run this example in your own sandbox, you will get a different ID, which you will need for later steps.
  • The amount is 19.99.
  • The currency_code is SGD (Singapore dollars).
  • The status (under data) is ACT (active). This means that the payment process is active but not complete. Payment Object lists possible values for status.
  • These URLs are included:
    • redirect_url - You redirect your customer to this one-time eWallet website URL to complete the payment.
    • complete_payment_url and error_payment_url - Rapyd provides these URLs to the eWallet website to redirect the customer back to your website depending on whether the purchase succeeded.

Your website redirects the customer to the eWallet website.
After the customer successfully pays:

  1. The eWallet website redirects the customer to the URL you provided for a successful payment.
  2. The eWallet website informs Rapyd that the payment was completed successfully.
  3. Rapyd sends you a webhook with details of the completed transaction.

👍

Simulating a Local eWallet Payment

The sandbox does not directly simulate the action of the customer completing the transaction with the local eWallet. You can simulate this action with the procedure described in Complete Payment. For this, you will need the payment ID that you generated in your sandbox.

Configure your system to receive webhooks with the procedure described in Defining a Webhook Endpoint.

Let's take a look at Webhook - Payment Completed.

{
    "id": "wh_718940ccd8fd308b43da58fdd05thj78",
    "type": "PAYMENT_COMPLETED”,

",
    "data": {
        "id": "payment_56410597a0196e1eec00954b3440461b",
        "fee": 0,
        "paid": true,
        "order": null,
        "amount": 19.99,
        "status": "CLO",

//      ...      

        "captured": true,

//      ...      

        "created_at": "1591620916",

//      ...      

        "redirect_url": "https://sandboxdashboard.rapyd.net/complete-bank-payment?token=payment_56410597a0196e1eec00954b3440461b&complete_payment_url=https://success_example.net&error_payment_url=https://error_example.net",

//      ...      


        "currency_code": "SGD",

//      ...      

        "customer_token": "cus_1daa2cf4216845afdd277bb6d8f9dadf",
        "payment_method": "other_6afd4e09b6a2d22b7460a5dc3810112a",

//      ...      

        "original_amount": 19.99,

//      ...      
   
        "error_payment_url": "https://https://error_example.net",
        "payment_method_type": "",
        "complete_payment_url": "https://success_example.net",

//      ...      

        "payment_method_type_category": "ewallet"
    },

//      ...      

    "created_at": 1591620906
}

The data section of the webhook contains the same type of information as the response to the Create Payment request, except that the status now is CLO (closed). This shows that the transaction is complete.


Updated about 19 hours ago


What's Next

Billing

eWallets


eWallet is a secure and easy payment method which is expected to surpass credit card usage in the next five years.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.