Git Product home page Git Product logo

omnipay-merchant-warrior's Introduction

Omnipay Merchant Warrior

Merchant Warrior API implemention

Omnipay is a framework agnostic, multi-gateway payment processing library. This package implements components of the Merchant Warrior Direct API.

Installation

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

{
    "require": {
        "composer require kimoslim/omnipay-merchant-warrior": "dev-master"
    }
}

Basic Usage

The following gateways are provided by this package:

  • Merchant warrior Direct API (Following methods are done, although currently untested)
    • processAuth
    • processCapture
    • processCard

Purchase Example

$gateway = Omnipay::create('MerchantWarrior');
$gateway->setMerchantUUID('merchant UUID');
$gateway->setApiKey('API KEY');
$gateway->setApiPassphrase('API PASS');

$card = new CreditCard(array(
    'firstName'          => 'Joe',
    'lastName'           => 'Bloggs',
    'number'             => '4444333322221111',
    'expiryMonth'        => '01',
    'expiryYear'         => '2019',
    'billingAddress1'    => 'street',
    'billingCountry'     => 'AU',
    'billingCity'        => 'SUBURB',
    'billingPostcode'    => 'POSTCODE',
    'billingState'       => 'STATE',
    'email'              => '[email protected]',
));
$purchase = [
    'amount'            => '1.00',
    'currency'          => 'AUD',
    'transactionType'   => 'Purchase',
    'transactionId'     => 'TRANSACTION ID',
    'transactionProduct'=> 'Test Transaction Description',
    'card'              => $card
];
$request = $gateway->purchase($purchase);
$response = $request->send();
if ($response->isSuccessful()) {
    // insert the transaction
    $txn_id = $response->getTransactionReference();
    $auth_code = $response->getAuthCode();
    $message = $response->getMessage();
    echo 'Payment successful: TXN ID - '.$txn_id.' auth code: '.$auth_code.' message:'.$message.PHP_EOL;
}
else
{
    echo 'Credit Card Failed: '.$response->getMessage().PHP_EOL;
}

Authorize Example

$authorize = [
    'amount'            => '1.00',
    'currency'          => 'AUD',
    'transactionType'   => 'Authorize',
    'transactionId'     => 'TRANSACTION ID',
    'transactionProduct'=> 'Test Authorisation Description',
    'card'              => $card
];
$request = $gateway->authorize($authorize);
$response = $request->send();
if ($response->isSuccessful()) {
    // insert the transaction
    $txn_id = $response->getTransactionReference();
    $auth_code = $response->getAuthCode();
    $message = $response->getMessage();
    echo 'Payment successful: TXN ID - '.$txn_id.' auth code: '.$auth_code.' message:'.$message.PHP_EOL;
}
else
{
    echo 'Credit Card Failed: '.$response->getMessage().PHP_EOL;
}

More details of Merchant Warrior's API can be found at Merchant Warrior

For general usage instructions, please see the main Omnipay repository.

omnipay-merchant-warrior's People

Contributors

kimosabi77 avatar

Watchers

 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.