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.
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
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.
$gateway = Omnipay::create('WePay');
$gateway->setAccountId('583276666');
$gateway->setAccessToken('STAGE_ca4cf9c5d209343d18dae0fc47b908f2d17b47654eecb1fc55bc8652946kdirl');
$gateway->setTestMode(true);
$formData = array('firstName' => 'Foo', 'lastName' => 'Baz', 'email' => '[email protected]');
$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();
$gateway = Omnipay::create('WePay');
$gateway->setAccountId('583276666');
$gateway->setAccessToken('STAGE_ca4cf9c5d209343d18dae0fc47b908f2d17b47654eecb1fc55bc8652946kdirl');
$gateway->setTestMode(true);
$formData = array('firstName' => 'Foo', 'lastName' => 'Baz', 'email' => '[email protected]');
$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();
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.