putera / m2upay
Maybank2U Pay - PHP SDK
v1.2
2019-12-16 08:17 UTC
Requires
- php: >=5.5
- ext-mcrypt: *
This package is auto-updated.
Last update: 2024-05-16 16:12:01 UTC
README
This is an PHP SDK library for Maybank2U Pay
Installation
Composer (recommended)
Use Composer to install this library from Packagist:
putera/m2upay
Run the following command from your project directory to add the dependency:
composer require putera/m2upay
Alternatively, add the dependency directly to your composer.json
file:
{ "require": { "putera/m2upay": "*" } }
Direct download
Download the ZIP file
and extract into your project. An autoloader script is provided in
src/autoload.php
which you can require into your script. For example:
require_once '/path/to/m2upay/src/autoload.php';
The classes in the project are structured according to the PSR-4 standard, so you can also use your own autoloader or require the needed files directly in your code.
Usage
<?php use M2U\M2UPay; $m2upay = new M2UPay(); // Environment Type // 0 : Sandbox // 1 : User Acceptance Test (UAT) // 2 : Production / Live $envType = 0; $mydata = array( 'amount' => 100.00, 'accountNumber' => "A123456", 'payeeCode' => "***" ); $encryptedData = $m2upay->getEncryptionData($mydata, $envType); // HTML Render <div id="m2upay"></div> <script type="text/javascript" src="/path/to/m2upay/src/M2UPay.js"></script> <script> var encrypt_data = <?php echo $encryptedData; ?> M2UPay.initPayment(encrypt_data.encryptedString, encrypt_data.actionUrl, 'OT'); </script>
Thanks !