SDK Libraries
We have prepared some language libraries SDK so you can integrate CCPayment as quickly as possible in your system. The libraries focus on being as abstracted as possible for faster integration into your system's language. Below is the list and link to the repository of all supported languages:
Java SDK
Referencing the Jar Package:
<dependency>
<groupId>com.ccpayment</groupId>
<artifactId>ccpayment</artifactId>
<version>1.0.0</version>
</dependency>
Usage:
import com.ccpayment.apis;
import com.ccpayment.beans.*;
.....
CCPaymentApis ccpaymentApi = CCPaymentApis.getInstance("ccpament appid from platform", "ccpayment app secret from platform");
// Create order
CreateOrderParam param = new CreateOrderParam();
param.setProductPrice("0.07");
param.setTokenId("2e6cfa7d-f658-455d-89cd-31ebbcfdfa2c");
param.setRemark("order remark");
param.setMerchantOrderId("your order id");
param.setDenominatedCurrency("TOKEN");
param.setNotifyUrl("https://xxxxxxxx.com/notify.url");
param.setOrderValidPeriod(1800);
param.setCustomValue("custom value");
CreateOrderResponse resp = ccpaymentApi.createOrder(param);
// Get checkout URL
CheckoutUrlParam param = new CheckoutUrlParam();
param.setProductPrice("1000");
param.setMerchantOrderId("order no 45");
param.setReturnUrl("https://www.xxxx.com/callback");
param.setProductName("product name");
param.setNotifyUrl("https://xxxxxxxx.com/notify.url");
param.setOrderValidPeriod(1800);
param.setCustomValue("custom value");
CheckoutUrlResponse resp = ccpaymentApi.checkoutUrl(param);
// Get supported coins
GetSupportCoinResponse resp = ccpaymentApi.getSupportCoin();
// Get token balance
AssetsParam param = new AssetsParam();
param.setTokenId("e8f64d3d-df5b-411d-897f-c6d8d30206b7");
AssetsResponse resp = ccpaymentApi.assets(param);
.....
See more APIs: https://github.com/cctip/ccpayment-sdk-java/blob/master/src/main/java/com/CCPayment/apis/CCPaymentApis.java
PHP SDK
1. Install composer
2. composer require ccpayment/php-sdk:dev-master
## Example usage
```
<?php
use CCPayment\v1\CCPay;
$resp = CCPay::CheckUser("9454818","202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);
```
Golang SDK
Enviorment preparation -Golang
Import CCPayment Golang SDK
import SDK:
go get github.com/cctip/ccpayment-sdk
Check the test usage example, Call the function in the SDK package.
Node.js SDK
Enviormental preparation Please install the running environment of Node.js to your system.
Download SDK Download the CCPayment Node SDK.
Install SDK Open the terminal under the nodejs folder and run the npm install.
Example usage
const ccpaymentWidgets = require("ccpayment-sdk/nodejs/ccpayment.js")
ccpaymentWidgets.init(appId, appSecret)
ccpaymentWidgets.checkoutURL(
{
order_valid_period: 823456,
product_price: "1",
merchant_order_id: "20230802175623",
product_name: "test",
return_url: "https://app.gitbook.com/xxxxx",
// ...req
},
(res) => {
...
}
);
Only needs the Callback in some case
ccpaymentWidgets.getSupportToken((res) => {
...
}
Python SDK
Enviormental preparation - Python 3.9.6+
Download and install it: CCPayment Python SDK
pip3 install --upgrade ccpayment
Example usage
python
import ccpayment
#init
pay = ccpayment.CCPaymentClass(app_id, app_secret)
#interface called:get_support_coin
data, is_verify = pay.get_support_coin()
if is_verify:
#Verify signature successfully
else:
#Verify signature failed
The tutorial of the interface called a. Import SDK b. Create the instance of CCPaymentClass, import Merchant app_id and app_secret c. Call the specific usage interface, eg. get_support_coin d. Verify the signature via the interface: is_verify e. Verify signature success/ failed
Last updated