Dinger

Developer / Production API / Pay API

Pay API


Pass Payload

Filling params, passing payload and receiving response.


Pay API

{{baseurl}}api/pay

baseurl for production - https://api.dinger.asia/

Once receive the token from Dinger, merchant needs to initiate the payment API which needs to encrypt with public API key that is provided by Dinger.


Request

This API requests only one payload param(base64(rsa(obj)) string) in form body.

Please be careful that items should be json format in string and ' single quotes are not allowed in json values. If you want to include ' single quotes, please include with '.


                                
// Other payment provider
val data = {
    "providerName": "AYA Pay", 
    "methodName": "QR", 
    "totalAmount" : 2200, 
    "orderId":  "11111", 
    "customerPhone" : "09787747310", 
    "customerName" : "test user name", 
    "items" : "[{‘name':'Mac','amount':'1100','quantity':'2'}]" 
 }
 
  // For Visa, Master and JCB
 val data = {
    "providerName": "AYA Pay", 
    "methodName": "QR", 
    "totalAmount" : 2200, 
    "orderId":  "11111", 
    "email": "[email protected]",
    "customerPhone" : "09787747310", 
    "customerName" : "test user name", 
    "state" : "customer state",
    "country" : "customer country", ** Must add 'code' value from Country Code List Enquiry API(/countryCodeListEnquiry) from Dinger **
    "postalCode" : "customer postal code",
    "billAddress" : "customer address",
    "billCity" : "customer city",
    "items" : "[{‘name':'Mac','amount':'1100','quantity':'2'}]" 
 }

 // transformation algorithm RSA/ECB/PKCS1Padding
 // publicKey will be provided by dinger)
 val encrypteDataWithRsa = rsa(jsonStrigify(data),publicKey)
 val payload = Base64.getEncoder().encodeToString(encrypteDataWithRsa)

Country Code List Enquiry API for Visa / Master / JCB

{{baseurl}}api/countryCodeListEnquiry


                                
{
    "code": "000",
    "message": "Request Success",
    "time": "20230109 103318",
    "response": [
        {
            "country": "Afghanistan",
            "code": "AF"
        },
        {
            "country": "Aland Islands",
            "code": "AX"
        }, ...
    ]
}

Code Sample

Payload encrypteDataWithRsa Example (RSA/ECB/PKCS1Padding)



                    
import json
import base64
from Crypto.PublicKey import RSA
from Crypto.Hash import MD5
from Crypto.Signature import pkcs1_15
from Crypto.Cipher import PKCS1_OAEP

from Cryptodome.Cipher import PKCS1_v1_5
import os

class encrypt_rsa():

    
    def __init__(self, data):
        # replace with your public key
        public_key = ("-----BEGIN PUBLIC KEY-----\n"+
        "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCy7O9ULgdfc1SUXrU0W2qWg3l8VbvNpvq+ilwPDdq4EYzKwOe97Zd2wtW8HJQF7GNn2SaeHLCilsAJTYPLb+uRzXz3Aozxx8u6Bk5mGMVqi9rXXCNQCpRZYgM/7JDvtO5UhLCiMFHFO2f2c0QCmdR+yzdP6anJk9vLikuBwWxY6wIDAQAB"+
        "\n-----END PUBLIC KEY-----")
        self.message = data.encode()
        self.public_key = RSA.import_key(public_key)


    # Segmentation encryption
    def encrypt(self):
        try:
            cipher_rsa = PKCS1_v1_5.new(self.public_key)
            res = []
            for i in range(0, len(self.message), 64):
                enc_tmp = cipher_rsa.encrypt(self.message[i:i+64])
                res.append(enc_tmp)
            cipher_text = b''.join(res)
        except Exception as e:
            print(e)
        else:
            return base64.b64encode(cipher_text).decode()


if __name__ == '__main__':

    payload = "{providerName: 'KBZ Pay',methodName: PWA,orderId: 'test-23112021001',customerPhone: '959796564600', description:'Test',customerAddress:'Yangon, Myanmar' ,totalAmount: 2200, email: '[email protected]', customerName: 'test username', items:'[{\"name\":\"Apple\",\"amount\":\"1100\",\"quantity\":\"2\"}]'}"

    payload_encrypt = encrypt_rsa(payload).encrypt()
    print(str(payload_encrypt))


Provider and Methods

Before using payment provider and methods, you need to click (ON) button on merchant dashboard payment settting page

Setting Page in Merchant Dashboard



Notes for Merchant Developers

There are mainly three types of payment providers

1. Rendering QR image and scan QR code by customers with respective payment wallet apps
2. Receiving notification on pay wallet apps and do payment
3. Redirecting respective payment provider's payment form on web (for this kinds of redirect payment, you'll receive formtoken value in pay api response and need to redirect properly. For redirecting reference, please see Section 2.5)


Payment Providers List

Provider Method Accept Decimal Amount Payment Flow
AYA pay QR,PIN No QR - scan QR
PIN - receives notification on AYA wallet
KBZ Pay QR , PWA Yes QR - scan QR
PWA - opens KBZ Pay app directly
Citizens Pay PIN No Citizens Pay form redirect
Wave Pay PIN No Wave Pay form redirect
MPU OTP Yes MPU Pay form redirect
Mytel PIN No Mytel Pay form redirect
Sai Sai Pay PIN No receives notification on Sai Sai Pay wallet
Onepay PIN No receives notification on Onepay wallet
MPitesan PIN No receives notification on M-Pitesan wallet
KBZ Direct Pay PWA Yes KBZ Direct Pay form redirect(mobile banking)
Visa OTP Yes Visa form redirect
Master OTP Yes Master form redirect
MPU OTP Yes JCB form redirect
CB Pay QR Yes CB Pay QR form redirect
MAB Bank OTP Yes MAB Mobile Banking web page redirect
MPT Pay PIN Yes MPT Pay web page redirect
OK $ PIN Yes OK $ web page redirect
UAB Pay PIN No receives notification on UAB Pay wallet

Pay API Request Parameter

Name Type Length Mandatory Description Value
providerName String 20 Char Yes Name of the payment provider that the user chooses (see the list of provided provider name in Provider and Methods Table) AYA Pay
methodName String 20 Char Yes Name of the payment method that the user chooses (see the list of provided method name in Provider and Methods Table) QR, PIN , PWA
totalAmount Integer Yes The total amount of the order Min amount - 500 MMK, Max amount - 999999999 MMK
orderId String 50 Char Yes Unique ID for each order Eg- Order 001
description String No Cutomer order description Eg - call this number 095412313 before delivery
customerAddress String No Customer address Eg - No(70), Thukha street, ...
customerPhone String 50 Char Yes Mobile number of the customers Eg- 095412313
customerName String 50 Char Yes Customer name Eg- Mg Mg
Items String Json Array Yes Lists of the keys ( Name, Amount and Quantity) Remark: This amount should be same with total amount from above [{‘name':'Mac','amount':'1100','quantity':'2'}]
email String Yes (For Visa, Master and JCB) No (For other payment providers) Customer Email Eg- [email protected]
billAddress String Yes (For Visa, Master and JCB) No (For other payment providers) Billing Address Eg- No.70, Thukha street, ...
billCity String Yes (For Visa, Master and JCB) No (For other payment providers) Billing City Eg- Yangon
description String No Description or notes of the payment Eg- Buying Dinger Products
currency String 50 Char No Currency of the payment MMK, USD (When you do not add, default will be 'MMK')

HEADERS


    

Authorization Bearer {{paymentToken}}



BODY formdata


    

payload {payload}




                                    

curl --location --request POST '{{baseurl}}api/pay'
--header 'Authorization: Bearer {{paymentToken}}'
--form 'payload={payload}'


Form Redirect

Redirect to Dinger KBZ PAY PWA, KBZ Direct Pay, Wave Pay, Citizens and Mytel Gateway, MAB Bank, MPT Pay, OK$


METHOD GET
URL https://portal.dinger.asia/gateway/redirect?transactionNo={transactionNo}&formToken={formToken}&merchantOrderId={merchantOrderId}

Redirect to M-Pitesan Gateway


METHOD GET
URL https://portal.dinger.asia/gateway/mpitesan?transactionNumber={transactionNumber}&formToken={formToken}&merchantOrderId={merchantOrderId}

Redirect to CB Pay QR Gateway


METHOD GET
URL https://portal.dinger.asia/gateway/cbpay?transactionNumber={transactionNumber}&formToken={formToken}&merchantOrderId={merchantOrderId}

Redirect to Dinger MPU Gateway


METHOD GET
URL https://portal.dinger.asia/gateway/mpu?transactionNumber={transactionNumber}&formToken={formToken}

Redirect to Visa, Master and JCB Gateway


METHOD GET
URL https://creditcard-portal.dinger.asia/?merchantOrderId={merchantOrderId}&transactionNum={transactionNum}&formToken={formToken}

No need to redirect to KBZ Pay QR,AYA Pay QR,AYA Pay Pin,ONE Pay Pin and SAI SAI Pay Pin


Response



                                    
{
   "totalAmount":1000,
   "createdAt":"20210916 085233",
   "transactionStatus":"SUCCESS",
   "methodName":"QR",
   "merchantOrderId":"0586",
   "transactionId":"TRX312720215216085254",
   "customerName":"Min Thu Kyaw",
   "providerName":"KBZ Pay"
}