collizo4sky / omnipay-wepay
WePay driver for the Omnipay payment processing library
Requires
- omnipay/common: ~2.3
Requires (Dev)
- omnipay/tests: ~2.0
- satooshi/php-coveralls: 1.*
README
WePay driver for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements WePay support for Omnipay.
Installation
Omnipay is installed via Composer. To install, simply add it
to your composer.json
file:
{ "require": { "collizo4sky/omnipay-wepay": "~1.0" } }
And run composer to update your dependencies:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
Basic Usage
The following gateways are provided by this package:
- WePay
You need to set your accountId and accessToken. Setting testMode to true will use the sandbox environment.
This gateway supports WePay off-site and on-site purchase. The on-site purchase is possible through a credit card ID. You can generate the ID through the JavaScript SDK:
For general usage instructions, please see the main Omnipay repository.
On-site Payment Setup with Credit Card ID
$gateway = Omnipay::create('WePay');
$gateway->setAccountId('583276666');
$gateway->setAccessToken('STAGE_ca4cf9c5d209343d18dae0fc47b908f2d17b47654eecb1fc55bc8652946kdirl');
$gateway->setTestMode(true);
$formData = array('firstName' => 'Foo', 'lastName' => 'Baz', 'email' => 'hello@mailinator.com');
$response = $gateway->purchase(
array(
'token' => '3843295557',
'transactionId' => '12345678',
'amount' => '25.50',
'currency' => 'USD',
'description' => 'A vacation home rental',
'returnUrl' => 'http://localhost.dev/wepay/complete.php',
'card' => $formData
)
)->send();
Off-site Payment Setup without Credit Card ID
$gateway = Omnipay::create('WePay');
$gateway->setAccountId('583276666');
$gateway->setAccessToken('STAGE_ca4cf9c5d209343d18dae0fc47b908f2d17b47654eecb1fc55bc8652946kdirl');
$gateway->setTestMode(true);
$formData = array('firstName' => 'Foo', 'lastName' => 'Baz', 'email' => 'hello@mailinator.com');
$response = $gateway->purchase(
array(
'transactionId' => '12345678',
'amount' => '25.50',
'currency' => 'USD',
'description' => 'A vacation home rental',
'returnUrl' => 'http://localhost.dev/wepay/complete.php',
'card' => $formData
)
)->send();
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.
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.
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.