eWallets
eWallet is a secure and easy payment method which is expected to surpass credit card usage in the next five years.
Enable your customers to use their preferred eWallet to pay for purchases on your website or app. An eWallet is a payment category utilizing unique local payment methods a part of the Rapyd Global Payments Network.
Common eWallet Payments include:
GrabPay (Southeast Asia)
PayTM (India)
Samsung Pay ewallet (Korea)
FamiPay (Japan)
eWallets Payment Method
If you are using Rapyd Hosted Checkout, simply select eWallet as one of your accepted payment methods. A full list of eWallet Payment Methods is found in Client Portal as described in Viewing Payment Methods
Select your eWallet.
Click Place Your Order .
Complete the payment.
Redirect to the payment success page.
Finding the specific ewallet payment methods you'll accept and the corresponding required fields that customers fill out is described under How it Works.
A customer using your website or app selects an item that costs 19.99 SGD (Singapore Dollars) and adds it to the shopping cart. The customer presses the checkout button and arrives on the payment page and selects the option to pay with an ewallet.
You request Rapyd for the ewallet details and present to customer.
The customer fills in the ewallet details and confirms the payment by pressing Pay.
The website back end requests Rapyd to process the customer's payment, specifying the amount, currency, payment method, and your payment success URL and error URL.
Rapyd processes the transaction and responds with a unique URL for the customer to complete the payment. The URL is valid only for this payment.
Your website directs the customer to the redirect URL of the ewallet website.
On the ewallet website, the customer follows the instructions to complete the payment by entering ewallet details.
The ewallet website redirects the customer to the URL you specified for a successful payment or for an unsuccessful payment. The ewallet website notifies Rapyd.
Rapyd sends a webhook to your back end, indicating that the payment was completed.
Country and Currency Example
SG (Singapore) and SGD (Singapore Dollar) is used 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:
Description of Query 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
// Request URL: GET https://sandboxapi.rapyd.net/v1/payment_methods/country?country=SG¤cy=SGD // Message body absent
List Payment Methods by Country Response
List Payment Methods by Country describes the fields in the response.
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.
List Payment Method Response
A full response lists many payment methods.
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:
Description of Path Parameters
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
// Request URL: GET https://sandboxapi.rapyd.net/v1/payment_methods/sg_grabpay_ewallet/required_fields // Message body absent
Get Payment Method Required Fields Response
Payment Method Required Fields describes the fields in the response.
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 ne
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:
Description of Body Parameters
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:
|
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 (19.99 SGD in this case) and to collect the payment for you.
Request
/ 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
See Create Payment for a description of the fields in the response.
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
(underdata
) is ACT (active). This means that the payment process is active but not complete.These URLs are included:
redirect_url
- You redirect your customer to this one-time eWallet website URL to complete the payment.complete_payment_url
anderror_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:
The eWallet website redirects the customer to the URL you provided for a successful payment.
The eWallet website informs Rapyd that the payment was completed successfully.
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 .
Webhook
{ "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.