1. Go to this page and download the library: Download beinmedia/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/ */
beinmedia / payment example snippets
bash
$ php artisan migrate
bash
use PaypalPayment;
public function checkPaypalPayment (Request $request){
if(PaypalPayment::isPaymentExecuted()->status)
return 'success';
else
return 'fail';
}
bash
use PaypalRecurring;
public function executeAgreement(Request $request){
if(PaypalRecurring::executeAgreement() instanceof Agreement)
return 'yes';
return 'No';
}
bash
use PaypalRecurring;
public function cancelAgreement(Request $request){
return PaypalRecurring::cancelAgreement('I-975S8RWXLGMU');
}
bash
use PaypalRecurring;
public function cancelAgreement(Request $request){
return PaypalRecurring::cancelAgreement('I-975S8RWXLGMU');
}
bash
use PaypalRecurring;
public function cancelAgreement(Request $request){
return PaypalRecurring::checkAgreementPayed('I-975S8RWXLGMU');
}
use beinmedia\payment\Parameters\PaymentParameters;
use MyFatoorahPayment;
// Create the paymentParameters object
$data=new PaymentParameters();
$data->paymentMethodId=1; // Check the available methods from the table
$data->amount=10; // Amount
$data->trackId= "track id"; //optional - user defined field
$data->currency="KWD"; // optional- default the same as api country currency
$data->name="Alaa"; // optional- Customer name
$data->email="[email protected]"; // optional- Customer email
$data->returnURL=url('/fatoorah-check'); // Fully qualified url where the user will be redirected after successful payment.
$data->cancelURL="https://www.beinmedia.com/"; // Fully qualified url where the user will be redirected after failed payment.
//Getting the payment link where the user should be redirected to
$paymentLink = MyFatoorahPayment::generatePaymentURL($data);
bash
use MyFatoorahPayment;
public function checkMyFatoorahPayment(Request $request){
if(MyFatoorahPayment::isPaymentExecuted()->status)
return ‘success’;
else
return ‘fail’;
use beinmedia\payment\Parameters\PaymentParameters;
use TapPayment;
//for fawry add postURL only
//for other methods add redirectURL only
$data=new PaymentParameters();
$data->email="[email protected]"; // Customer email
$data->name="Alaa"; //Customer email
$data->countryCode="965";
$data->phoneNumber="65080631";
$data->trackId= "track id"; //optional - user defined field
$data->amount=10; // float amount
$data->description="dfghjk";
$data->paymentMethodId="src_eg.fawry";
$data->currency="EGP"; // Iso currency
$data->destination_id = '1235'; //the destination_id returned from create business (used for multivendor)
$data->transfer_amount = 9; // the amount that will be transfered to the business in case destination_id is specified;
// For fawry only - To get notification once the payment is completed (Asyncronous payment)
$data->postURL=url('/api/fawry-check'); // Fully qualified url (Only Post method routs are allowed).
// For other methods only, not for fawry
$data->returnURL=url("tap-check"); // Fully qualified url where the user will be redirected after successful payment.
//Getting the payment link where the user should be redirected to
$paymentLink = TapPayment::generatePaymentURL($data);
bash
use beinmedia\payment\Parameters\PaymentParameters;
use TapPayment;
//for fawry add postURL only
//for other method add redirectURL only
$data=new PaymentParameters();
$data->email="[email protected]";
$data->name="Alaa";
$data->returnURL=url("tap-check");
$data->countryCode="965";
$data->phoneNumber="65080631";
$data->amount=10;
$data->description="dfghjk";
$data->paymentMethodId="tok_Ck8tJ1311012ntXJ527473";// the one time token created with tap card.js library
$data->currency="KWD";
$data->trackId="1234";
$data->destination_id = '1234';
$data->transfer_amount = 9;
//Charge the credit card and get the response
$paymentLink = TapPayment::ChargeCard($data);
/*
Response Eample
{
"card_id" : "card_576789",
"customer_id" : "cus_43465789",
"charge_id" : "ch_5476769",
"status" : true
use TapPayment;
public function checkTapPayment (Request $request){
if( TapPayment::isPaymentExecuted()->status)
return ‘success’;
else
return ‘fail’;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.