Download the PHP package sofizpay/sofizpay-php-sdk without Composer
On this page you can find all versions of the php package sofizpay/sofizpay-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sofizpay-php-sdk
SofizPay PHP SDK
The official PHP library for secure digital payments on the SofizPay platform.
[](https://packagist.org/packages/sofizpay/sofizpay-php-sdk) [](https://opensource.org/licenses/MIT) [](https://www.php.net/)๐ Table of Contents
- Overview
- Installation
- Quick Start
- Core Methods
- Digital Services (Missions)
- Bank Integration (CIB)
- Real-time Transaction Streaming
- Response Format
- Security Best Practices
- Support
๐ Overview
The SofizPay PHP SDK provides a comprehensive interface for integrating DZT digital payments into your PHP applications. It supports on-chain Stellar payments, CIB/Dahabia bank deposits, and digital service recharges (Missions).
Key Benefits:
- โก Modern async-compatible wrapper (using Guzzle)
- ๐ Compatible with Laravel, Symfony, and plain PHP
- ๐ Exhaustive transaction history (Path Payments, Trustlines)
- ๐ฆ CIB/Dahabia bank deposit link generation
- ๐ฑ Phone, Internet & Game recharges (Mission APIs)
๐ฆ Installation
Composer
Requirements:
- PHP
>= 7.4 - Extensions:
ext-openssl,ext-json - Dependencies:
guzzlehttp/guzzle,soneso/stellar-php-sdk
๐ Quick Start
๐ง Core Methods
getBalance(string $publicKey)
Returns the current DZT balance for a given Stellar account.
submit(array $data)
Submits a DZT payment to the Stellar network.
โ ๏ธ Memo Truncation: Memos longer than 28 characters are automatically truncated.
getTransactions(string $publicKey, ?int $limit, ?string $cursor)
Fetches exhaustive transaction history via Stellar. Includes payments, trustlines, and account creation.
searchTransactionsByMemo(string $publicKey, string $memo, int $limit)
Performs a case-insensitive search over recent transactions.
๐ฑ Digital Services (Missions)
Mission APIs allow users to spend DZT on real-world digital services. All calls require encrypted_sk.
Phone Recharge
Internet Recharge (Idoom 4G)
Game Top-up (FreeFire, PUBG)
Bill Payment
Operation History & Details
Get Available Products
[!TIP] Use the product
namefor theofferfield and the productamountfor theamountfield.
๐ฆ Bank Integration (CIB & EDAHABIA)
Generate secure Dahabia/CIB bank payment links with optional real-time webhook callbacks.
๐งช Sandbox Environment & Mock Cards
The SofizPay Sandbox simulates the SATIM CIB/EDAHABIA payment system without connecting to real bank accounts.
Sandbox Test Cards
Use the following test credentials on the sandbox payment page:
| Card Number | Expiry | CVV | Cardholder Name | Result | Note |
|---|---|---|---|---|---|
6280581001234567 |
12/28 |
123 |
TEST SUCCESS |
โ Approved | Use OTP 123456 |
6280581009876543 |
12/29 |
456 |
TEST SUCCESS TWO |
โ Approved | Use OTP 123456 |
6280581005555555 |
06/28 |
999 |
TEST DECLINED |
โ Declined by issuer | Tests card refusal |
6280581004444444 |
09/28 |
444 |
TEST INSUFFICIENT |
โ Insufficient funds | Tests insufficient balance |
6280581003333333 |
03/21 |
333 |
TEST EXPIRED |
โ Expired card | Tests expired card |
6280581002222222 |
11/28 |
222 |
TEST TIMEOUT |
โ Timeout | Tests transaction timeout |
[!TIP] OTP Code: Always enter
123456on the OTP page for approved tests. Entering any other OTP triggers anInvalid OTPerror.
๐ Webhooks & Signature Verification
When a payment succeeds or fails, SofizPay delivers a server-to-server asynchronous HTTP POST event notification (cib.payment.updated) to your registered webhook_url.
Webhook Event Payload
Verifying Webhooks (verifyWebhookPayload)
Always verify the webhook before processing payments in your database.
โ ๏ธ Use
verifyWebhookPayload, not onlyverifyWebhookSignature. The RSA signature covers only themessagestring ("cib" . payment_status . amount . order_number, e.g.cibsuccess1500005965287001). The top-level fields such aspayment_status,amountandorder_numberare not signed by themselves.verifyWebhookPayloadchecks the signature and that those fields match the signedmessage, so they can be trusted.
Recommended hardening:
- Check that
amountequals the amount you stored for that order. - Process each order only once (webhooks can be replayed).
๐ Return URL vs. Webhook Notifications
| Feature | Return URL (return_url) |
Webhook (webhook_url) |
|---|---|---|
| Trigger mechanism | Client browser redirect | Server-to-server direct HTTP POST |
| Reliability | Can fail if user closes browser / network drops | Guaranteed server delivery |
| Security | Susceptible to tampering | Cryptographically signed (RSA-2048) |
| Recommended use | Display "Thank you" screen | Update database, activate subscriptions |
๐ด Real-time Transaction Streaming
The PHP SDK allows you to start/stop transaction polling (simulated streaming).
Note: Real-time streaming is best handled via the JavaScript SDK in the browser or via Node.js for production environments.
๐ค Response Format
All methods return an associative array:
๐ก๏ธ Security Best Practices
- โ Never expose secret keys in client-side code.
- โ
Use environment variables (
$_ENVorgetenv()). - โ
Keep
encrypted_sksecure in your backend database. - โ Always use HTTPS for API communications.
๐ Support
- ๐ Website: SofizPay.com
- ๐ Full Docs: docs.sofizpay.com
- ๐ Bug Reports: GitHub Issues
License
MIT ยฉ SofizPay Team
Built with โค๏ธ for PHP developers | Version 1.0.2