PHPackages                             academe/omnipay-mpay24 - 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. academe/omnipay-mpay24

ActiveLibrary[Payment Processing](/categories/payments)

academe/omnipay-mpay24
======================

mPAY24 driver for Omnipay v3

1.1.5(5y ago)31.6k↓76.5%2[4 issues](https://github.com/academe/omnipay-mpay24/issues)[2 PRs](https://github.com/academe/omnipay-mpay24/pulls)MITPHPPHP &gt;=7.2

Since Mar 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/academe/omnipay-mpay24)[ Packagist](https://packagist.org/packages/academe/omnipay-mpay24)[ Docs](https://github.com/academe/omnipay-mpay24)[ RSS](/packages/academe-omnipay-mpay24/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (8)Versions (9)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/392dfada6568016ca94064942e6a6e4d898f9e50205c8b09db823095bdba8b99/68747470733a2f2f706f7365722e707567782e6f72672f61636164656d652f6f6d6e697061792d6d70617932342f762f737461626c65)](https://packagist.org/packages/academe/omnipay-mpay24)[![Total Downloads](https://camo.githubusercontent.com/a7ae2a891d111ecb069be7d3485e22353e2c904170626fb9d6b44d5730e9234e/68747470733a2f2f706f7365722e707567782e6f72672f61636164656d652f6f6d6e697061792d6d70617932342f646f776e6c6f616473)](https://packagist.org/packages/academe/omnipay-mpay24)[![Latest Unstable Version](https://camo.githubusercontent.com/67677084156b98e9bd3c93e8136dfeacc9159c9f27f1ef4769e752474191f42f/68747470733a2f2f706f7365722e707567782e6f72672f61636164656d652f6f6d6e697061792d6d70617932342f762f756e737461626c65)](https://packagist.org/packages/academe/omnipay-mpay24)[![License](https://camo.githubusercontent.com/48dc3d95a5ec15c680f3a5746759e99d73209473ff7a75387121e62cb227dab4/68747470733a2f2f706f7365722e707567782e6f72672f61636164656d652f6f6d6e697061792d6d70617932342f6c6963656e7365)](https://packagist.org/packages/academe/omnipay-mpay24)

Table of Contents
=================

[](#table-of-contents)

- [Table of Contents](#table-of-contents)
- [mPAY24 Driver for Omnipay v3](#mpay24-driver-for-omnipay-v3)
    - [Seamless Payment Initiation](#seamless-payment-initiation)
        - [Create Token](#create-token)
        - [Payment Using Token](#payment-using-token)
        - [Seamless Complete Payment](#seamless-complete-payment)
    - [Payment Page](#payment-page)
        - [Purchase (redirect)](#purchase-redirect)
        - [Payment Page Complete Payment](#payment-page-complete-payment)
        - [Payment Page Recurring Profiles](#payment-page-recurring-profiles)
    - [Notification Handler](#notification-handler)

mPAY24 Driver for Omnipay v3
============================

[](#mpay24-driver-for-omnipay-v3)

There are two main front ends to initiate a payment: *paymentPage* and *seamless*.

The *paymentPage* (also known as the *redirect* method) handles payments completely offsite, while *seamless* keeps the user on site for most of the time, only going off site for 3D Secure or remote service authentication and authorisation.

Both intiation types use the same direct server (known as *backend2backend*) API methods.

Seamless Payment Initiation
---------------------------

[](#seamless-payment-initiation)

This intiation method handles a number of payment types, some requiring additional PCI checks to use. The most comming credit card method will be token based, with a token being created at the back end first, and a URL related to that token being used to provide an iframe-based credit card form. An example of how this can work is shown below, but there are other ways it can be done, with additional front-end functionality to choose payment types.

### Create Token

[](#create-token)

First a token is created on the back end. This token will need to be saved for the next stage, either in the session or passed through the order form.

```
use Omnipay\Omnipay;

$gateway = Omnipay::create('Mpay24_Seamless');

$gateway->setMerchantId('12345');
$gateway->setPassword('AB1234cd56');
$gateway->setTestMode(true);

$request = $gateway->token([
    'language' => 'en',
    //'customerId' => 'foo',
    //'profileId' => 'bar',
    //'style' => 'fizz',
]);

$response = $request->send();

if (! $response->isSuccessful()) {
    // Token could not be generated.
    echo 'Error: '.$response->getReturnCode().'';
    exit;
}
```

This gives us a token and an iframe URL:

```
$response->getRedirectUrl();
$response->getToken();
```

The payment form can be created as follows, assuming `/pay` as the next enpoint in your flow. The iframe will contain the rendered credit card form. Add whatever additional customer or order details you want to the form. The iframe will be submitted with the form, but won't itself make any changes to your form; the credit card details go straight to the mPAY24 gateway. With this example, the submit bitton will remain disabled until the credit card details in the iframe have been completed.

The token does not need to go through the form, but could be carried forward through the session instead.

```
