Giter VIP home page Giter VIP logo

mobilpay's Introduction

Mobilpay

Laravel 5 mobilpay wrapper around omnipay with omnipay-mobilpay driver Edit Add topics

Table of Contents

Installation

Composer

Require the package via composer

composer require adrianbarbos/mobilpay

Or add the package to your composer.json file.

{
    "require": {
        "adrianbarbos/mobilpay": "^1.0"
    }
}

And run composer update to get the latest version of the package.

Laravel

Mobilpay comes with a service provider for Laravel. You'll need to add it to your composer.json as mentioned in the above steps, then register the service provider with your application.

From Laravel 5.5, the service provider and facades will automatically get registered.

Open config/app.php and find the providers key. Add MobilpayServiceProvider to the array.

...
Adrianbarbos\Mobilpay\MobilpayServiceProvider::class,
...

Add the required aliases to the list of class aliases in the same file.

...
'Omnipay' => Omnipay\Omnipay::class,
'Mobilpay'	=> Adrianbarbos\Mobilpay\Mobilpay::class,
...

Publish config.

php artisan vendor:publish --provider="Adrianbarbos\Mobilpay\MobilpayServiceProvider"

Basic Usage

Initiating Payment Request

// controller function

Mobilpay::setOrderId(1)
        ->setAmount('10.00')
        ->setDetails('Some details')
        ->purchase();

Handle Reponse

// controller function

$response = Mobilpay::response();

$data = $response->getData(); //array

switch($response->getMessage())
{
    case 'confirmed_pending': // transaction is pending review. After this is done, a new IPN request will be sent with either confirmation or cancellation

        //update DB, SET status = "pending"

        break;
    case 'paid_pending': // transaction is pending review. After this is done, a new IPN request will be sent with either confirmation or cancellation

        //update DB, SET status = "pending"

        break;
    case 'paid': // transaction is pending authorization. After this is done, a new IPN request will be sent with either confirmation or cancellation

        //update DB, SET status = "open/preauthorized"

        break;
    case 'confirmed': // transaction is finalized, the money have been captured from the customer's account

        //update DB, SET status = "confirmed/captured"

        break;
    case 'canceled': // transaction is canceled

        //update DB, SET status = "canceled"

        break;
    case 'credit': // transaction has been refunded

        //update DB, SET status = "refunded"

        break;
}	                

Options

Order id

/**
 * @param $value string
 * @return $this
 */

public function setOrderId($value)

Amount

/**
 * @param $value string
 * @return $this
 */

public function setAmount($value)

Currency

/**
 * @param $value string
 * @return $this
 */

public function setCurrency($value)

Details

/**
 * @param $value string
 * @return $this
 */

public function setDetails($value)

Confirm Url

/**
 * @param $value string
 * @return $this
 */

public function setConfirmUrl($value)

Return Url

/**
 * @param $value string
 * @return $this
 */

public function setReturnUrl($value)

Test Mode

/**
 * @param $value boolean
 * @return $this
 */

public function setTestMode($value)

Additional Params

/**
 * @param $value array
 * @return $this
 */

public function setAdditionalParams($value)

mobilpay's People

Contributors

adrianbarbos avatar necenzurat avatar firewizard avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.