PHPackages                             devture/omnipay-econtext - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. devture/omnipay-econtext

ActiveLibrary[Payment Processing](/categories/payments)

devture/omnipay-econtext
========================

Econtext (http://www.econtext.jp/) driver for the Omnipay PHP payment processing library

091PHP

Since Sep 26Pushed 9y ago1 watchersCompare

[ Source](https://github.com/devture/omnipay-econtext)[ Packagist](https://packagist.org/packages/devture/omnipay-econtext)[ RSS](/packages/devture-omnipay-econtext/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Omnipay: Econtext
=================

[](#omnipay-econtext)

**Econtext driver for the Omnipay PHP payment processing library**

[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements [Econtext](http://www.econtext.jp) support for Omnipay.

Preface
-------

[](#preface)

This driver is still in early development. **Do not use in production (yet).**

Installation
------------

[](#installation)

Omnipay is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file:

```
{
    "require": {
        "devture/omnipay-econtext": "@dev"
    }
}
```

And run composer to update your dependencies:

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

```

Basic Usage
-----------

[](#basic-usage)

The following gateways are provided by this package:

- Econtext\_Merchant (Econtext Merchant API)

For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay) repository.

### Initializing the gateway

[](#initializing-the-gateway)

```
$gateway = \Omnipay\Omnipay::create('Econtext_Merchant');
$gateway->initialize(array(
	'siteId' => 'Econtext-provided shopId',
	'siteCheckCode' => 'Econtext-provided chkCode',
	'testMode' => true, //or set to true for production
));
```

### Create a Card (stores it on the Econtext server)

[](#create-a-card-stores-it-on-the-econtext-server)

```
$creditCard = new \Omnipay\Common\CreditCard(array(
	'firstName' => '寛',
	'lastName' => '山田',
	'number' => '4980111111111111',
	'cvv' => '123',
	'expiryMonth' => '1',
	'expiryYear' => '2017',
	'email' => 'testcard@example.com',
));

$transaction = $gateway->createCard(array('card' => $creditCard));

//Don't forget to catch some exceptions here
$transactionResponse = $transaction->send();

var_dump($transactionResponse->isSuccessful());
var_dump($transactionResponse->getCardReference());
```

### Retrieve a stored (partial) Card from the Econtext server

[](#retrieve-a-stored-partial-card-from-the-econtext-server)

```
$cardReference = 'from createCard / $transactionResponse->getCardReference()';
$transaction = $gateway->retrieveCard(array('cardReference' => $cardReference));

//Don't forget to catch some exceptions here
$transactionResponse = $transaction->send();

var_dump($transactionResponse->isSuccessful());

//You don't really have the full credit card information.
//Pretty much just the last 4 digits of the number are exposed to you.
var_dump($transactionResponse->getCard()->getNumberLast4());
```

### Delete a Card stored on the Econtext server

[](#delete-a-card-stored-on-the-econtext-server)

```
$cardReference = 'from createCard / $transactionResponse->getCardReference()';
$transaction = $gateway->deleteCard(array('cardReference' => $cardReference));

//Don't forget to catch some exceptions here
//Idempotent - feel free to delete as many times as you wish!
$transactionResponse = $transaction->send();

var_dump($transactionResponse->isSuccessful());
```

### Purchase using an inline-provided Card

[](#purchase-using-an-inline-provided-card)

```
$creditCard = new \Omnipay\Common\CreditCard(array(
	'firstName' => '寛',
	'lastName' => '山田',
	'number' => '4980111111111111',
	'cvv' => '123',
	'expiryMonth' => '1',
	'expiryYear' => '2017',
	'email' => 'testcard@example.com',
));

$transaction = $gateway->purchase(array(
	'card' => $creditCard,
	'amount' => 500,
	'description' => 'Noodles',
));

//Don't forget to catch some exceptions here
$transactionResponse = $transaction->send();

var_dump($transactionResponse->isSuccessful());

//Keep your transaction reference if you want to perform refunds later
var_dump($transactionResponse->getTransactionReference());

//As a side-effect, the card gets stored on the Econtext server for you.
var_dump($transactionResponse->getCardReference());
```

### Purchase using a previously stored Card

[](#purchase-using-a-previously-stored-card)

```
$cardReference = 'from createCard / $transactionResponse->getCardReference()';

$transaction = $gateway->purchase(array(
	'cardReference' => $cardReference,
	'amount' => 500,
	'description' => 'Noodles',
));

//Don't forget to catch some exceptions here
$transactionResponse = $transaction->send();

var_dump($transactionResponse->isSuccessful());

//Keep your transaction reference if you want to perform refunds later
var_dump($transactionResponse->getTransactionReference());
```

### Purchase in a safe/idempotent way

[](#purchase-in-a-safeidempotent-way)

```
$transactionReference = 'your-custom-transaction-reference';
//You can also easily generate safe/random ones like this:
//$transactionReference = $gateway->purchase()->getTransactionReference();

$transaction = $gateway->purchase(array(
	'transactionReference' => $transactionReference,
	'cardReference' => $cardReference,
	'amount' => 500,
	'description' => 'Noodles',
));

//Don't forget to catch other potential exceptions below
try {
	$transactionResponse = $transaction->send();
} catch (\Omnipay\Econtext\Exception\BadTransactionReferenceException $e) {
	//The transactionReference you've provided is either a bad one,
	//or this transaction had already been processed.
	//Unfortunately, we don't know which, but if you're using references
	//generated by this library, it's safe to say this is indeed a duplicate.
}

var_dump($transactionResponse->isSuccessful());
```

### Refund a purchase

[](#refund-a-purchase)

```
$transactionReference = 'from purchase / $transactionResponse->getTransactionReference()';

$transaction = $gateway->refund(array(
	'transactionReference' => $transactionReference,
));

//Don't forget to catch some exceptions here
//NOT idempotent - subsequent refund() calls will fail
$transactionResponse = $transaction->send();

var_dump($transactionResponse->isSuccessful());
```

Support
-------

[](#support)

If you are having general issues with Omnipay, we suggest posting on [Stack Overflow](http://stackoverflow.com/). Be sure to add the [omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) 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](https://groups.google.com/forum/#!forum/omnipay) which you can subscribe to.

If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/devture/omnipay-econtext/issues), or better yet, fork the library and submit a pull request.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9daf523f8e47ddeb8af23183c06721c4e89111eb4eb3f9ce264242b373e9dd80?d=identicon)[spantaleev](/maintainers/spantaleev)

---

Top Contributors

[![spantaleev](https://avatars.githubusercontent.com/u/388669?v=4)](https://github.com/spantaleev "spantaleev (8 commits)")

### Embed Badge

![Health badge](/badges/devture-omnipay-econtext/health.svg)

```
[![Health](https://phpackages.com/badges/devture-omnipay-econtext/health.svg)](https://phpackages.com/packages/devture-omnipay-econtext)
```

###  Alternatives

[omnipay/coinbase

Coinbase driver for the Omnipay payment processing library

18570.2k1](/packages/omnipay-coinbase)[oxid-esales/amazon-pay-module

AmazonPay module for OXID

1824.3k](/packages/oxid-esales-amazon-pay-module)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
