1. Go to this page and download the library: Download coolerproyt/razerms-php 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/ */
coolerproyt / razerms-php example snippets
use CoolerProYT\RazermsPHP\PaymentChannel;
$rms = new PaymentChannel('YOUR_MERCHANT_ID','YOUR_VERIFY_KEY','SANDBOX_MODE'); // SANDBOX_MODE default value is false
$response = $rms->createPayment([
'MerchantID' => 'YOUR_MERCHANT_ID',
'ReferenceNo' => 'YOUR_REFERENCE_NO',
'TxnType' => 'SALS', //Refer to the API documentation for the full list of TxnType
'TxnChannel' => 'CREDIT7', //Refer to the API documentation for the full list of TxnChannel
'TxnCurrency' => 'MYR',
'TxnAmount' => '1.00', //Amount your customer needs to pay
'Signature' => md5('TnxAmount'.'YOUR_MERCHANT_ID'.'YOUR_REFERENCE_NO'.'YOUR_VERIFY_KEY'),
'CC_PAN' => '5555555555554444', //Credit Card Number for sandbox mode
'CC_CVV2' => '444', //Credit Card CVV for sandbox mode
'CC_MONTH' => '12', //Credit Card Expiry Month for sandbox mode, can be any future date
'CC_YEAR' => '26', //Credit Card Expiry Year for sandbox mode, can be any future date
//Other optional and conditional parameters, refer to the API documentation for the full list
],'AUTO_REDIRECT'); //AUTO_REDIRECT will redirect the user to the payment page, default value will be false
$response = $rms->createPayment([
'MerchantID' => 'YOUR_MERCHANT_ID',
'ReferenceNo' => 'YOUR_REFERENCE_NO',
'TxnType' => 'SALS', //Refer to the API documentation for the full list of TxnType
'TxnChannel' => 'TNG-EWALLET', //Refer to the API documentation for the full list of TxnChannel
'TxnCurrency' => 'MYR',
'TxnAmount' => '1.00', //Amount your customer needs to pay
'Signature' => md5('TnxAmount'.'YOUR_MERCHANT_ID'.'YOUR_REFERENCE_NO'.'YOUR_VERIFY_KEY'),
],'AUTO_REDIRECT'); //AUTO_REDIRECT will redirect the user to the payment page, default value will be false
namespace App\Livewire;
use Livewire\Component;
use CoolerProYT\RazermsPHP\PaymentChannel;
class Payment extends Component
{
public function pay(){
$rms = new PaymentChannel('YOUR_MERCHANT_ID','YOUR_VERIFY_KEY','SANDBOX_MODE');
$response = $rms->createPayment([
'MerchantID' => 'YOUR_MERCHANT_ID',
'ReferenceNo' => '1',
'TxnType' => 'SALS', //Refer to the API documentation for the full list of TxnType
'TxnChannel' => 'CREDITZ', //Refer to the API documentation for the full list of TxnChannel
'TxnCurrency' => 'MYR',
'TxnAmount' => '1.00', //Amount your customer needs to pay
'Signature' => md5('TnxAmount'.'YOUR_MERCHANT_ID'.'YOUR_REFERENCE_NO'.'YOUR_VERIFY_KEY'),
'CC_PAN' => '5555555555554444', //Credit Card Number for sandbox mode
'CC_CVV2' => '444', //Credit Card CVV for sandbox mode
'CC_MONTH' => '12', //Credit Card Expiry Month for sandbox mode, can be any future date
'CC_YEAR' => '26', //Credit Card Expiry Year for sandbox mode, can be any future date
//Other optional and conditional parameters, refer to the API documentation for the full list
]); //AUTO_REDIRECT will redirect the user to the payment page, default value will be false
$response = json_decode($response);
return redirect()->route('pay')->with(['postData' => $response->TxnData]);
}
public function render()
{
return view('livewire.payment');
}
}
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use CoolerProYT\RazermsPHP\DirectPayment;
class PaymentController extends Controller
{
public function pay(Request $request){
$rms = new PaymentChannel('YOUR_MERCHANT_ID','YOUR_VERIFY_KEY','SANDBOX_MODE');
$rms->redirectToPaymentPage($request->session()->get('postData'));
}
}
use CoolerProYT\RazermsPHP\ApiChannel;
$rms = new ApiChannel('YOUR_MERCHANT_ID','YOUR_VERIFY_KEY','SANDBOX_MODE'); // SANDBOX_MODE default value is false
$response = $rms->cardBin([
'domain' => 'YOUR_MERCHANT_ID',
'skey' => md5('YOUR_MERCHANT_ID'.'YOUR_SECRET_KEY','BIN'),
'BIN' => '555566' //First 6-digit number of the PAN
]);