elementsproject / lightning-charge-client-php
Lightning Charge REST API 的 PHP 客户端
0.1.3
2017-12-29 19:18 UTC
Requires
- tcdent/php-restclient: ^0.1
Requires (Dev)
- clue/phar-composer: ^1.0
- phpunit/phpunit: ^6.4
This package is not auto-updated.
Last update: 2024-09-23 07:13:57 UTC
README
Lightning Charge REST API 的 PHP 客户端。
安装
$ composer require elementsproject/lightning-charge-client-php
使用
<?php require_once 'vendor/autoload.php'; // Initialize client $charge = new LightningChargeClient('https://:8009', '[TOKEN]'); // Create invoice $invoice = $charge->invoice([ 'msatoshi' => 50, 'metadata' => [ 'customer' => 'Satoshi', 'products' => [ 'potato', 'chips' ] ] ]); tell_user("to pay, send $invoice->msatoshi milli-satoshis with rhash $invoice->rhash, or copy the BOLT11 payment request: $invoice->payreq"); // Create invoice denominated in USD $invoice = $charge->invoice([ 'currency' => 'USD', 'amount' => 0.15 ]); // Fetch invoice by id $invoice = $charge->fetch('m51vlVWuIKGumTLbJ1RPb'); // Fetch all invoices $invoice = $charge->fetchAll(); // Register web hook $charge->registerHook('m51vlVWuIKGumTLbJ1RPb', 'http://my-server.com/my-callback-url');
待办:文档化 wait
测试
$ CHARGE_URL=http://api-token:[TOKEN]@localhost:8009 phpunit test
许可证
MIT