muyaedward / wbapp-bitpay
WritersBay App的Bitpay包装器
1.0
2019-04-18 06:32 UTC
Requires
- php: ^7.1
- bitpay/php-client: ~2.2
Requires (Dev)
- larapack/dd: ^1.0
- phpunit/phpunit: ^7.5
This package is not auto-updated.
Last update: 2024-09-28 06:43:38 UTC
README
为您的WritersBay App和BitPay客户端接受比特币和比特币现金。
安装
您可以通过composer安装此软件包
composer require muyaedward/wbapp-bitpay
使用以下命令发布配置文件
php artisan vendor:publish --provider="Muyaedward\WbappBitpay\WbappBitpayServiceProvider"
配置和与BitPay服务器配对的步骤
-
将以下密钥添加到
.env
文件中并更新详细信息(有关配置的更多信息,请参阅这里)BITPAY_PRIVATE_KEY_PATH=/tmp/bitpay.pri BITPAY_PUBLIC_KEY_PATH=/tmp/bitpay.pub BITPAY_NETWORK=testnet BITPAY_KEY_STORAGE_PASSWORD=SomeRandomePasswordForKeypairEncryption BITPAY_TOKEN=
-
创建密钥对并将您的客户端(应用程序)与BitPay服务器配对。
php artisan wbapp-bitpay:createkeypair yourPairingCode
上述命令将生成私钥、公钥并将它们保存到指定的位置。然后,它将使用您提供的配对代码将您的客户端(即应用程序)与BitPay服务器配对,并创建新的令牌/密钥,并将它们保存在.env
中。
- 完成。⛳
使用方法
创建发票和结账
public function createInvoice() { // Create instance of invoice $invoice = WbappBitpay::Invoice(); // Create instance of item $item = WbappBitpay::Item(); // Set item details $item->setCode('124') ->setDescription('Item 1') ->setPrice('1.99'); // Add item to invoice. (Only one item can be added) $invoice->setItem($item); // Order reference number from the point-of-sale (POS). // It should be a unique identifier for each order that you submit. $invoice->setPosData(uniqid()); // Optional // Create buyer instance $buyer = WbappBitpay::Buyer(); // Add buyer details $buyer->setFirstName('Vaibhav') ->setLastName('Roham'); // Add buyer to invoice $invoice->setBuyer($buyer); // Set currency for this invoice $invoice->setCurrency(WbappBitpay::Currency('USD')); // Create invoice on BitPay server $invoice = WbappBitpay::createInvoice($invoice); // Redirect URL on success $invoice->setRedirectUrl(route('bitpay-redirect-back')); // Webhook URL to receive various events $invoice->setNotificationUrl(route('bitpay-webhook')); // Redirect user to following URL for payment approval. // Or you can create stripe like checkout from https://bitpay.com/create-checkout $paymentUrl = $invoice->getUrl(); }
测试
composer test
变更日志
请参阅变更日志了解最近更改的更多信息。
贡献
有关详细信息,请参阅贡献指南。
安全
如果您发现任何安全相关的问题,请通过电子邮件muyaedward@gmail.com联系,而不是使用问题跟踪器。
鸣谢
许可协议
MIT许可(MIT)。有关更多信息,请参阅许可文件。