Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment Methods
Add payment methods
    Overview
    Payment method integration options
    Manage default payment methods in the Dashboard
    Payment method types
    Cards
    Pay with Stripe balance
    Crypto
    Bank debits
    Bank redirects
    Bank transfers
    Credit transfers (Sources)
    Buy now, pay later
    Real-time payments
    Vouchers
    Wallets
      Alipay
      Amazon Pay
      Apple Pay
      Cash App Pay
      Google Pay
      GrabPay
        Accept a payment
      Link
      MB WAY
      MobilePay
      PayPal
      PayPay
      Revolut Pay
      Satispay
      Secure Remote Commerce
      Vipps
      WeChat Pay
    Enable local payment methods by country
    Custom payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Payments
Payment scenarios
Handle multiple currencies
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Beyond payments
Incorporate your company
Crypto
Financial Connections
Climate
Understand fraud
Radar fraud protection
Manage disputes
Verify identities
HomePaymentsAdd payment methodsWalletsGrabPay

Accept a GrabPay payment

Learn how to accept GrabPay, a common payment method in Southeast Asia.

Note

Subscriptions and using GrabPay for future payments aren’t currently supported. Reach out to Stripe support for any support queries on these features.

GrabPay is a single-use payment method. Customers pay with GrabPay by redirecting from your app to GrabPay, authorising the payment, then returning to your app where you get immediate notification on whether the payment succeeded or failed.

Note

Learn more about activating GrabPay in the Dashboard.

Set up Stripe
Server-side

First, you need a Stripe account. Register now.

Use our official libraries for access to the Stripe API from your application:

Command Line
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
# Available as a gem sudo gem install stripe
Gemfile
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Create a PaymentIntent
Server-side

A PaymentIntent represents your intent to collect payment from a customer and tracks the lifecycle of the payment process.

Create a PaymentIntent on your server and specify the amount to collect and sgd or myr as the currency. There is no minimum charge amount for GrabPay so the payment amount can be as low as 1. If you have an existing Payment Intents integration, add grabpay to the list of payment method types.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d "payment_method_types[]"=grabpay \ -d amount=1099 \ -d currency=sgd

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.

Retrieve the client secret from an endpoint on your server, using the browser’s fetch function. This approach is best if your client side is a single-page application, particularly one built with a modern front-end framework such as React. Create the server endpoint that serves the client secret:

main.rb
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
get '/secret' do intent = # ... Create or retrieve the PaymentIntent {client_secret: intent.client_secret}.to_json end

And then fetch the client secret with JavaScript on the client side:

(async () => { const response = await fetch('/secret'); const {client_secret: clientSecret} = await response.json(); // Render the form using the clientSecret })();

Submit the payment to Stripe
Client-side

When a customer clicks to pay with GrabPay, 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.

checkout.html
<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.

client.js
// 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'
);

To create a payment on the client side, add a Pay with GrabPay button and use stripe.confirmGrabPayPayment to handle the redirect away from your page and to complete the payment.

checkout.html
<button type="button" id="grabpay-button">Pay with GrabPay</button> <div id="error-message"></div>
client.js
const button = document.getElementById('grabpay-button'); button.addEventListener('click', async function() { // By this point, the PaymentIntent should have already been created // Pass the clientSecret of the PaymentIntent to confirmGrabPayPayment stripe.confirmGrabPayPayment(clientSecret, { // Return URL where the customer should be redirected after the authorization return_url: 'https://example.com/checkout/complete', }); });

Pass the client secret of the PaymentIntent object that you created in Step 2 to stripe.confirmGrabPayPayment.

Additionally, add a return_url to this function to indicate where Stripe should redirect the user after they complete the payment on Grab’s website.

When your customer submits a payment, Stripe redirects them to the return_url and includes the following URL query parameters. The return page can use them to get the status of the PaymentIntent so it can display the payment status to the customer.

When you specify the return_url, you can also append your own query parameters for use on the return page.

ParameterDescription
payment_intentThe unique identifier for the PaymentIntent.
payment_intent_client_secretThe client secret of the PaymentIntent object. For subscription integrations, this client_secret is also exposed on the Invoice object through confirmation_secret

When the customer is redirected back to your site, you can use the payment_intent_client_secret to query for the PaymentIntent and display the transaction status to your customer.

order_confirmation.html
<h2>Payment result</h2> <div class="payment-result"> </div> <script> // Check if we're returning from a redirect. const url = new URL(window.location.href); const paymentIntentClientSecret = url.searchParams.get( "paymentIntentClientSecret" ); if (paymentIntentClientSecret) { stripe.retrievePaymentIntent(paymentIntentClientSecret).then(function(result) { const paymentIntent = result.paymentIntent; document.querySelector(".payment-result").textContent = paymentIntent.status; }); } </script>

Test your integration

When testing, the client side redirect brings you to a Stripe-hosted GrabPay test payment page where you can either authorise or fail the test payment.

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.

  • View your test payments in the Dashboard

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.

  • Build a custom webhook

Prebuilt apps

Handle common business events, such as automation or marketing and sales, by integrating a partner application.

OptionalHandle the GrabPay redirect manually

We recommend relying on Stripe.js to handle GrabPay redirects and payments with confirmGrabPayPayment. However, you can also manually redirect your customers by:

  1. Providing the URL where your customers will be redirected after they complete their payment.
Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents/{{PAYMENT_INTENT_ID}}/confirm \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ --data-urlencode return_url="https://example.com/checkout/complete" \ -d "payment_method_data[type]"=grabpay
  1. Confirming the PaymentIntent has a status of requires_action. The type for the next_action will be redirect_to_url.
{ "next_action": { "type": "redirect_to_url", "redirect_to_url": { "url": "https://hooks.stripe.com/...", "return_url": "https://example.com/checkout/complete" } }, "payment_method_types": [ "grabpay" ], "id": "pi_1G1sgdKi6xqXeNtkldRRE6HT", "object": "payment_intent", "amount": 1099, "confirmation_method": "automatic",
  1. Redirecting the customer to the URL provided in the next_action property.
const action = intent.next_action; if (action && action.type === 'redirect_to_url') { window.location = action.redirect_to_url.url; }

When the customer finishes the payment process, they’re sent to the return_url destination. The payment_intent and payment_intent_client_secret URL query parameters are included and you can pass through your own query parameters, as described above.

Supported currencies

Stripe users in Malaysia and Singapore can accept GrabPay payments from customers in Malaysia and Singapore respectively. Review the supported currencies and GrabPay transaction limits below:

CountryCustomer countrySupported currencyTransaction limits
Singapore (SG)Singapore (SG)SGDGrabPay SG
Malaysia (MY)Malaysia (MY)MYRGrabPay MY
Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Join our early access programme.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc