2017 © Pedro Peláez
 

library omnipay-mycard

MyCard gateway for Omnipay payment processing library

image

xxtime/omnipay-mycard

MyCard gateway for Omnipay payment processing library

  • Friday, December 15, 2017
  • by xxtime
  • Repository
  • 1 Watchers
  • 1 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 40 % Grown

The README.md

Omnipay: MyCard

Latest Stable Version Build Status Total Downloads Scrutinizer Code Quality License, (*1)

MyCard driver for the Omnipay PHP payment processing library, (*2)

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements MyCard support for Omnipay., (*3)

Installation

Omnipay is installed via Composer. To install, simply add it to your composer.json file:, (*4)

{
    "require": {
        "xxtime/omnipay-mycard": "~1.1"
    }
}

And run composer to update your dependencies:, (*5)

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

Support Gateways

The following gateways are provided by this package:, (*6)

  • MyCard (MyCard Web Checkout)

For general usage instructions, please see the main Omnipay repository., (*7)

Usage For Purchase

// Initialize
$config = [
    'appId'  => 'MyCard_ServiceId',
    'appKey' => 'MyCard_Key'
];
$gateway = Omnipay::create('MyCard');
$gateway->initialize($config);

// Send purchase request
$response = $gateway->purchase(
    [
        'amount'        => '1.00',
        'currency'      => 'TWD',
        'description'   => 'product description',
        'transactionId' => mt_rand(100000, 999999),
    ]
)->send();

// Process response
if ($response->isRedirect()) {
    // doing something here
    // $token = $response->getToken();
    // $data = $response->getData();
    // $transactionReference = $response->getTransactionReference();
    $response->redirect();
}
elseif ($response->isSuccessful()) {
    // doing something here
    print_r($response);
}
else {
    echo $response->getMessage();
}

Usage For Notify Or Return

// Notify
$config = [
    'appId'  => 'MyCard_ServiceId',
    'appKey' => 'MyCard_Key'
];
$gateway = Omnipay::create('MyCard');
$gateway->initialize($config);
try {
    $response = $gateway->acceptNotification()->send();

    // set token (which saved when send a purchase @see Usage For Purchase)
    // $transactionId = $response->getTransactionId();
    $response->setToken('MyCard_AuthCode');
    // confirm
    $response->confirm();
    if ($response->isSuccessful()) {
        // doing something here
        // save $response->getData()['confirmData'] for further compare
        // $data = $response->getData();
    }
} catch (\Exception $e) {
    // failed logs
}

Usage For Query

$gateway = Omnipay::create('MyCard');
$gateway->initialize($config);
$response = $gateway->fetchTransaction(['token' => 'MyCard_AuthCode'])->send();
// further functions below
$response->isSuccessful();
$response->getTransactionId();
$response->getAmount();
$response->getCurrency();
$response->getCardNumber();     // card number
$response->getMessage();        // message response from MyCard query api
$response->getData();           // output RAW data

Usage For Compare

$compare = $gateway->compareTransaction();

// Get Params, Exp: ["card"=>"MC123456"] or ["startTime"=>1500000000,"endTime"=>1560000000];
$params = $compare->getParams();

// Get data from database with the $params above
$data = [
    [
        'type'                 => 'INGAME',         // INGAME, COSTPOINT Or Something Else
        'transactionId'        => '12345678',       // My Transaction Id
        'transactionReference' => 'MC973924',       // MyCard Transaction Id
        'card'                 => 'card number',    // Card Number Or Something Else
        'amount'               => '50.00',          // Amount
        'currency'             => 'TWD',            // Currency
        'account'              => 'user123',        // User Id
        'time'                 => 1500000000,       // Timestamp
    ],
    // ... more
];

// Output data
$compare->setData($data)->send();

Project Home Page
About Usage
MyCard Official Website, (*8)

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found., (*9)

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to., (*10)

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request., (*11)

The Versions

15/12 2017

dev-master

9999999-dev https://github.com/xxtime/omnipay-mycard

MyCard gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe

payment pay gateway merchant purchase omnipay mycard

15/12 2017

1.1.0

1.1.0.0 https://github.com/xxtime/omnipay-mycard

MyCard gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe

payment pay gateway merchant purchase omnipay mycard

11/12 2017

1.0.1

1.0.1.0 https://github.com/xxtime/omnipay-mycard

MyCard gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe

payment pay gateway merchant purchase omnipay mycard

04/12 2017

1.0

1.0.0.0 https://github.com/xxtime/omnipay-mycard

MyCard gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe

payment pay gateway merchant purchase omnipay mycard