Advanced Usecases


Using /token APIs on your backend

Use following endpoint to create a short lived token

/merchants/token

This should be done ONLY from your backend/servers since it requires you to use your secret API key as auth

All Durianpay APIs are authorized using `Basic` Authorization. Basic authorization requires your secret key which can be obtained from Durianpay dashboard or through your dedicated Customer Success Manager.

Use Redirect URLs to take users to your own payments success page

If you want to redirect your customers to a custom landing page post successful (or failed) payment, you can achieve it by directly passing redirect_url while initializing our sdk.

Alternatively, you can also handle this in onSuccess and onFailure javascript callbacks

client.js
var dpay = Durianpay.init({
    locale: "id",
    access_key: "c6e8ed8e650b08bef67808617c25fbfa",
    redirect_url: "https://testmerchant.com/redirect_landing_page",    ...
    container_elem: "pay-btn-container",
});

Order create - Advanced Features

Checkout customizations

Apart from theme/colors, logo etc you can also configure which payment methods you want to show to your users in the checkout. Please talk to your dedicated Customer Success Manager to know more about this who can help set it up for the first time.

Durian Checkout is fully configurable and comes with many pluggable modules e.g. order summary, shipping info, promos etc for you to use. Also, you can get exact steps configured to optimize your users' payment journey even more.

Using Address module

You can pass address_info as extra paramter during order creation and checkout initialization on client to show address information for the customers (if you have the address module enabled). This field is OPTIONAL and if you do not pass, customers will be asked to fill in address details (if you have address module enabled).

client.js
var dpay = Durianpay.init({
    locale: "id",
    access_key: "c6e8ed8e650b08bef67808617c25fbfa",
    site_name: "testmerchant.com",
    order_info: {
        id: "ord_XASDadse2312asd31",
        customer_info: {
            id: "cus_F5OHtM2L6u4292",
            email: "jose@testmerchant.com",
            phone: "+6285722173217",
            name: "Jose",
            addressInfo: {                receiver_name: "Jude Casper",                receiver_phone: "8987654321",                label: "Jude's Address",                address_line_1: "Cambridge layout",                address_line_2: "Apartment #786",                city: "Bangalore",                region: "Jogupalya",                country: "Indonesia",                postal_code: "560008",                landmark: "Kota Jakarta Selatan"            }
        }
    },
    container_elem: "pay-btn-container",
});

Using Items

While creating orders, you can pass information about items that the customer is purchasing so that it can be showed to the customer properly in order summary while checking out (if you have order summary module enabled).

server.js
var options = {
  amount: "20000",
  currency: "IDR",
  customer: {
    ...
  },
  items: [        {            "name": "LED Television",            "qty": 1,            "price": "925001.55",            "logo": "/static/tv_image.jpg"        }  ]};