1. Go to this page and download the library: Download gembapay/gembapay-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gembapay / gembapay-php example snippets
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']);
// → stripe, paypal
$payment = $gembapay->createPayment(
orderId: 'ORDER-456',
amount: 49.99,
currency: 'USD',
description: 'Premium Plan'
);
// Redirect customer to unified checkout (use paymentUrl as-is — it carries an unguessable token).
// The page follows the customer's browser language (en/bg/es) and device theme;
// to fix them: $payment['paymentUrl'] . '?lang=bg&theme=light'
header('Location: ' . $payment['paymentUrl']);
exit;