Download the PHP package beinmedia/payment without Composer

On this page you can find all versions of the php package beinmedia/payment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package payment

payment_package

Latest Version on Packagist Total Downloads Build Status

laravel package, that implements MyFatoorah, Tap , PayPal payment gatways and paypal recurring billing.

Features

Requirements

Installation

Via Composer

Database Configuration

Update the .env configurations below:

Migrate:

Autoload:

Pyment Gatways

In order to make online payment gatway you need the following:

  1. Create the payment gatway link.
  2. Redirect the customer to the pyment link.
  3. User will pay.
  4. Recieve and validate the payment in the redirect URL you specified in the created payment gatway.

Paypal payment Gateway

Configuration

In the .evn file add Paypal credentials as the following example:

Usage

Methods:

This method will return the payment gateway url where the user should be redirected to in order to complete payment process.

You need to specify the amount , currency, where the user should be redirected after successful payment and the cancel url where the user shoul be redirected after failed or canceled payment.


MyFatoorah payment Gateway

Configuration

In the .evn file add MyFatoorah api key as the following:

Usage

Returns all payment methods for your account with the related fees for each method according to the amount.

This method will return the payment gateway url where the user should be redirected to in order to complete payment process. bash bash bash { success: false, errors: [ { Name: "Amount", Error: "Insufficient Balance for vendor" } ], refund: null } bash use MyFatoorahPayment;

$refunds = MyFatoorahPayment::refundsList(); bash TAP_API_KEY = sk_test_XKokBfNWv6FIYuTMg5sLPjhJ bash FAWRY_TESTING_MODE=true bash FAWRY_TESTING_PUBLISHED_BASE_URL=https://789fbf71.ngrok.io bash */ bash bash use beinmedia\payment\Services\TapGateway; use beinmedia\payment\Parameters\SubscriptionCharge; use beinmedia\payment\Parameters\SubscriptionParameters; use beinmedia\payment\Parameters\SubscriptionTerm;

public function createSubscription(){ $term = new SubscriptionTerm(); $term->interval = "DAILY"; //("DAILY","YEARLY","MONTHLY",...etc) $term->period = 10; //How many times you want to charge the customer card $term->from = "2020-11-12 16:08:00"; "the start time for the charge $term->due = 0; $term->auto_renew = true; //true if you want to renew the subscription automatically $term->timezone = "Asia/Kuwait"; //the timezone for which the start time for ythe charge is specified

    $charge = new SubscriptionCharge();
    $charge->amount = 10; //thre amount to be charged
    $charge->currency = "KWD"; //the currency of charge amount
    $charge->description = "This is a test subscription";
    $charge->metadata->track_id = "123456789910"; //A custom reference_id 
    $charge->reciept->email = true; //optional
    $charge->reciept->sms = true; //optional
    $charge->customer->id = 'cus_TS024820201200n5X50811060'; //customer_id returned from ChargeCard() method
    $charge->source->id = 'card_CFlTu1311012JanD527931'; //card_id returned from ChargeCard() method
    $charge->post->url = 'https://3b2429fb7e8b.ngrok.io/api/handle'; // post url where you want to be notified once a periodic payment is done.

    //Create subscription and get the subscription_id and status
    $data = new SubscriptionParameters($term,$charge);
    $response = app(TapGateway::class)->createSubscription($data);
    return response()->json(['response'=>$response]);
}

/ Response Eample { "status" : "active", "id" : "sub_43465789", } / bash use beinmedia\payment\Services\TapGateway;

public function handleRecurring(){ $response = app(TapGateway::class)->verifySubscriptionPayment();

    //you can call this for more verificattion:
    //$response = app(TapGateway::class)->isPaymentExecuted();

    if($response->status == true){
        return 'success';
    }
    return 'failed';
}

bash public function cancelSubscription(){ return app(TapGateway::class)->cancelSubscription('sub_Xr8s3820200900r5L51211982')]); } bash TAP_MARKETPLACE_API_KEY = sk_test_fEZYI3X1P7865rtsoGpbvw4qBm bash public function getSectors(){ return app(TapGateway::class)->getSectors($fileParameters); } bash public function createFile(){ $filename = time().'.'.request('file')->getClientOriginalExtension(); request('file')->move('storage', $filename); $filePath = "storage/$filename"; $purpose = 'identifcation_document'; $fileParameters = new FileParameters($filePath, $filename, $purpose); return app(TapGateway::class)->createFile($fileParameters); } bash

use beinmedia\payment\Services\TapGateway;

public function createBusiness(){
    $civil_id = new \stdClass();
    $civil_id->type = 'civil id';
    $civil_id->issuing_country = 'KW';
    $civil_id->issuing_date = '2020-01-01';
    $civil_id->expiry_date = '2021-01-01';
    $civil_id->images = ['file_773153834221826048']; //the file_id returned from createFile method as array 
    $civil_id->number = '295102500437'; //civil_id number
    $contact_person = new ContactPerson('Alaa','Naser',new Phone('965','65080631'),'[email protected]', [$civil_id]);

    $authorization = new \stdClass();
    $authorization->type = 'authorized_signature';
    $authorization->issuing_country = 'KW';
    $authorization->issuing_date = '2020-01-01';
    $authorization->expiry_date = '2021-01-01';
    $authorization->images = ['file_773150399938293760']; //the file_id returned from createFile method as array
    $authorization->number = '295102500437'; //authorized signature number

    $license = new \stdClass();
    $license->type = 'license';
    $license->issuing_country = 'KW';
    $license->issuing_date = '2020-01-01';
    $license->expiry_date = '2021-01-01';
    $license->images = ['file_773155798586355712']; //the file_id returned from createFile method as array 
    $license->number = '295102500437'; //commercial license number

    $parameters = new BusinessParameters();
    $parameters->business_name = 'test12121';
    $parameters->type = 'corp';
    $parameters->business_legal_name = 'test company for testing21212';
    $parameters->business_country = 'KW';
    $parameters->iban = 'erj54r73658647246928724'; //if iban is not added then swift_code and account_number are required
    $parameters->swift_code = '1234567890'; //optinal if iban is provided
    $parameters->account_number = 'acc_12345567890'; //optional if iban is provided
    $parameters->contact_person = $contact_person;
    $parameters->sector = ['sector_Vi2Dy828EgUeDVJ']; //returned from getSetors() method
    $parameters->website = 'https://oktabletmenu1.com';
    $parameters->documents = [$authorization, $license];

    return app(TapGateway::class)->createBusiness($fileParameters);

Create webhook

This webhook needs to be created only once while live to allow the package recieve notifications from paypal.

If you are using ngrok for testing you need to reset the related data at env file and recreate the webhook every 7 hours.

Usage

In order to create agreement for recurring payment you need the followuing:

  1. Create a plan to be assigned to the agreement. (Multible agreements can be assigned to the same plan)
  2. Create agreement and get the approval link where the user should be redirectred to accept that agreement.
  3. Execute agreement to process the agreement acceptance and validate agreement acceptance.
  4. Get the post notification whenever payment is completed for any agreement or whenever any agreement is cancelled, so you can give or remove licence to the payer.

Available Methods:

Getting Payment lists

At some point you may need to get all completed payments for the sake of statistics. The package offers this feature by getAllPayments() method.

Usage

Samples

isPaymentExecuted();

Fawry

isPaymentExecuted();

Once Recurring payment is completed:

Once Recurring payment is cancelled:

Credits


All versions of payment with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ~5|~6 |~7|~8
paypal/rest-api-sdk-php Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package beinmedia/payment contains the following files

Loading the files please wait ....