PHPackages                             payjp/payjp-php - 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. [API Development](/categories/api)
4. /
5. payjp/payjp-php

ActiveLibrary[API Development](/categories/api)

payjp/payjp-php
===============

Payjp PHP Library

1.8.0(1y ago)542.8M↓16.2%15[1 issues](https://github.com/payjp/payjp-php/issues)4MITPHPPHP &gt;=5.6CI passing

Since Sep 6Pushed 1y ago31 watchersCompare

[ Source](https://github.com/payjp/payjp-php)[ Packagist](https://packagist.org/packages/payjp/payjp-php)[ Docs](https://pay.jp/)[ RSS](/packages/payjp-payjp-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (27)Used By (4)

PAY.JP for PHP
==============

[](#payjp-for-php)

[![Build Status](https://github.com/payjp/payjp-php/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/payjp/payjp-php/actions)

Requirements
------------

[](#requirements)

PHP 5.6 and later.

> Even if it is not a corresponding version, it may work, but it does not support it. Due to the PHP [END OF LIFE](http://php.net/supported-versions.php) cycle.

Composer
--------

[](#composer)

You can install the bindings via [Composer](http://getcomposer.org/). Add this to your `composer.json`:

```
{
  "require": {
    "payjp/payjp-php": "~1.0"
  }
}

```

Then install via:

```
composer install

```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading):

```
require_once 'vendor/autoload.php';

```

Manual Installation
-------------------

[](#manual-installation)

If you do not wish to use Composer, you can download the [latest release](https://github.com/payjp/payjp-php/releases). Then, to use the bindings, include the `init.php` file.

```
require_once '/path/to/payjp-php/init.php';

```

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

[](#getting-started)

In advance, you need to get a token by [Checkout](https://pay.jp/docs/checkout) or [payjp.js](https://pay.jp/docs/payjs).

```
\Payjp\Payjp::setApiKey('sk_test_c62fade9d045b54cd76d7036');
$charge = \Payjp\Charge::create(array(
  'card' => 'token_id_by_Checkout_or_payjp-js',
  'amount' => 2000,
  'currency' => 'jpy'
));
echo $charge->amount; // 2000
```

Documentation
-------------

[](#documentation)

- [Request Example](https://github.com/payjp/payjp-php/blob/master/RequestExample.md)
- Please see our official [documentation](https://pay.jp/docs/started).

Retry on HTTP Status Code 429
-----------------------------

[](#retry-on-http-status-code-429)

- See [Rate Limit Guideline](https://pay.jp/docs/guideline-rate-limit#2-%E3%83%AA%E3%83%88%E3%83%A9%E3%82%A4)
- When you exceeded rate-limit, you can retry request by setting `$maxRetry`like `\Payjp\Payjp::setMaxRetry(3);` .
- The retry interval base value is `$retryInitialDelay`Adjust the value like `\Payjp\Payjp::setRetryInitialDelay(4);`The smaller is shorter.
- The retry interval calcurating is based on "Exponential backoff with equal jitter" algorithm. See

Logging
-------

[](#logging)

- This library provides simple log output using `error_log` . You can set any logger that is compatible [PSR-3](https://www.php-fig.org/psr/psr-3/) logger interface. Like below
- `\Payjp\Payjp::setLogger($logger);`
- As the default behavior, this library output only error level information to stderr.

### Logging Case

[](#logging-case)

#### info

[](#info)

- Every retry on HTTP Status Code 429

#### error

[](#error)

- When you access inaccessible or non-existing property

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

In order to run tests first install [PHPUnit](http://packagist.org/packages/phpunit/phpunit) via [Composer](http://getcomposer.org/):

```
composer update --dev

```

To run the test suite:

```
./vendor/bin/phpunit

```

You can also use Composer to run the tests:

```
composer test

```

This will run both the code style checks (PSR2) and the PHPUnit tests.

### Code Formatting

[](#code-formatting)

To format the code according to our standards:

```
composer fix

```

This command requires PHP 7.4 or higher and will automatically fix coding style issues using PHP-CS-Fixer.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance48

Moderate activity, may be stable

Popularity55

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~146 days

Total

25

Last Release

384d ago

Major Versions

0.0.8 → 1.0.02018-01-26

PHP version history (2 changes)0.0.1PHP &gt;=5.3.3

1.0.2PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a7a543af35fb4b4fa0af1ddc63ce66439c83ca8b426c0bc5c3b77c6f935ce63?d=identicon)[payjp](/maintainers/payjp)

---

Top Contributors

[![nonz250](https://avatars.githubusercontent.com/u/28826001?v=4)](https://github.com/nonz250 "nonz250 (47 commits)")[![wozozo](https://avatars.githubusercontent.com/u/12327?v=4)](https://github.com/wozozo "wozozo (46 commits)")[![natsuki-yamanaka](https://avatars.githubusercontent.com/u/5186470?v=4)](https://github.com/natsuki-yamanaka "natsuki-yamanaka (40 commits)")[![tomonish555](https://avatars.githubusercontent.com/u/35124832?v=4)](https://github.com/tomonish555 "tomonish555 (19 commits)")[![darai0512](https://avatars.githubusercontent.com/u/11780786?v=4)](https://github.com/darai0512 "darai0512 (15 commits)")[![keketa](https://avatars.githubusercontent.com/u/728253?v=4)](https://github.com/keketa "keketa (4 commits)")[![feiz](https://avatars.githubusercontent.com/u/571818?v=4)](https://github.com/feiz "feiz (4 commits)")[![nazonohito51](https://avatars.githubusercontent.com/u/7877772?v=4)](https://github.com/nazonohito51 "nazonohito51 (3 commits)")[![tenkoma](https://avatars.githubusercontent.com/u/16202?v=4)](https://github.com/tenkoma "tenkoma (3 commits)")[![yatatsu](https://avatars.githubusercontent.com/u/949882?v=4)](https://github.com/yatatsu "yatatsu (2 commits)")[![m92o](https://avatars.githubusercontent.com/u/140899?v=4)](https://github.com/m92o "m92o (1 commits)")[![junichirojp](https://avatars.githubusercontent.com/u/1055221?v=4)](https://github.com/junichirojp "junichirojp (1 commits)")

---

Tags

apipayment processingpayjp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[ebanx/ebanx

EBANX PHP library

24648.5k](/packages/ebanx-ebanx)[pay-now/paynow-php-sdk

PHP client library for accessing Paynow API

18193.9k2](/packages/pay-now-paynow-php-sdk)[everypay/everypay-php

1742.0k](/packages/everypay-everypay-php)

PHPackages © 2026

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