PHPackages                             openpayau/openpaylaravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. openpayau/openpaylaravel

ActiveLibrary[Payment Processing](/categories/payments)

openpayau/openpaylaravel
========================

This is a client implementing the payment services for Openpay

01.4k1PHP

Since Apr 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/openpaygithub/Laravel)[ Packagist](https://packagist.org/packages/openpayau/openpaylaravel)[ RSS](/packages/openpayau-openpaylaravel/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Openpay Sdk laravel 5.4 Documentation
=====================================

[](#openpay-sdk-laravel-54-documentation)

 This docmetation basically for composer php. if you want to use our sdk for composer based php like laravel go to install Openpay composer package run the below command:

```
      composer require openpayau/openpaylaravel dev-master
```

###  There is an instruction for the use. Here openpayau is vander name Laravel Framework:

[](#there-is-an-instruction-for-the-use-here-openpayau-is-vander-name-laravel-framework)

- **To install Openpay composer package run the below command****composer require openpayau/openpaylaravel dev-master**

```
     *After Installation give write permission to the log folder in the path:
     "/vendor/openpayau/openpay/lib/Openpay/log".
```

- **Include the Openpay.php in the any controller page**

```
      require(app_path('/../vendor/openpayau/openpaylaravel/lib/Openpay/Common/Openpay.php'));
```

- **In the file the basic urls are define like this and use those constant**

```
      define("URL","https://retailer.myopenpay.com.au/ServiceTraining/JAMServiceImpl.svc/");  //Openpay
```

 Test Mode Or Live Mode URL place here: ```
        define("CALLBACK_URL",url('/callback'));                                      //Openpay Callback URL place here
        define("CANCEL_URL",url('/cancel'));                                          //Openpay Cancel URL place here
        define("FAILURE_URL",url('/failure'));                                        //Openpay Failure URL place here
        define("FORM_URL","https://retailer.myopenpay.com.au/WebSalesTraining/");     //Openpay Form Submit URL place here
        define("JAMTOKEN","Put your jamtoken here");  //Openpay Test Mode or Live Mode JAMTOKEN place here.(* When it is generate just change the JAMTOKEN)
```

- **Then you have to set the basic parameters like this**

---

###  User Parameters from site

[](#------------------------user-parameters-from-site)

```

        if (!Session::has('cart'))
        {
            return redirect()->route('product.shoppingcart');
        }

        $oldCart = Session::get('cart');

        $cart = new Cart($oldCart);

        try
        {
              $chars = "0123456789";
              $res = "";
                 for ($i = 0; $i < 4; $i++)
                 {
                   $res .= $chars[mt_rand(0, strlen($chars)-1)];
                 }

      $url=URL;

      $jamtoken=JAMTOKEN;

      $PurchasePrice = 170.00;             //Format : 100.00(Not more than $1 million) , This values are comming form checkout form

      $JamCallbackURL = CALLBACK_URL;     //Not more than 250 characters

      $JamCancelURL = CANCEL_URL;         //Not more than 250 characters

      $JamFailURL =FAILURE_URL;          //Not more than 250 characters

      $form_url =   FORM_URL;

      $JamRetailerOrderNo = '10000478';         //Consumer site order number, This values are comming form checkout form

      $JamEmail = 'gautamtest@gmail.com';       //Not more than 150 characters, This values are comming form checkout form

      $JamFirstName = 'Test';                   //First name(Not more than 50 characters), This values are comming form checkout form

      $JamOtherNames = 'Devloper';              //Middle name(Not more than 50 characters), This values are comming form checkout form

      $JamFamilyName = 'Test';                  //Last name(Not more than 50 characters), This values are comming form checkout form

      $JamDateOfBirth = '04 Nov 1982';          //dd mmm yyyy, This values are comming form checkout form

      $JamAddress1 = '15/520 Collins Street';   //Not more than 100 characters, This values are comming form checkout form

      $JamAddress2 = '';                        //Not more than 100 characters, This values are comming form checkout form

      $JamSubrub = 'Melbourne';                 //Not more than 100 characters, This values are comming form checkout form

      $JamState = 'VIC';                        //Not more than 3 characters, This values are comming form checkout form

      $JamPostCode = '3000';                    //Not more than 4 characters, This values are comming form checkout form

      $JamDeliveryDate = '01 Jan 2019';         //dd mmm yyyy, This values are comming form checkout form

      $JamGender = 'M';                         //M/F, This values are comming form checkout form

      $JamPhoneNumber = '9830000000';          //, This values are comming form checkout form

      $ChargeBackCount = 0;                     //How many chargebacks are known to have been received from this customer?-1 = Unknown

      $CustomerQuality = 1;
```

```
$PostValues = array(
                  'RetailerOrderNo'=>$JamRetailerOrderNo,
                  'ChargeBackCount'=>$ChargeBackCount,
                  'CustomerQuality'=>$CustomerQuality,
                  'FirstName'=>$JamFirstName,
                  'OtherNames'=>$JamOtherNames,
                  'FamilyName'=>$JamFamilyName,
                  'Email'=>$JamEmail,
                  'DateOfBirth'=>$JamDateOfBirth,
                  'Gender'=>$JamGender,
                  'PhoneNumber'=>$JamPhoneNumber,
                  'ResAddress1'=>$JamAddress1,
                  'ResAddress2'=>$JamAddress2,
                  'ResSuburb'=>$JamSubrub,
                  'ResState'=>$JamState,
                  'ResPostCode'=>$JamPostCode,
                  'DelAddress1'=>$JamAddress1,
                  'DelAddress2'=>$JamAddress2,
                  'DelSuburb'=>$JamSubrub,
                  'DelState'=>$JamState,
                  'DelPostCode'=>$JamPostCode
                  );
```

- **Now you have to call the Call-1 NEW ONLINE ORDER API menthods like this**

```

  $Method = "NewOnlineOrder";
        $obj = new \openpayau\openpaylaravel\lib\Openpay\Api\NewOnlineOrder(URL,$Method,$PurchasePrice,JAMTOKEN, AUTHTOKEN,'','','','','','',$PostValues);
        $responsecall1 = $obj->_checkorder();
        $output = json_decode($responsecall1,true);
        $openErrorStatus = new \openpayau\openpaylaravel\lib\OpenPay\Exception\ErrorHandler();
        if($openErrorStatus !='')
        {
            $openErrorStatus->_checkstatus($output['status']);
        }
```

- **Store Call-1 response in log file use this code**

 ```
       $log  = "Call-time: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
       "Log: ".$responsecall1.PHP_EOL.
       "-------------------------".PHP_EOL;

```

Save string to log, use FILE\_APPEND to append:

```
      file_put_contents(app_path('/../vendor/openpayau/openpaylaravel/lib/Openpay').'/Log/log'.date("j.n.Y").'.log', $log, FILE_APPEND);
```

- **Now we got plan id and ready for payment so here it is by Call-2 API**

```

    if($output)
            {
              if($output['status'] == 0){

                $userdetails = Auth::user();
                $order = new Order;
                    $order->user_id = $userdetails->id;
                    $order->payment_id = 0;
                    $order->address = $request->input('address');
                    $order->name = $request->input('name');
                    $order->email = $request->input('email');
                    $order->final_amount = $PurchasePrice;
                    $order->plan_id = $output['PlanID'];

                    $order->save();

                  $JamPlanID = $output['PlanID'];             //Plan ID retrieved from Web Call 1 API
                  $pagegurl = $form_url.'?JamCallbackURL='.$JamCallbackURL.'&JamCancelURL='.$JamCancelURL.'&JamFailURL='.$JamFailURL.'&JamAuthToken='.urlencode(JAMTOKEN).'&JamPlanID='.urlencode( (string) $JamPlanID);

                  try {
                    if($JamDateOfBirth)
                      \openpayau\openpaylaravel\lib\OpenPay\Validation\Validation::_validateDate($JamDateOfBirth);
                    if($JamDateOfBirth)
                      \openpayau\openpaylaravel\lib\OpenPay\Validation\Validation::_validateDate($JamDeliveryDate);
                    if($JamState)
                      \openpayau\openpaylaravel\lib\OpenPay\Validation\Validation::_validateState($JamState);
                    if($JamPostCode)
                      \openpayau\openpaylaravel\lib\OpenPay\Validation\Validation::_validatePostcode($JamPostCode);
                    $charge = \openpayau\openpaylaravel\lib\OpenPay\Api\OpenpayCharge::_charge($pagegurl);
                  }
                  catch(Exception $e) {
                    echo 'Message: ' .$e->getMessage();
                  }
                }else{
                  return redirect()->route('checkout')->with('error',$output['reason']);

                }
            }

        } catch (\Exception $e) {
            return redirect()->route('checkout')->with('error', $e->getMessage());
        }
```

- **After the payment process complited on openpay, it will redirect to the merchant website with help of callback url**

#####  Success Url :

[](#success-url-)

 \[JamCallbackURL\]?status=SUCCESS&amp;planid=3000000022284&amp;orderid=1402  **Success Result :**

```
          Array(
                  [status] => 0
                    [reason] => Array
                              (
                              )
                      [PlanID] => 3000000022284
                      [PurchasePrice] => 110.0000
              )
```

#####  Cancel Url :

[](#cancel-url-)

 \[JamCancelURL or JamCallbackURL\]?status=CANCELLED&amp;planid=3000000022284&amp;orderid=1402  **Cancel Result :**

```
          Array (
                  [status] => CANCELLED
                  [planid] => 3000000022284
                  [orderid] => 1402
               )
```

#####  Failure Url :

[](#failure-url-)

 \[JamFailURL or JamCallbackURL\]?status=FAILURE&amp;planid=3000000022284&amp;orderid=1402  **Failure Result :**

```
          Array (
                  [status] => FAILURE
                  [planid] => 3000000022284
                  [orderid] => 1402
               )
```

- **Add the Call-3 PAYMENT CAPTURE API like below**

```

		$PlanID = '3000000019868'; // callback url get
        $Method = "OnlineOrderCapturePayment";
        $obj=new\openpayau\openpaylaravel\lib\OpenPay\Api\OnlineOrderCapturePayment(URL,$Method,'',JAMTOKEN,AUTHTOKEN,$PlanID);
        $response = $obj->_checkorder();
        $output = json_decode($response,true);
        $openErrorStatus=new\openpayau\openpaylaravel\lib\OpenPay\Exception\ErrorHandler();
        if($openErrorStatus !='')
            {
                $openErrorStatus->_checkstatus($output['status']);
            }
```

Something to write to txt log:

```
      $log  = "Call 3 log time: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
      "Log: ".$response.PHP_EOL.
      "-------------------------".PHP_EOL;
```

Save string to log, use FILE\_APPEND to append:

```
      file_put_contents(app_path('/../vendor/openpayau/openpaylaravel/lib/Openpay').'/Log/log'.date("j.n.Y").'.log', $log, FILE_APPEND);
```

- **Check your order status**

```
      $PlanID = '3000000019868';                                      //Plan ID retrieved from Web Call 1 API
      $Method = "OnlineOrderStatus";
      $obj = new \openpayau\openpaylaravel\lib\OpenPay\Api\OnlineOrderStatus(URL,$Method,'',JAMTOKEN,AUTHTOKEN,$PlanID);
      $response = $obj->_checkorder();
      $output = json_decode($response,true);
      $openErrorStatus=new\openpayau\openpaylaravel\lib\OpenPay\Exception\ErrorHandler();
```

Something to write to txt log:

```
       $log  = "Order status log time: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
       "Log: ".$response.PHP_EOL.
       "-------------------------".PHP_EOL;
```

Save string to log, use FILE\_APPEND to append:

```
      file_put_contents(app_path('/../vendor/openpayau/openpaylaravel/lib/Openpay').'/Log/log'.date("j.n.Y").'.log', $log, FILE_APPEND);
```

- **For Refund Process**

```
        $PlanID = '3000000020110';          //Plan ID retrieved from Web Call 1 API
        $Method = "OnlineOrderReduction";
        $ReducePriceBy = 50.00;             //The amount you want to refund
        $type = False;                      //make True if want to refund full Plan price
```

```
        //echo $ReducePriceBy.'=='.$type;
        //die;
        //True if want to refund full Plan price
```

```
        $obj = new \openpayau\openpaylaravel\lib\Openpay\Api\PlanPurchasePriceReductionCall(URL, $Method, '', JAMTOKEN, AUTHTOKEN, $PlanID, '', $ReducePriceBy, $type);
        $response = $obj->_checkorder();
        $output = json_decode($response,true);    [dd($output);]
        $openErrorStatus=new\openpayau\openpaylaravel\lib\Openpay\Exception\ErrorHandler();
```

Something to write to txt log:

```
         $log  = "Order refund log time: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
         "Log: ".$response.PHP_EOL.
         "-------------------------".PHP_EOL;
```

Save string to log, use FILE\_APPEND to append:

```
        file_put_contents(app_path('/../vendor/openpayau/openpaylaravel/lib/Openpay').'/Log/log'.date("j.n.Y").'.log', $log, FILE_APPEND);
```

```
    .

```

#### Refund process will be excute as per the following steps:

[](#refund-process-will-be-excute-as-per-the-following-steps)

```
    1. At the time of full refund the $ReducePriceBy should be set null and $type should be set False.

    2.For Partial refund $ReducePriceBy should be set as needed and $type should be set True.

    3.Retailers will get refund upto a certain amount which will be set by the Openpay merchant.Once the retailer has reached maximum refund amount limit they will get a message like “Invalid Web Sales Plan Status For Partial Refund”.
```

- **For Plan Dispatch**

 This call supports Retailers that are set up to not receive any payment for their Plans until their system has issued a dispatch notice. This allows those retailers to make adjustments to their orders as needed prior to fulfilment and then receive the payment and reconciliation information after the dispatch event occurs.

```
    $PlanID = '3000000020110';                                    //Plan ID retrieved from Web Call 1 API
    $Method = "OnlineOrderDispatchPlan";
    $obj=new\openpayau\openpaylaravel\lib\Openpay\Api\OnlineOrderDispatchPlan(URL,$Method,'',JAMTOKEN,AUTHTOKEN,$PlanID);
    $response = $obj->_checkOrderDispatchPlan();
    $output = json_decode($response,true);
    $openErrorStatus=new\openpayau\openpaylaravel\lib\Openpay\Exception\ErrorHandler();
```

Something to write to txt log:

```
    $log  = "Order dispatch log time: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
    "Log: ".$response.PHP_EOL.
    "-------------------------".PHP_EOL;
```

Save string to log, use FILE\_APPEND to append:

```
    file_put_contents(app_path('/../vendor/openpayau/openpaylaravel/lib/Openpay').'/Log/log'.date("j.n.Y").'.log', $log, FILE_APPEND);
```

- **For Online Order Fraud Alert Process**

```
        $PlanID = '3000000020110';          //Plan ID retrieved from Web Call 1 API
        $Method = "OnlineOrderFraudAlert";
        $Details = $req->input('fdetails'); //fraud text

       $obj = new \openpayau\openpaylaravel\lib\Openpay\Api\OnlineOrderFraudAlert(URL, $Method, '', JAMTOKEN, AUTHTOKEN, $PlanID, '', '' , '',$Details);
       $response = $obj->_OnlineOrderFraudAlert();
        $output = json_decode($response,true);    [dd($output);]
        $openErrorStatus=new\openpayau\openpaylaravel\lib\Openpay\Exception\ErrorHandler();
Something to write to txt log:
         $log  = "Order fraud log time: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
         "Log: ".$response.PHP_EOL.
         "-------------------------".PHP_EOL;
Save string to log, use FILE_APPEND to append:
        file_put_contents(app_path('/../vendor/openpayau/openpaylaravel/lib/Openpay').'/Log/log'.date("j.n.Y").'.log', $log, FILE_APPEND);
    .

This API call is provided for those systems that support latent customer fraud warning alerts that may be received outside of the normal process.
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b600ac41bb6454cc32714f8baab05c8479a7a491ab3cd3811b803744be22a26?d=identicon)[Openpay](/maintainers/Openpay)

---

Top Contributors

[![ritayan-dat](https://avatars.githubusercontent.com/u/13643060?v=4)](https://github.com/ritayan-dat "ritayan-dat (8 commits)")[![openpaygithub](https://avatars.githubusercontent.com/u/43361192?v=4)](https://github.com/openpaygithub "openpaygithub (1 commits)")

### Embed Badge

![Health badge](/badges/openpayau-openpaylaravel/health.svg)

```
[![Health](https://phpackages.com/badges/openpayau-openpaylaravel/health.svg)](https://phpackages.com/packages/openpayau-openpaylaravel)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
