Hadi Rickit | Builder of Things

Setting up payments with Durianpay ๐Ÿ’ฐ

Durianpay is an Indonesian payment processor similar to global players like Stripe and Square. It provides entry into the Indonesian market with a relatively low barrier to entry, decent documentation good developer support. In this article, we will go through integrating checkout into an expo or web project. I will be spinning up a backend to return an access token as well as fire some logic on successful payment in a webhook. Youโ€™ll need a durianpay account and relevant API keys Link to Durianpay documentation

How to integrate Durianpay Checkout

durianpay payment screen

  1. Pull in Durianpay script in HTML file



  1. Set up server

    • Spin up a node.js server and pull in dpay-node-sdk via your package manager of choice.
    • Initialise Durianpay like so:
      const dpay = new Durianpay({ secret_key: "your_secret_key", // Use your Sandbox or LIVE key });

  2. Create endpoint to return access token

    This /create-order endpoint will generate an access token which the client will use to initialise the checkout.



  1. Initialise checkout on client-side


  1. Webhook

A known limitation Iโ€™ve come across is that Durianpay will force a refresh and take users to redirect_url if user does not click the (x) button. This results in onSuccess, onClose and onError callbacks not firing, meaning there is a risk of successful payment but fulfilment logic not being executed.


payment success screen, durianpay

According to Durianpay, setting up a webhook is an optional step. I highly recommend it. Although it does not fix the refresh, it ensures logic is fired on your backend once payments and/or orders are completed regardless of client status.


durianpay dashboard, webhooks


  1. Webhook Signature Verification (optional)



if (event === "order.completed") { //onSuccess logic here }

In this use case I am adding a user to a lobby on successful payment, alter this accordingly to suit your needs.

  1. Deployment

I have this backend deployed via fly.io and the frontend on vercel. Fly has been very impressive so far, similar to heroku but less salesforce bloat and a better experience all around.

  1. Final thoughts

Durianpay has an overall decent developer experience. What it lacks in documentation clarity has been more than made up for with prompt response to techincal queries. They even went as far as to add my team to a whatsapp group with some of their engineers which was and continues to be invaluable

The business impact has been fantastic, the ability to enter the indonesian market and gain access to the many country specific payment options proves to be extremely useful.

Seeing how bigger players like stripe, square and xendit all have rather high barriers to entry and or a lack of support for the market, I would recommend Durianpay to any startup looking to break into the space.


Playard lobby screen


Come have a look at Playardโ€™s implementation of Durianpay. Users pay for a slot in a curated game of sport catered to their needs and preferences. There are also wallet, payout and lobby monetisation features, all of which are powered by durianpay.

@playard.id

Nguji skill pemain basket lapang umum. Ternyata rame banget!! ๐Ÿ”ฅ #basketball #basketballchallenge #bandung #basketbandung

โ™ฌ Laugh Now Cry Later - Drake

Join a game, sweat it out and make some friends in the process ๐Ÿ˜Ž