承接 lnpay/lnpay-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lnpay/lnpay-php

Composer 安装命令:

composer require lnpay/lnpay-php

包简介

LNPay PHP Client Library

README 文档

README

License: MIT

lnpay-php

The LNPay PHP library provides convenient access to the LNPay API from PHP applications.

The Api follows the following practices:

  • Namespaced under LNPayClient
  • Call $api->class->function() to access the API
  • API throws exceptions instead of returning errors
  • Options are passed as an array instead of multiple arguments wherever possible.
  • All requests and responses will be communicated over JSON

Requirements

  • PHP 7.3.0 or higher.
  • Extensions - curl, json and mbstring

Installation via composer

Run in console below command to download package to your project:

composer require lnpay/lnpay-php

Installation Manually

To manually install the library, you can download the latest release. Then, include the init.php file.

require_once('/path/to/lnpay-php/init.php');

Documentation

The first alpha version of this SDK is mainly a wrapper for the LNPay API

Setup

// For Composer

// Load the autoload file from composer's vendor directory
require '../vendor/autoload.php';

use LNPayClient\LNPayClient;

// Creating Client object
$lnPayClient = new LNPayClient(
        'sak_KEY'
    );

// For Manual

require 'init.php';

use LNPayClient\LNPayClient;

// Creating Client object
$lnPayClient = new LNPayClient(
        'sak_KEY'
    );

// Wallet Access Key setup if not added while LNPayClient object creationation.

$lnPayClient->wallet->setWalletAccessKey('wal_KEY');

Usage

Follow the instruction given SetUp section and initialize the LNPayClient.

Check Balance

$response = $lnPayClient->wallet->getInfo();
print_r($response);

Create a wallet

$response = $lnPayClient->wallet->create(array(
        'user_label' => 'My New Wallet'
    ));
print_r($response);

Generate Invoice

$response = $lnPayClient->wallet->createInvoice(array(
        "num_satoshis" => "2",
        "memo" => "Tester",
    ));
print_r($response);

Pay Invoice

$response = $lnPayClient->wallet->payInvoice(array(
        "payment_request" => "lnXXXX"
    ));
print_r($response);

Transfers between wallets

$response = $lnPayClient->wallet->transfer(array(
        "num_satoshis" => 1,
        "memo" => "SateBack",
    ));
print_r($response);

Get Wallet Transactions

$response = $lnPayClient->walletTransaction->getWalletTransactions();
print_r($response);

Get Transaction Info

$response = $lnPayClient->lightingNetworkTx->getInfo('lntx_id');
print_r($response);

Generate a disposable LNURL-withdraw link.

$response = $lnPayClient->wallet->disposableLnUrlWithdraw(['num_satoshis'=> 1, 'memo'=> '1 sat over LNURL once']);
print_r($response);

Generate a permanent LNURL-withdraw link.

$response = $lnPayClient->wallet->permanentLnUrlWithdraw(['num_satoshis'=> 1, 'memo'=> '1 sat over LNURL again and again']);
print_r($response);

See the example files.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固