PHPackages                             asaokamei/payjp - 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. asaokamei/payjp

ActiveLibrary[Payment Processing](/categories/payments)

asaokamei/payjp
===============

a simple wrapper for Pay.JP payments

0.0.2(10y ago)024MITPHP

Since May 8Pushed 10y ago1 watchersCompare

[ Source](https://github.com/asaokamei/PayJp)[ Packagist](https://packagist.org/packages/asaokamei/payjp)[ RSS](/packages/asaokamei-payjp/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

PayJp
=====

[](#payjp)

a simple wrapper classes for [Pay.JP](https://pay.jp/) and [WebPay](https://webpay.jp) payment services.

!!!NOT FULLY TESTED nor USED!!!

### License

[](#license)

MIT License

### PSR

[](#psr)

PSR-1, PSR-2, and PSR-4.

### install

[](#install)

```
composer require "asaokamei/payjp"
```

to see a demo, try

```
cd payjp
composer install
cd demo
php -S localhost:8888
```

and browse `http://localhost:8888/`.

Getting Started
---------------

[](#getting-started)

Get public and secret api keys from Pay.jp or WebPay.jp.

```
define('PAY_JP_SECRET_KEY', 'sk_test_*****'); // your secret key.
```

Then, create a factory for charges, as

```
// for Pay.jp
$factory = AsaoKamei\PayJp\PayJp\ChargeFactory::forge(PAY_JP_SECRET_KEY);

// for WebPay.jp
$factory = AsaoKamei\PayJp\WebPay\ChargeFactory::forge(PAY_JP_SECRET_KEY);
```

### charge to a credit card

[](#charge-to-a-credit-card)

get a credit token ([`$_POST['payjp-token']` for pay.jp](https://pay.jp/docs/cardtoken) or [`$_POST['webpay-token']` for WebPay.jp](https://webpay.jp/docs/payments_with_token)).

```
$charge  = $factory->create($_POST['service-token']);

if (!$charge_id = $charge->charge(1000)) {
    var_dump($charge->getError());
}
```

You can authorize the credit, by,

```
$charge_id = $charge->authorize(1000);
```

and save the `$charge_id` for later use.

### capture, cancel, or refund

[](#capture-cancel-or-refund)

```
$charge = $factory->retrieve($charge_id);
```

then, do one of the following.

```
$charge->capture();
$charge->cancel();
$charge->refund(500);
```

You can only refund once for `pay.jp`.

Testing
-------

[](#testing)

To run the test, please obtain api keys for test from `Pay.jp` and `WebPay`.

Set the secret and public api keys to `tests/services.ini` accordingly.

Then, run phpunit using `tests/phpunit.xml` configuration.

Notice
------

[](#notice)

- `refund` is not working for pay.jp.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

3703d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ed783829e6fa0bd4b0def8c04ccfdfb2fc99f9e61e4a9470acad9e5abc5fcac?d=identicon)[asaokamei](/maintainers/asaokamei)

---

Top Contributors

[![asaokamei](https://avatars.githubusercontent.com/u/747030?v=4)](https://github.com/asaokamei "asaokamei (32 commits)")

### Embed Badge

![Health badge](/badges/asaokamei-payjp/health.svg)

```
[![Health](https://phpackages.com/badges/asaokamei-payjp/health.svg)](https://phpackages.com/packages/asaokamei-payjp)
```

###  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)
