shopia/nowpayments
最新稳定版本:v1.0.0
Composer 安装命令:
composer require shopia/nowpayments
包简介
A Laravel package for NowPayments API integration with sandbox support
README 文档
README
A Laravel package for NowPayments API integration with sandbox support.
Installation
You can install the package via composer:
composer require shopia/nowpayments
Configuration
1. Publish the configuration file and migrations:
php artisan vendor:publish --provider="Shopia\Nowpayments\NowpaymentsServiceProvider"
2. Database Configuration
This package uses the payment_settings table to store API keys and configuration. Make sure your table has the following columns:
sandbox_api_key(string, nullable)live_api_key(string, nullable)sandbox_mode(boolean, default: true)default_currency(string, default: 'USD')
If you need to create the table, run:
php artisan migrate
3. Add Configuration to Database
Insert your API keys into the payment_settings table:
use App\Models\PaymentSetting; PaymentSetting::create([ 'sandbox_api_key' => 'your-sandbox-api-key', 'live_api_key' => 'your-live-api-key', 'sandbox_mode' => true, 'default_currency' => 'USD' ]);
Usage
use Shopia\Nowpayments\Facades\Nowpayments; // Create an invoice $invoice = Nowpayments::createInvoice([ 'price_amount' => 100, 'price_currency' => 'usd', 'order_id' => 'ORDER-123', 'order_description' => 'Test payment', 'success_url' => 'https://your-site.com/success', 'cancel_url' => 'https://your-site.com/cancel', ]);
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-16