2017 © Pedro Peláez
 

library payjp-php

Payjp PHP Library

image

payjp/payjp-php

Payjp PHP Library

  • Friday, June 22, 2018
  • by wozozo
  • Repository
  • 26 Watchers
  • 27 Stars
  • 51,952 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 13 Versions
  • 25 % Grown

The README.md

PAY.JP for PHP

Build Status, (*1)

Requirements

PHP 5.6 and later., (*2)

Even if it is not a corresponding version, it may work, but it does not support it. Due to the PHP END OF LIFE cycle., (*3)

Composer

You can install the bindings via Composer. Add this to your composer.json:, (*4)

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

Then install via:, (*5)

composer install

To use the bindings, use Composer's autoload:, (*6)

require_once 'vendor/autoload.php';

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file., (*7)

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

Getting Started

In advance, you need to get a token by Checkout or payjp.js., (*8)

\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

Retry on HTTP Status Code 429

  • See Rate Limit Guideline
  • 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 https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/

Logging

  • This library provides simple log output using error_log . You can set any logger that is compatible 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

info

  • Every retry on HTTP Status Code 429

error

  • When you access inaccessible or non-existing property

Development

Running Tests

In order to run tests first install PHPUnit via Composer:, (*9)

composer update --dev

To run the test suite:, (*10)

./vendor/bin/phpunit

You can also use Composer to run the tests:, (*11)

composer test

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

Code Formatting

To format the code according to our standards:, (*13)

composer fix

This command requires PHP 7.4 or higher and will automatically fix coding style issues using PHP-CS-Fixer., (*14)

The Versions

22/06 2018

dev-direct-token-generate

dev-direct-token-generate https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

06/06 2018

v2.x-dev

2.9999999.9999999.9999999-dev https://github.com/payjp/payjp-php

PAY.JP PHP binding

  Sources   Download

MIT

The Requires

 

The Development Requires

06/03 2018

dev-master

9999999-dev https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

26/01 2018

1.0.0

1.0.0.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

29/03 2017

0.0.8

0.0.8.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

13/03 2017

0.0.7

0.0.7.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

01/11 2016

0.0.6

0.0.6.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

03/10 2016

dev-fix-subscription-test

dev-fix-subscription-test https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

03/06 2016

0.0.5

0.0.5.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

18/01 2016

0.0.4

0.0.4.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

23/11 2015

0.0.3

0.0.3.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

10/09 2015

0.0.2

0.0.2.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp

06/09 2015

0.0.1

0.0.1.0 https://pay.jp/

Payjp PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api payment processing payjp