alsharie / cashpay-payment
CashPay payment gateway
1.2.1
2024-03-17 07:32 UTC
Requires
- php: >=7.4
- guzzlehttp/guzzle: ^7.5
- illuminate/support: >=9.33
This package is auto-updated.
Last update: 2025-04-17 09:54:47 UTC
README
laravel package for CashPay payment getway
install the package
composer require alsharie/cashpay-payment
You can publish using the following command
php artisan vendor:publish --provider="Alsharie\CashPayPayment\CashPayServiceProvider"
When published, the config/cashPay.php
config file contains:
return [ 'auth' => [ 'UserName' => env('CASHPAY_MERCHANT_USERNAME'), 'SpId' => env('CASHPAY_MERCHANT_SPID'), 'encPassword' => env('CASHPAY_MERCHANT_ENCPASSWORD'), ], 'cert' => [ 'path' => env('CASHPAY_CERT_PATH'), 'password' => env('CASHPAY_CERT_PASSWORD'), ], 'url' => [ 'base' => env('CASHPAY_BASE_URL', 'https://www.tamkeen.com.ye:33291/CashPG'), ] ];
when you are ready to release your application, you should set the CASHPAY_BASE_URL
to release-url
and they give you a certificate file and password to use it in CASHPAY_CERT_PATH
and CASHPAY_CERT_PASSWORD
respectively
To purchase using CashPay payment
1. Purchase
$cashPay = new CashPay(); $response = $cashPay ->setRequestId(/*request id*/) //Request unique identifier that should be generated by sp ->setCustomerPhone(/*phone */) // TargetMSISDN ->setCustomerCashPayCode(/*code*/) ->setAmount(/*amount*/) ->setCurrency(2) ->setDescription(/*desc*/) ->initPayment(); if ($response->isSuccess()) { $tran_ref = $response->getTransactionRef(); .... .... }
2. Confirm purchase
$cashPay = new CashPay(); $response = $cashPay ->setRequestId(/*request id*/) //Request unique identifier that should be generated by sp ->setOtp(/*otp */) // customer otp ->setTransactionRef(/*tran ref*/) //Transaction Code returned in InitPayment response ->confirmPayment(); if ($response->isSuccess()) { $code = $response->code(); .... .... }
you can get the full response body using $response->body()
for all requests