Download the PHP package payscribe/php-sdk without Composer
On this page you can find all versions of the php package payscribe/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download payscribe/php-sdk
More information about payscribe/php-sdk
Files in payscribe/php-sdk
Package php-sdk
Short Description Official Payscribe PHP SDK — virtual accounts, virtual cards, bills, payouts, customers and webhooks.
License MIT
Informations about the package php-sdk
Payscribe PHP SDK
Virtual accounts, virtual cards, bill payments, and webhook verification.
Features
- Static/permanent NGN virtual account creation
- Dynamic/temporary NGN virtual account creation
- Virtual account lookup, activation, deactivation
- Payment confirmation and sandbox transfer simulation
- USD virtual card creation (including stablecoin-funded)
- Card top-up, withdrawal, replacement, freezing, unfreezing, termination
- Card transaction history and billing contact updates
- Bill payments: cable TV, internet, data, E-pins, electricity, airtime, SMS, betting, international
- Webhook signature verification (HMAC-SHA256)
- Automatic retry with exponential backoff
- Sensitive data redaction in logs and error context
Requirements
- PHP 8.1+
- Composer
ext-jsonext-curl
Installation
Quickstart
Environment
| Method | Environment |
|---|---|
Payscribe::sandbox($key) |
Sandbox (test) |
Payscribe::production($key) |
Live |
Configuration
Resources
$payscribe->customers
| Method | Returns |
|---|---|
create(string $firstName, string $lastName, string $email, string $phone, string $country = 'NG'): array |
array with customer_id |
Create a customer before issuing accounts or cards:
$payscribe->virtualAccounts
| Method | Returns |
|---|---|
createStatic(string $customerId, array $banks, string $currency = 'NGN', ?string $identityType = null, ?string $identityNumber = null): VirtualAccount |
VirtualAccount{accountNumber, bank, currency, customerId, ...} |
createDynamic(string $reference, float $amount, string $amountType, int $expiresDuration, string $expiresType, string $customerName, string $customerEmail, string $customerPhone, string $currency = 'NGN', ?string $description = null): VirtualAccount |
Same shape |
get(string $accountNumber): VirtualAccount |
Single account |
activate(string $accountNumber): ActionResponse |
Activate an account |
deactivate(string $accountNumber): ActionResponse |
Deactivate an account |
confirmPayment(string $sessionId, float $amount, string $accountNumber, ?string $transId = null): ActionResponse |
Confirm a pending payment |
simulateTransfer(string $reference, float $amount, string $account, string $name, string $bank, string $senderAccountNumber, string $senderName, string $hash, ?string $description = null, string $currency = 'NGN'): ActionResponse |
Sandbox only; simulates an incoming transfer |
$payscribe->virtualCards
| Method | Returns |
|---|---|
create(string $customerId, string $currency, string $brand, float $amount, string $reference, string $type = 'virtual', ?bool $contactless, ?float $dailyLimit, ?float $transactionLimit): Card |
Card{id, brand, currency, lastFour, getMaskedNumber(), ...} |
createWithStablecoin(...same..., string $stablecoinCurrency = 'USDT', string $stablecoinNetwork = 'Tron', string $stablecoinChain = 'TRC20'): Card |
Card (funded via stablecoin deposit) |
topUp(string $cardId, float $amount, ?string $reference = null): ActionResponse |
Add funds |
topUpWithStablecoin(string $cardId, float $amount, string $stablecoinCurrency = 'USDT', string $stablecoinNetwork = 'Tron', string $stablecoinChain = 'TRC20', ?string $reference = null): ActionResponse |
Add funds via crypto |
withdraw(string $cardId, float $amount, string $reference): ActionResponse |
Withdraw funds |
get(string $cardId): Card |
Single card details |
replace(string $cardId): Card |
Replace lost/stolen card |
regularize(string $cardId): Card |
Alias for replace |
transactions(string $cardId, string $startDate, string $endDate, ?int $page, ?int $pageSize): array |
['data' => Transaction[], 'total' => int, 'page' => int] |
freeze(string $cardId, string $reference): ActionResponse |
Freeze card |
unfreeze(string $cardId, string $reference): ActionResponse |
Unfreeze card |
terminate(string $cardId, string $reference): ActionResponse |
Close card permanently |
updateContact(string $cardId, ?string $email, ?string $mobile, ?string $address1, ?string $address2, ?string $city, ?string $state, ?string $zipcode, ?string $country): ActionResponse |
Update billing contact |
Valid currencies: USD, NGN, GBP, EUR
Valid brands: visa, mastercard
$payscribe->bills
Bills are exposed under $payscribe->bills, grouped by product category. Every method returns the unwrapped API payload as an array.
| Resource | Method | Endpoint |
|---|---|---|
requery |
requery(string $transactionId) |
GET requery |
cable |
fetchBouquets(string $service) |
GET bouquets |
cable |
validateSmartCard(string $service, string $account, string $planId, ?int $month = null) |
POST multichoice/validate |
cable |
pay(string $planId, string $customerName, string $account, string $service, string $reference, ?string $phone, ?string $email, ?int $month) |
POST multichoice/vend |
cable |
topUp(float\|string $amount, string $customerName, string $account, string $service, string $reference, ?string $phone, ?string $email, ?int $month) |
POST multichoice/topup |
internet |
listServices() |
GET internet/list |
internet |
spectranetPinPlans() |
GET internet/spectranet/pins/plans |
internet |
purchaseSpectranetPins(string $planId, int $quantity, string $reference) |
POST internet/spectranet/pins/vend |
data |
lookup(?string $network, ?string $category) |
GET data/lookup |
data |
vend(string $plan, string\|array $recipient, string $network, ?string $reference) |
POST data/vend |
epins |
list() |
GET epins |
epins |
purchase(string $id, int $quantity, string $reference) |
POST epins/vend |
epins |
lookupJambUser(int\|string $id, string $account) |
POST epins/jamb/user/lookup |
epins |
retrieve(string $transactionId) |
GET epins/retrieve |
airtimeToWallet |
lookup() |
POST airtime_to_wallet |
airtimeToWallet |
process(string $network, float\|string $amount, string $phoneNumber, string $from, ?string $reference) |
POST airtime_to_wallet/vend |
electricity |
validate(string $meterNumber, string $meterType, float\|string $amount, string $service) |
POST electricity/validate |
electricity |
pay(string $meterNumber, string $meterType, float\|string $amount, string $service, string $customerName, ?string $address, ?string $phone, ?string $email, ?string $reference) |
POST electricity/vend |
sms |
send(string $to, string $message, ?string $reference, ?string $senderId) |
POST sms |
betting |
listProviders() |
GET betting/list |
betting |
lookup(string $betId, string $customerId) |
GET betting/lookup |
betting |
fundWallet(string $betId, string $customerId, string $customerName, float\|string $amount, string $reference) |
POST betting/vend |
airtime |
vend(string $network, float\|string $amount, string\|array $recipient, ?bool $ported, ?string $reference) |
POST airtime |
airtime |
bulkVend(array $rows, ?string $reference) |
POST airtime |
international |
countries() |
GET international-bills/countries |
international |
providers(string $iso) |
GET international-bills/providers |
international |
products(string $iso, string $code) |
GET international-bills/products |
international |
rate(string $iso, string $sku, float\|string $amount) |
GET international-bills/rate |
international |
vend(string $iso, string $providerCode, string $sku, float\|string $amount, string $account, string $reference, ?string $debitCurrency) |
POST international-bills/vend |
$payscribe->webhooks
Verify webhook payloads using HMAC-SHA256. Use the raw request body (not re-encoded JSON).
| Method | Returns |
|---|---|
verifySignature(string $rawBody, string $signature, ?int $timestamp = null, int $tolerance = 300): bool |
true if signature matches |
constructEvent(string $rawBody, ?string $signature, ?int $timestamp = null, int $tolerance = 300): array |
Parsed event array, throws on invalid signature |
Pass a Unix $timestamp to activate replay protection — the SDK signs {timestamp}.{payload} and rejects payloads older than $tolerance seconds (default 5 min). Legacy mode works without a timestamp.
php use Payscribe\Exception{ PayscribeException, AuthException, ValidationException, RateLimitException, ServerException, };
try { $card = $payscribe->virtualCards->get('crd_unknown'); } catch (AuthException $e) { echo 'Check your secret key'; } catch (ValidationException $e) { echo 'Validation failed: ' . $e->getMessage(); } catch (RateLimitException $e) { $retryAfter = $e->getContext()['retry_after'] ?? 1; sleep($retryAfter); // retry } catch (ServerException $e) { echo 'Server error, will be retried automatically: ' . $e->getMessage(); } catch (PayscribeException $e) { echo "API error ({$e->getCode()}): {$e->getMessage()}"; } bash php security_verify.php bash
All unit tests (mocked HTTP, no API key required)
vendor/bin/phpunit
Integration tests (requires sandbox key in .env)
PAYSCRIBE_SECRET_KEY=sk_test_xxx vendor/bin/phpunit --testsuite=Integration
Security redaction verification
php security_verify.php
With coverage
php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-text
## Legacy Bill Payments
Deprecated — use the native `$payscribe->bills` resource above instead. For reference, `main.php` contains the legacy bill-payment methods.
## License
MITAll versions of php-sdk with dependencies
vlucas/phpdotenv Version ^5.6
guzzlehttp/guzzle Version ^7.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.0