Download the PHP package waad/zaincash without Composer
On this page you can find all versions of the php package waad/zaincash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waad/zaincash
More information about waad/zaincash
Files in waad/zaincash
Package zaincash
Short Description ZainCash payment Integration Gateway package API laravel
License MIT
Informations about the package zaincash
ZainCash Integration API Laravel Package
This is a Laravel package to integrate ZainCash payment gateway API. For local financial transactions in Iraqi dinars inside Iraq. This package is based on the official ZainCash API documentation. You can find the official documentation (https://docs.zaincash.iq).
🎀 Requirements
Package Version | Laravel Version | PHP Version |
---|---|---|
6.x | 6.x | 7.2+ |
7.x | 7.x | 7.2.5+ |
8.x | 8.x | 7.3+ | 8.0+ |
9.x | 9.x | 8.0+ |
10.x | 10.x | 8.1+ |
11.x | 11.x | 8.2+ |
📌 Installation
publish config file to config/zaincash.php
update config zaincash in config/zaincash.php
or from .env
file
Key | Type | Default | Description |
---|---|---|---|
msisdn | string | 9647835077893 | The mobile phone number for your wallet, provided by Zain Cash. Example format: 9647835077893. |
merchant_id | string | 5ffacf6612b5777c6d44266f | The Merchant ID obtained from ZainCash. |
secret | string | $2y$10$h................ | The secret used to decode and encode JWT during requests. Obtain from ZainCash. |
test | bool | true | Specify the environment for using the ZainCash API. Set 'test' to false for the live environment after obtaining all credentials from ZainCash. |
test_url | string | https://test.zaincash.iq/ | URL for the ZainCash test environment. |
live_url | string | https://api.zaincash.iq/ | URL for the ZainCash live environment. |
language | string | ar | Set the language for the ZainCash payment page. Use 'ar' for Arabic or 'en' for English. |
prefix_order_id | string | wa3d_ | Prefix for the order ID. |
is_redirect | bool | false | Specify whether or not to redirect to the ZainCash payment page. If false, ZainCash returns a Transaction ID to the backend. If true, redirection after the request. |
min_amount | int | 1000 | Set the minimum amount for a valid transaction in Iraqi Dinar (IQD). Transactions with amounts less than this value will be considered invalid. |
timeout | int | 10 | Set the timeout for the request in seconds. |
verify_ssl | bool | true | Set the verify SSL for the request to ZainCash's API. |
Configurations to .env
file
🍔 Usage
use ZainCash
Facade or Class example
- Getter
And Setter
Attributes Table
Attribute | Important | Type | Getter | Setter | Default |
---|---|---|---|---|---|
amount | 🟢 | int-float-null | getAmount() |
setAmount($amount) |
- |
serviceType | 🟢 | string-null | getServiceType() |
setServiceType($serviceType) |
- |
orderId | 🟢 | string-int-float-null | getOrderId() |
setOrderId($orderId) |
- |
transactionID | 🟢 | string-null | getTransactionID() |
setTransactionID($transactionID) |
- |
isReturnArray | 🟢 | bool | getIsReturnArray() |
setIsReturnArray($isReturnArray) |
false |
minAmount | 🔴 | int-float-null | getMinAmount() |
setMinAmount($minAmount) |
- |
msisdn | 🔴 | string-null | getMsisdn() |
setMsisdn($msisdn) |
- |
secret | 🔴 | string-null | getSecret() |
setSecret($secret) |
- |
merchantId | 🔴 | string-null | getMerchantId() |
setMerchantId($merchantId) |
- |
isTest | 🔴 | bool-null | getIsTest() |
setIsTest($isTest) |
- |
language | 🔴 | string-null | getLanguage() |
setLanguage($language) |
- |
baseUrl | 🔴 | string-null | getBaseUrl() |
setBaseUrl($baseUrl) |
- |
isRedirect | 🔴 | bool | getIsRedirect() |
setIsRedirect($isRedirect) |
- |
tUrl | 🔴 | string-null | getTUrl() |
setTUrl($tUrl) |
- |
cUrl | 🔴 | string-null | getCUrl() |
setCUrl($cUrl) |
- |
rUrl | 🔴 | string-null | getRUrl() |
setRUrl($rUrl) |
- |
processingUrl | 🔴 | string-null | getProcessingUrl() |
setProcessingUrl($processingUrl) |
- |
processingOtpUrl | 🔴 | string-null | getProcessingOtpUrl() |
setProcessingOtpUrl($processingOtpUrl) |
- |
cancelUrl | 🔴 | string-null | getCancelUrl() |
setCancelUrl($cancelUrl) |
- |
timeout | 🔴 | int-null | getTimeout() |
setTimeout($timeout) |
- |
verifySsl | 🔴 | bool-null | getVerifySsl() |
setVerifySsl($verifySsl) |
- |
⚠️ Important
column means that this attribute is constantly used and has no default value. On the contrary, we can change it, but it will take the default value from config/zaincash.php
.
- Steps from create a transaction To Complete Payment
Step 1 - Create a transaction
setAmount($amount)
: Set the amount of the transaction in Iraqi Dinar (IQD). The amount must be greater than or equal to the minimum amount specified in the configuration file.setServiceType($serviceType)
: Set the service type for the transaction. The service type must be one of the following:Book
,Food
,Grocery
,Pharmacy
,Transportation
,Other
.setOrderId($orderId)
: Set the order ID for the transaction. The order ID must be unique for each transaction.setIsTest($isTest)
: Set the environment for using the ZainCash API. Settrue
for the test environment andfalse
for the live environment.setIsReturnArray(bool)
: Set the return type for the transaction. Settrue
to return an array andfalse
to return an object stdClass. The default value isfalse
.createTransaction()
: Create a transaction and return the transaction Details (array or object stdClass).
Response example
Step 2 - Check a transaction
setTransactionID($transactionID)
: Set the transaction ID for the transaction.setIsReturnArray(bool)
: Set the return type for the transaction. Settrue
to return an array andfalse
to return an object stdClass. The default value isfalse
.checkTransaction()
: Check the transaction and return the transaction details (array or stdClass).
Response Example dependent by status:
Step 3 - Processing a transaction
setTransactionID($transactionID)
: Set the transaction ID for the transaction.setIsReturnArray(bool)
: Set the return type for the transaction. Settrue
to return an array andfalse
to return an object stdClass. The default value isfalse
.processingTransaction($phonenumber, $pin)
: Processing the transaction and return the transaction details (array or object stdClass).
Response Example dependent by success:
Step 4 - Complete a transaction
setTransactionID($transactionID)
: Set the transaction ID for the transaction.setIsReturnArray(bool)
: Set the return type for the transaction. Settrue
to return an array andfalse
to return an object stdClass. The default value isfalse
.payTransaction($phonenumber, $pin, $otp)
: Complete pay the transaction and return the transaction details (array or object stdClass).
Response Example dependent by success:
Step 5 - Cancel a transaction
setTransactionID($transactionID)
: Set the transaction ID for the transaction.setIsReturnArray(bool)
: Set the return type for the transaction. Settrue
to return an array andfalse
to return an object stdClass. The default value isfalse
.cancelTransaction()
: Cancel the transaction and return the transaction details (array or object stdClass).
Response Example dependent by success:
🧔 Author
⚖️ License
The MIT License (MIT). Please see MIT license for more information.