ccpayment/php-sdk

ccpayment library written in PHP, for human beings.

v1.1.0 2023-07-27 03:22 UTC

This package is not auto-updated.

Last update: 2024-12-26 08:06:46 UTC


README

Document Address: https://doc.ccpayment.com/ccpayment-for-merchant/ccpayment-introduction

Install via composer

composer require ccpayment/php-sdk:dev-master

Example usage

<?php

use CCPayment\v1\CCPay;

$resp =  CCPay::CheckUser("9454818","202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

Reference API

Obtain the token list supported by merchants

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::GetSupportToken("202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

response

Obtain the list of the available networks for a certain token

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::GetTokenChain(["token_id"=>"58f93c4d-ce0b-4c7c-af77-b4b299718715"], "202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

response

Create payment order

Manage 100% of your front-end interactions and use our APIs to build your own checkout page.

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::CreateOrder([
      "remark"=>"",
      "token_id"=>"f36ad1cf-222a-4933-9ad0-86df8069f916",
      "amount"=>"0.5",
      "merchant_order_id"=>strval(time()).strval(rand(0,1000)),
      "denominated_currency"=> "USD"
     ], "202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

response

Generate a checkout URL

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::CheckoutUrl([
    "return_url"=>"https://cwallet.com/pay/callback",
    "valid_timestamp"=>4566,
    "amount"=>"0.5",
    "merchant_order_id"=>strval(time()).strval(rand(0,1000)),
    "product_name"=> "knowledge is power"
   ], "202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

response

Call the withdrawal API to initiate withdrawals

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::Withdraw([
      "token_id"=>"85db36af-3282-4501-9357-67da32691ab7",//matic POLYGON
      "address"=>"0x4aa884f207c2e4003c450eb14a5e93d16a60e730",
//    "token_id"=>"8e5741cf-6e51-4892-9d04-3d40e1dd0128",//POLYGON  f137d42c-f3a6-4f23-9402-76f0395d0cfe
//    "address"=>"9454818",
      "value"=>"0.045",
     "merchant_order_id"=>strval(time()).strval(rand(0,1000))
     ], "202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

response

The amount of USD converted into tokens

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::GetTokenRate(["token_id"=>"e8f64d3d-df5b-411d-897f-c6d8d30206b7","amount"=>"12"], "202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

response

Obtain the network fee of a certain network

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::NetworkFee(["token_id"=>"0912e09a-d8e2-41d7-a0bc-a25530892988"], "202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

response

Obtain details of merchant's assets

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::Assets("202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4","");
var_dump($resp);

response

Check the Validity of Cwallet ID

request:

Example:

use CCPayment\v1\CCPay;

$resp =  CCPay::CheckUser("9454818","202301310325561620262074393440256","c4600b8125b7ed23b5b7b8ee4acb42f4");
var_dump($resp);

response

Notification of order callbacks