gembapay / gembapay-php
GembaPay PHP SDK — Unified payment gateway for crypto (ETH, BNB, POL, USDC, USDT), Stripe, and PayPal. Non-custodial cryptocurrency payments via smart contracts with fiat checkout.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
pkg:composer/gembapay/gembapay-php
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^9.0
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