Mojopay gateway for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment
processing library for PHP 5.3+. This package implements Mojopay support for Omnipay.
$ composer require knightar/omnipay-mojopay
The following gateways are provided by this package:
For general usage instructions, please see the main Omnipay repository.
This driver supports following transaction types:
- authorize($options) – authorize an amount on the customer’s card
- capture($options) – capture an amount you have previously authorized
- purchase($options) – authorize and immediately capture an amount on the customer’s card
- refund($options) – refund an already processed transaction
- void($options) – generally can only be called up to 24 hours after submitting a transaction
$gateway = Omnipay::create('Mojopay');
Driver also supports paying using store cards in the customer vault using
cardReference instead of
use the vault functions with the
This driver also supports storing customer data in Mojopay’s customer vault:
- createCard($options) – Create a entry in the customer vault
- updateCard($options) – Update an entry in the customer vault
- deleteCard($options) – Delete an entry in a customer vault
$formData = array('number' => '4242424242424242', 'expiryMonth' => '8', 'expiryYear' => '2017', 'cvv' => '123');
$response = $gateway->createCard([
'card' => $formData
$cardReference = $response->getCardReference();
- listCards – Listing customer vault records by criteria
# Each criteria are optional, no criteria will return no records
$response = $gateway->listCards([
'cardReference' => '', # The hash to identify the customer in the vault
'firstName' => '', # Portion of cardholder's first name.
'lastName' => '', # Portion of cardholder's last name.
'email' => '', # Portion of billing email address.
'last4cc' => '' # Last 4 digits of credit card number.
$response_rows = $response->getResponse();
cardReference can be used in the authorize, purchase, and refund requests:
'amount' => '10.00',
'cardReference' => '1234567890'
This driver also supports subscription management which can be accessed using:
- subscription_add($options) – Add a subscription
- subscription_delete($options) – Delete a subscription
# As an example we will add a subscription the starts on 01/04/2017
'cardReference' => '1234567890',
'planId' => '1234567890',
'subscriptionStartDay' => '01',
'subscriptionStartMonth' => '04',
'subscriptionStartYear' => '2017'
API Calls on the TODO list which will be implemented eventually:
- Adding, updating, removing, listing Recurring Plans
- Listing subscriptions by customer
- Add a Customer to the Vault while Initiating a Sale/Authorization/Credit/Validate Transaction
We currently have no plans to implement the following calls (Pull requests are accepted for those who wants to add them):
- Adding a custom subscription – Does not return necessary subscription ID to cancel
- Adding a customer and subscription – Does not return necessary subscription ID to cancel
Note: Credit API call is implemented but is not enabled by default on merchant accounts,
contact Mojopay if you need this functionality. Please note that this code is untested.
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.
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.