定制 muyaedward/wbapp-bitpay 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

muyaedward/wbapp-bitpay

Composer 安装命令:

composer require muyaedward/wbapp-bitpay

包简介

Bitpay wrapper for WritersBay App

README 文档

README

Accept Bitcoin and Bitcoin Cash for your WritersBay App and BitPay client.

Installation

You can install the package via composer:

composer require muyaedward/wbapp-bitpay

Publish config file with:

php artisan vendor:publish --provider="Muyaedward\WbappBitpay\WbappBitpayServiceProvider"

Steps to configure and pair with BitPay Server

  • Add following keys to .env file and updated the details (view more about configuration):

    BITPAY_PRIVATE_KEY_PATH=/tmp/bitpay.pri
    BITPAY_PUBLIC_KEY_PATH=/tmp/bitpay.pub
    BITPAY_NETWORK=testnet
    BITPAY_KEY_STORAGE_PASSWORD=SomeRandomePasswordForKeypairEncryption
    BITPAY_TOKEN=
  • Create Test Account(for devlopement) or Live Account on BitPay.

  • Create new token for application(test account) or new token for application on BitPay and copy newly generated 7 character Pairing Code.

  • Create keypairs and pair your client(application) with BitPay server.

    php artisan wbapp-bitpay:createkeypair yourPairingCode

    laravel_bitpay_1

Above command will generate private key, public key and save to your specified location. Next it will pair your client i.e. application with BitPay server referring your provided pairing code and create new token/key and will be saved in .env.

  • Done. ⛳

Usage

Create Invoice and checkout
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();
}

laravel_bitpay_2

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email muyaedward@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固