PHP code example of alsharie / cashpay-payment
1. Go to this page and download the library: Download alsharie/cashpay-payment 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/ */
alsharie / cashpay-payment example snippets
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'),
]
];
$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();
....
....
}
$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();
....
....
}