Skip to main content

Signature

Java

Download Signature SDK

package com.pay.util;

import java.util.HashMap;
import java.util.Map;

public class SignDemo {
public static void main(String[] arg) {
String appId = "YOUR_APP_ID";
String appSecret = "YOUR_APP_SECRET";

Map<String, Object> request = new HashMap<>(8);
request.put("appId", appId);
request.put("version", "1.1");
request.put("returnUrl", "https://example.com/returnurl");
request.put("notifyUrl", "https://example.com/notifyurl");

request.put("merTransNo", "YOUR_ORDER_NO");
request.put("currency", "INR");
request.put("amount", "10");

Map<String, Object> extInfo = new HashMap<>(2);
request.put("extInfo", extInfo);

String sign = SignUtil.create(appSecret, request);
request.put("sign", sign);

System.out.println(sign);
}
}

PHP

Download Signature SDK

Payment Demo

<?php
include_once "./sign.php";

// Payin AppId & AppSecret
$appId = "YOUR_APP_ID";
$appSecret = "YOUR_APP_SECRET";
// Please get gateway url from doc
$gatewayBase = "GATEWAY_BASE_URL";
$payoutCreateApi = "/pg/dk/order/create";

$map = array(
"amount" => "1.00",
"appId" => $appId,
"country" => "BR",
"currency" => "BRL",
"merTransNo" => "YOUR_ORDER_NO",
"returnUrl" => "https://example.com/payment/result",
"notifyUrl" => "https://example.com/notify",
);

$signStr = Sign::createSignStr($appSecret, $map);
$sign = Sign::create($appSecret, $map);
$map["sign"] = $sign;
$data = json_encode($map);

$curl = curl_init();

$url = $gatewayBase . $payoutCreateApi;
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>$data,
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Payout Demo

<?php
include_once "./sign.php";

// Payout AppId & AppSecret
$appId = "YOUR_APP_ID";
$appSecret = "YOUR_APP_SECRET";
// Please get gateway url from doc
$gatewayBase = "GATEWAY_BASE_URL";
$payoutCreateApi = "/pg/dk/payout/create";

$map = array(
"amount" => "1.00",
"appId" => $appId,
"currency" => "BRL",
"merTransNo" => "YOUR_ORDER_NO",
"notifyUrl" => "https://example.com/notify",
"pmId" => "CPF",
"extInfo" => array(
"bankCode" => "SBIN0007440",
"accountNumber" => "12345678912",
"accountHolderName" => "Test",
"accountNumber" => "123456789",
"payeePhone" => "911234567890",
"payeeEmail" => "abc@gmail.com",
"payeeAddress" => "accountHolder"s address",
"document" => "123456789"
)
);

$signStr = Sign::createSignStr($appSecret, $map);
$sign = Sign::create($appSecret, $map);
$map["sign"] = $sign;
$data = json_encode($map);

$curl = curl_init();

$url = $gatewayBase . $payoutCreateApi;
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>$data,
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

NodeJS

Download Signature SDK

C#

Download Signature SDK