cryptonator / merchant-php-sdk
Cryptonator.com 商户API SDK for PHP
v1.0
2016-10-09 19:27 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-09-28 10:48:22 UTC
README
需求
PHP 5.3 或更高版本
链接
入门指南
安装
- 将
"cryptonator/merchant-php-sdk": "dev-master"
添加到您的应用程序的composer.json
文件中,或将仓库克隆到您的项目中。 - 如果您正在使用 composer,请使用
require_once 'vendor/autoload.php';
,否则粘贴以下行require_once '/path/to/cloned/repo/lib/MerchantAPI.php';
商户API
使用 Cryptonator 商户API SDK 需要以下步骤
-
粘贴以下代码。注意:您可以在 Cryptonator 账户设置中找到常量
merchant_id
和secret
,一旦您通过 创建商户账户。use cryptonator\MerchantAPI; $cryptonator = new MerchantAPI(merchant_id, secret);
-
现在您可以使用 Cryptonator 商户API。
// start payment $url = $cryptonator->startPayment(array( 'item_name' => 'Item Name', //'order_id' => 'Order ID', //'item_description' => 'Item Description', 'invoice_amount' => 'Invoice Amount', 'invoice_currency' => 'Invoice Currency', //'success_url' => 'Success URL', //'failed_url' => 'Failed URL', //'language' => 'Language', )); // create invoice $invoice = $cryptonator->createInvoice(array( 'item_name' => 'Item Name', //'order_id' => 'Order ID', //'item_description' => 'Item Description', 'checkout_currency' => 'Checkout Amount', 'invoice_amount' => 'Invoice Amount', 'invoice_currency' => 'Invoice Currency', //'success_url' => 'Success URL', //'failed_url' => 'Failed URL', //'language' => 'Language', )); // get invoice $invoice = $cryptonator->getInvoice('InvoiceID'); // list invoices $invoices = $cryptonator->listInvoices(array( //'invoice_status' => 'Invoice Status', //'invoice_currency' => 'Invoice Currency', //'checkout_currency' => 'Checkout Currency', )); // check annswer $check_server = $cryptonator->checkAnswer($_POST);