gembapay/gembapay-php
Composer 安装命令:
composer require gembapay/gembapay-php
包简介
GembaPay PHP SDK — Unified payment gateway for crypto (ETH, BNB, POL, USDC, USDT), Stripe, and PayPal. Non-custodial payments.
关键字:
README 文档
README
Unified payment gateway for crypto, cards, and PayPal.
Accept ETH, BNB, POL, USDC, USDT, credit cards (via Stripe), and PayPal through a single API. Non-custodial crypto payments — funds go directly to your wallet via smart contracts.
Features
- One API, three payment methods — Crypto, Stripe (cards/Apple Pay/Google Pay), PayPal
- Non-custodial crypto — Payments route directly to your wallet via smart contracts
- 86+ currencies — Price in any fiat currency, settle in crypto or fiat
- Multi-chain — Ethereum, BNB Smart Chain, Polygon
- Test mode built-in — Testnets + sandbox environments for development
- Zero dependencies — Uses only PHP built-in curl and json extensions
- Laravel & WordPress compatible — Works with any PHP framework
Install
composer require gembapay/gembapay-php
Quick Start
use GembaPay\GembaPay; $gembapay = new GembaPay( apiKey: 'gembapay_test_your_key', // test key for development webhookSecret: 'your_webhook_secret' ); // Create a payment $payment = $gembapay->createPayment( orderId: 'ORDER-123', amount: 100.00, currency: 'EUR' ); echo $payment['paymentUrl']; // → https://payment.gembapay.com/checkout/ORDER-123 echo implode(', ', $payment['allowedMethods']); // → crypto, stripe, paypal
Usage
Create Payment
$payment = $gembapay->createPayment( orderId: 'ORDER-456', amount: 49.99, currency: 'USD', description: 'Premium Plan' ); // Redirect customer to unified checkout header('Location: ' . $payment['paymentUrl']); exit;
Check Status
$status = $gembapay->getPaymentStatus('ORDER-456'); echo $status['status']; // 'completed' echo $status['network']; // 'bsc', 'stripe', 'paypal', etc.
Webhook Handling
// webhook.php $gembapay = new GembaPay( apiKey: $_ENV['GEMBAPAY_API_KEY'], webhookSecret: $_ENV['GEMBAPAY_WEBHOOK_SECRET'] ); try { $event = $gembapay->parseWebhookFromGlobals(); if ($event['event'] === 'payment.completed') { $orderId = $event['payment']['orderId']; $amount = $event['payment']['usdAmount']; $method = $event['payment']['network']; // Fulfill the order fulfillOrder($orderId); } http_response_code(200); echo json_encode(['received' => true]); } catch (\GembaPay\GembaPayException $e) { http_response_code(401); echo json_encode(['error' => $e->getMessage()]); }
Or verify manually:
$payload = file_get_contents('php://input'); $signature = $_SERVER['HTTP_X_GEMBAPAY_SIGNATURE'] ?? ''; if ($gembapay->verifyWebhook($payload, $signature)) { $data = json_decode($payload, true); // Process event... }
Transactions & Stats
$transactions = $gembapay->listTransactions(); $stats = $gembapay->getStats();
Laravel Integration
// config/services.php 'gembapay' => [ 'api_key' => env('GEMBAPAY_API_KEY'), 'webhook_secret' => env('GEMBAPAY_WEBHOOK_SECRET'), ], // app/Providers/AppServiceProvider.php $this->app->singleton(GembaPay::class, function () { return new GembaPay( apiKey: config('services.gembapay.api_key'), webhookSecret: config('services.gembapay.webhook_secret') ); }); // In your controller public function checkout(Request $request, GembaPay $gembapay) { $payment = $gembapay->createPayment( orderId: $request->order_id, amount: $request->amount, currency: $request->currency ?? 'USD' ); return redirect($payment['paymentUrl']); }
Test Mode
Use test API keys (gembapay_test_...) for development. Test mode automatically uses:
| Method | Test Environment |
|---|---|
| Crypto | Sepolia, BSC Testnet, Polygon Amoy |
| Stripe | Test cards (4242 4242 4242 4242) |
| PayPal | Sandbox accounts |
$gembapay = new GembaPay(apiKey: 'gembapay_test_your_key'); var_dump($gembapay->isTestMode()); // true
Claim free test tokens at Developer Resources.
API Reference
Constructor
new GembaPay( string $apiKey, // Required ?string $webhookSecret = null, // For webhook verification ?string $baseUrl = null, // Custom API URL int $timeout = 30 // Timeout in seconds )
Methods
| Method | Description |
|---|---|
createPayment($orderId, $amount, $currency, $description) |
Create payment → returns array with paymentUrl |
getPayment($orderId) |
Get payment details |
getPaymentStatus($orderId) |
Check payment status |
listTransactions($params) |
List merchant transactions |
getStats() |
Get merchant statistics |
verifyWebhook($payload, $signature) |
Verify webhook signature → bool |
parseWebhookFromGlobals() |
Parse & verify from PHP globals |
isTestMode() |
Check if using test mode |
Fee Structure
| Method | Fee |
|---|---|
| Crypto (ETH, BNB, POL, USDC, USDT) | 1% |
| Stripe (Cards, Apple Pay, Google Pay) | 1% + €0.20 + Stripe fees |
| PayPal (Balance, Bank, Pay Later) | 1% + €0.20 + PayPal fees |
Requirements
- PHP >= 7.4
- ext-curl
- ext-json
Links
Support
- Email: contacts@gembapay.com
- GitHub Issues: github.com/ivanovslavy/gembapay/issues
License
MIT © GEMBA EOOD
gembapay/gembapay-php 适用场景与选型建议
gembapay/gembapay-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ecommerce」 「checkout」 「payments」 「gateway」 「paypal」 「stripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gembapay/gembapay-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gembapay/gembapay-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gembapay/gembapay-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Nevogate Payment Gateway SDK
Dealing with payments through the Egyptian payment gateway PayMob
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
Adds a 'checkout' to a SilverStripe site which links to an Estimate and adds the ability to setup and pay
Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
A PHP (and Laravel) package to interface with the Snipcart api.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 48
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-07