SDK Instruction

We support different languages of SDK, including GolangPHP、Java

Get the SDK

GOLANG-SDK: go get github.com/ReelPayment/sdk-go
PHP-SDK: php composer.phar require reelpay/sdk-php
JAVA-SDK: https://github.com/ReelPayment/sdk-java

Golang Example:

``Example 1  Native checkout

import (
    "github.com/ReelPayment/sdk-go"
)
func main()  {
    transactions := reelpay.Transactions{AppID: "b66g4ypvrbzr7767", AppKey: "HcqmXmq7F4Y4UveaL7wcaYXSe3I8qS2X"}
    res := transactions.Pay(&reelpay.PayRequest{
        OutTradeNo: "QYXwrw25PzFZPYw83XWC5ManQWH3SZaW",
        CurrencyID: "bVmDPPs3Cyt1ZGeZVq6orZNWnfYhiE5H",
        FiatName:   "USD",
        FiatAmount: "0.0001",
    })
    fmt.Println(res)
}
``Example 2  Hosted Checkout

import (
    reelpay "github.com/ReelPayment/sdk-go"
)
func main()  {
    transaction := reelpay.Transactions{
        AppID: "eqrbntqbi5uqvkpr",
        AppKey: "XhAlbICW10VJnWGruPL0NSnvb6946JDQ",
    }
    res := transaction.EntrustPay(&reelpay.EntrustPay{
        OutTradeNo: "jSWfrolOTdsadcYuUwkJbdw9IJUBeV",
        Symbol:     "USD",
        Amount:     "1.2",
        Name:       "Product name",
        Image:      "https://reelpay.com/product.jpg",
    })
    fmt.Println(res)
}
  • PHP Example:

``Example 1  Native checkout

<?php
require_once('vendor/autoload.php');
use Reelpay\Reelpay;

$transaction = Reelpay::Transaction('b66g4ypvrbzr7767','HcqmXmq7F4Y4UveaL7wcaYXSe3I8qS2X');
$res = $transaction->Pay([
    'out_trade_no' => 'QYXwrw25PzFZPYw83XWC5ManQWH3SZaW',
    'currency_id'  => 'bVmDPPs3Cyt1ZGeZVq6orZNWnfYhiE5H',
    'fiat_name'    => 'USD',
    'fiat_amount'  => '0.0001'
]);
var_dump($res);
``Example 2  Hosted Checkout

<?php
require_once('vendor/autoload.php');
use Reelpay\Reelpay;
$transaction = Reelpay::Transaction(
    'eqrbntqbi5uqvkpr',
    'XhAlbICW10VJnWGruPL0NSnvb6946JDQ'
);
$res = $transaction->EntrustPay(
    "out_trade_no", 
    "USD", 
    "1.2", 
    "Product name", 
    "https://reelpay.com/product.jpg"
);
var_dump($res);
// Todo: $payUrl = $res['data']['url'];
  • JAVA Example:

``Example 1  Native checkout


import com.google.gson.JsonObject;
import com.reelpay.api.Transactions;

public class Test {
    public static void main(String[] args) {
        String appId = "Your appid";
        String appKey = "Your appKey";

        // Hosted Checkout
        String out_trade_no = "20240101xxxxxxxxxxxxx";
        String symbol = "USD";
        String amount = "3.00";
        String name = "Buy coins";
        String image = "https://reelpay.com/product.jpg";

        Transactions transaction = new Transactions(appId, appKey);
        JsonObject rt = transaction.EntrustPay(out_trade_no, symbol, amount, name, image);
        System.out.println(rt.toString());
        //{"code":200,"message":"success","data":{"url":"https://pay.reelpay.com/df9fbe011ca2a1c70f20240112113339","time_expire":1705032219,"trade_no":""}}
    }
}

Call Method

Last updated