1 Star 0 Fork 0

Coinpal / document

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.md 9.19 KB
一键复制 编辑 原始数据 按行查看 历史
huanghun 提交于 2023-01-10 09:15 . update README.md.

Introduction

Coinpal is a non-custodial cryptocurrency payment processing platform. Accept payments in a wide range of cryptos and get them instantly converted into a coin of your choice and sent to your wallet.

SDKs&Demo

TODOS

Sandbox

TODOS

Authentication

TODOS

To use the Coinpal API you should do the following:

1 Sign up at merchant.coinpal.io
2 Fill in your business information
3 Generate an API key

Standard e-commerce flow for Coinpal API:

1 Please check whether the transaction currency is in the list we allow, if not, please convert it to the currency we need in time
2 API - Call the "POST Create payment" method to create a payment and get the deposit address;
3 UI - Ask a customer to send the payment to the generated deposit address;
4 UI - A customer sends coins, Coinpal processes and exchanges them (if required), and settles the payment to your Outcome Wallet;
5 API - You can get the payment status either via our IPN callbacks or manually, using "GET Payment Status" and display it to a customer so that they know when their payment has been processed.
6 UI - You can see all of this information in your Account on Coinpal Merchant website.

Payment API

POST Create payment

https://pay.coinpal.io/gateway/pay/checkout

Creates payment. With this method, your customer will be able to complete the payment without leaving your website. Data must be sent as a form-date payload.

Sign String Make Rule

sign = sha256(secretKey+requestId+merchantNo+orderNo+orderAmount+orderCurrency)

Parameters Body

Name Max Length Mandatory Default Value Description
version 10 Yes 2 version No
requestId 156 Yes Request serial number, each request needs to be unique
merchantNo 64 Yes Merchant number
merchantName 256 No Merchant name on the cashier page
orderNo 256 Yes Merchant order number
orderCurrencyType 16 Yes Currency type,either 'crypto' or 'fiat'
orderCurrency 10 Yes Order currency
orderAmount 16 Yes Order amount
orderDescription 256 No Order description
resultNotifyUser 10 No true Whether coinpal sends the final confirmation result of transaction for the user
unpaidAutoRefund 10 No true Whether coinpal automatic refund is required in case of underpayment or overpayment
payerEmail 256 No Payer email
payerIP 256 Yes Payer Ip
notifyURL 256 Yes Merchant asynchronous notification address
redirectURL 256 Yes After the user pays successfully or the payment expires, the page will call back the address
cancelURL 256 No After the user clicks Payment Cancel, the page will call back the address. If no value is passed, the default callback is to redirectUR
successUrl 256 No The redirectURL will be used by default if the redirect address is blank
remark 500 No The redirectURL will be used by default if the redirect address is blank
sign 64 Yes The extension field can be defined by the merchant. After successful payment, it will be returned as is

Response Body (Success)

Name Max Length Mandatory Default Value Description
version 10 Yes 2 version No
requestId 156 Yes Request serial number, each request needs to be unique
merchantNo 64 Yes Merchant number
orderNo 256 Yes Merchant order number
reference 256 Yes Coinpal order number
orderCurrency 10 Yes Order currency
orderAmount 16 Yes Order amount
nextStep 200 Yes redirect Next step
nextStepContent 200 Yes Checkout link
status 16 Yes Order status
respCode 10 Yes 200 Response code
respMessage 256 Yes success Message info
remark 500 Yes

Response Body (Error)

Fields Max Length Mandatory Default Value Description
respCode 10 Yes Response code
respMessage 256 Yes Error info

Request Demo (PHP)

<?php
    //todo demo
    $url = "https://pay.coinpal.io/gateway/pay/checkout";
    $secretKey = '2bab786405d1279e825692e13245670379e6485a2fb701233e76d8f8b1482a9a';
    $data['version'] = '2';
    $data['requestId'] = 'TEST10000000000123';
    $data['merchantNo'] = '10000000';
    $data['merchantName'] = 'Cionpal';
    $data['orderNo'] = 'MER12345678910';
    $data['orderCurrencyType'] = 'fiat';
    $data['orderCurrency'] = 'USD';
    $data['orderAmount'] = '10.5';
    $data['orderDescription'] = 'Iphone 14';
    $data['payerIP'] = '192.168.0.1';
    $data['notifyURL'] = 'https://www.order-test.cn/notify.php?order='.$data['orderNo'];
    $data['redirectURL'] = 'https://www.order-test.cn';
    $data['remark'] = 'Remark';
    $data['sign'] = hash('sha256', $secretKey . $data['requestId'] . $data['merchantNo'] . $data['orderNo'] . $data['orderAmount'] . $data['orderCurrency']);

    function curl_request($url,$pdata){
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $pdata);
        curl_setopt($ch, CURLOPT_TIMEOUT,60);
        $result = curl_exec($ch);
        if($result === false){
            return curl_error($ch);
        }
        curl_close($ch);
        return $result;
    }
    $order_data = curl_request($url,$data);

Query Payment (POST)

https://pay.coinpal.io/gateway/pay/query

Parameters Body

Name Max Length Mandatory Default Value Description
token 64 No Cashier token (when gcid is blank, token is required)
gcid 24 No Coinpal order number(gcid is required when token is empty)

Response Body (Success)

Name Max Length Mandatory Default Value Description
version 10 Yes 2 version No
requestId 156 Yes Request serial number, each request needs to be unique
merchantNo 64 Yes Merchant number
orderNo 256 Yes Merchant order number
reference 256 Yes Coinpal order number
orderCurrency 10 Yes Order currency
orderAmount 16 Yes Order amount
nextStep 200 Yes redirect Next step
nextStepContent 200 Yes Checkout link
status 16 Yes Order status
respCode 10 Yes 200 Response code
respMessage 256 Yes success Message info
remark 500 Yes

Response Body (Error)

Fields Max Length Mandatory Default Value Description
respCode 10 Yes Response code
respMessage 256 Yes Error info

IPN(Callback)

When the payment status and payment amount change, we will notify your server in the form of asynchronous notification

Name Max Length Mandatory Default Value Description
version 10 Yes 2 version No
requestId 156 Yes Request serial number, each request needs to be unique
merchantNo 64 Yes Merchant number
orderNo 256 Yes Merchant order number
reference 256 Yes Coinpal order number
orderCurrency 10 Yes Order currency
orderAmount 16 Yes Order amount
dueCurrency 16 Yes Order due currency
dueAmount 16 Yes Order due amount
selectedWallet 10 Yes Wallet id
paidCurrency 10 Yes Paid currency
paidAmount 16 Yes Paid amount
paidAddress 10 Yes Paid address
confirmedTime 20 Yes Confirmed time
status 16 Yes Order status
remark 500 Yes
notify_url 256 Yes Merchant asynchronous notification address
sign 64 Yes

sign = sha256(secretKey+requestId+merchantNo+orderNo+orderAmount+orderCurrency)

Payment Status List

Status List

Value Description
unpaid Order created successfully
pending Payment in progress
partial_paid_confirming partial paid successfully, to be confirmed by the public chain block
partial_paid partial paid successfully and the public chain block was confirmed
paid_confirming Paid successfully, to be confirmed by the public chain block
paid paid successfully and the public chain block was confirmed
failed Payment failed

Transaction Currency List

Currency
BTC
ETH
USDT
USDC
USD
GBP
EUR
HKD
1
https://gitee.com/coinpal/docs.git
git@gitee.com:coinpal/docs.git
coinpal
docs
document
master

搜索帮助