payid19/payid19-api-php

PHP 的 Payid19 API 库

dev-main 2022-04-07 13:53 UTC

This package is auto-updated.

Last update: 2024-09-07 19:02:17 UTC


README

使用 Payid19 接受 USDT 付款

要开始在您的网站上接受加密货币,您需要在 https://payid19.com 上创建账户,并在设置页面获取公钥和私钥。

此密钥将用于创建 Payid19Client 实例。

安装

Composer

您可以通过 Composer 安装库。在终端中运行以下命令

composer require payid19/payid19-api-php

使用示例

创建新发票:(https://payid19.com/dev/invoices/create_invoice)

require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

$public_key  = 'xxxxx';
$private_key = 'xxxxx';

$payid19 = new \Payid19\ClientAPI($public_key,$private_key);

$request = [
                    'email' => 'email@email.com',
                    'price_amount' => 725,
                    'price_currency' => 'USD',
                    'merchant_id' => 5,
                    'order_id' => 11,
                    'customer_id' => 12,
                    // 'test' => 1,
                    'title' => 'title',
                    'description' => 'description',
                    'add_fee_to_price' => 1,
                    'cancel_url' => 'https://yourcancelurl',
                    'success_url' => 'https://yoursuccessurl',
                    'callback_url' => 'http://yourcallbackurl',
                    'expiration_date' => 48
];

$result= $payid19->create_invoice($request);

if(json_decode($result)->status=='error'){
		//error
		echo json_decode($result)->message[0];
}else{
		//success echo url
		echo json_decode($result)->message;
}

获取发票:(https://payid19.com/dev/invoices/get_invoices)

$public_key  = 'xxxxx';
$private_key = 'xxxxx';

$payid19 = new \Payid19\ClientAPI($public_key,$private_key);
    
$request= [
		'order_id' 			=> '11'
];
    
$result= $payid19->get_invoices($request);
print_r($result);