PHPackages                             perfectpanel/paypayopa-sdk - 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. perfectpanel/paypayopa-sdk

ActiveLibrary[API Development](/categories/api)

perfectpanel/paypayopa-sdk
==========================

PHP SDK for PayPay Open Payment API

0594PHP

Since Apr 14Pushed 1y agoCompare

[ Source](https://github.com/perfectpanel/paypayopa-sdk)[ Packagist](https://packagist.org/packages/perfectpanel/paypayopa-sdk)[ RSS](/packages/perfectpanel-paypayopa-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Paypay SDK - PHP
================

[](#paypay-sdk---php)

[![License](https://camo.githubusercontent.com/5bb925a9c188422988450e4616881174b4622e187a79f3a40f2ad42b32b334ef/68747470733a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6170616368652d6f72616e67652e737667)](https://opensource.org/licenses/Apache-2.0)[![Packagist Version](https://camo.githubusercontent.com/d1b137ac1f7c66fea84016f9ca51fa206bd24f95c7bd6f1ffc8f32dfed42e623/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061797061796f70612f7068702d73646b)](https://packagist.org/packages/paypayopa/php-sdk)[![Build Status](https://camo.githubusercontent.com/2fe6a1015a9cc2ff8bf1dcfcbba1f1d0b6c0f62b4ce32d2969bbf4260dba4de1/68747470733a2f2f7472617669732d63692e6f72672f7061797061792f7061797061796f70612d73646b2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/paypay/paypayopa-sdk-php)[![Coverage Status](https://camo.githubusercontent.com/8991ba8e77e6841275a5b260d9a6cadd51bb0f18cbc6a42995931c4b34b248df/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7061797061792f7061797061796f70612d73646b2d7068702f62616467652e737667)](https://coveralls.io/github/paypay/paypayopa-sdk-php)[![Maintainability](https://camo.githubusercontent.com/f8c1a8a6cf3b9372ba901fa7996c9e10cb3ba6f66e54b59ec33d3cafc2cb06d3/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f37663032306164383831366463396636346636662f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/paypay/paypayopa-sdk-php/maintainability)[![Black Duck Security Risk](https://camo.githubusercontent.com/d08871cc498a54098decba80524350b6eb64427130e3ca7f4774f8bd3d18d719/68747470733a2f2f636f70696c6f742e626c61636b6475636b736f6674776172652e636f6d2f6769746875622f7265706f732f7061797061792f7061797061796f70612d73646b2d7068702f6272616e636865732f6d61737465722f62616467652d7269736b2e737667)](https://copilot.blackducksoftware.com/github/repos/paypay/paypayopa-sdk-php/branches/master)[![FOSSA Status](https://camo.githubusercontent.com/89bd3eac57b4b00a7fb97a8caa12a0a73bfb68b873d5d1041857a862d3caf202/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532467061797061792532467061797061796f70612d73646b2d7068702e7376673f747970653d736869656c64)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpaypay%2Fpaypayopa-sdk-php?ref=badge_shield)[![Quality Gate Status](https://camo.githubusercontent.com/6c11c32779566ad11b6d719f687a9129dcc1954021f4765059571aa6a104c834/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d7061797061795f7061797061796f70612d73646b2d706870266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=paypay_paypayopa-sdk-php)[![Packagist Downloads](https://camo.githubusercontent.com/53b11c76e1236bb6d3415e737b2d44f7bb616c262a443ba8590184cbe3a81146/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f7061797061796f70612f7068702d73646b)](https://packagist.org/packages/paypayopa/php-sdk)[![Codacy Badge](https://camo.githubusercontent.com/6758d7bb2841a878bc945303c96aaa6fb674b3d39ae33691453fcf89b0dde45b/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3464393831633533346261623466383339623534393239363266376630613538)](https://app.codacy.com/gh/paypay/paypayopa-sdk-php?utm_source=github.com&utm_medium=referral&utm_content=paypay/paypayopa-sdk-php&utm_campaign=Badge_Grade_Dashboard)[![BCH compliance](https://camo.githubusercontent.com/1a8e6c83eb18eadcd218414df05f383c1c812461dfcbf44ac23a4fbc59bf7904/68747470733a2f2f626574746572636f64656875622e636f6d2f656467652f62616467652f7061797061792f7061797061796f70612d73646b2d7068703f6272616e63683d6d6173746572)](https://bettercodehub.com/)

PHP Class for interacting with the Paypay API This is the quickest way to integrate PayPay payment services, primarily meant for merchants who wish to perform interactions with the Paypay API programatically. With PayPay's OPA SDK, you can build a custom payment checkout process to suit your unique business needs and branding guidelines.

Integrating with PayPay's Open Payment API (OPA)
------------------------------------------------

[](#integrating-with-paypays-open-payment-api-opa)

Prerequisites
-------------

[](#prerequisites)

Before integrating with the SDK, run through this checklist:

- Understand the payment flow
- Sign up for a PayPay developer/merchant account
- Generate the API keys from the Developer Panel. Use the sandbox API keys to test out the integration

Minimum required software requirements
--------------------------------------

[](#minimum-required-software-requirements)

To use the Paypay OPA PHP SDK you need:

- A server compute environment (local machines, docker containers, VPS or dedicated servers, cloud infrastructure etc. )
- A web server to serve your API responses and html documents.
- PHP version 7.x interpreter to execute your backend code.
- Composer to manage your dependencies(recommended) or a release version from this repo to manually maintain your dependencies.

HMAC Signature Verification
---------------------------

[](#hmac-signature-verification)

Signature verification is a mandatory step to ensure that the callback is sent by PayPay and the payment is received from an authentic source.

### Generate a Signature

[](#generate-a-signature)

The PayPay signature, returned to you on successful payment, can be generated by your system and verified as follows:

- Start by hashing the body and content-type with MD5 algorithm
- - Note : If there is no request body, for instance, the HTTP GET method case, no need of generating MD5. Instead hash value is set as "empty".
- The value of authHeader is passed in HttpHeader. AUTHORIZATION. The authHeader will decode back to the data added and with the HTTP request object and based on data available for api-key in the system, we will recreate the SHA256("key", requestParams) which gives macData. This macData is verified against the value passed in the header.

For the complete step-by-step explanation refer the link [here](https://www.paypay.ne.jp/opa/doc/v1.0/webcashier#tag/Api-Authentication)

### Composer

[](#composer)

To install the bindings via [Composer](http://getcomposer.org/), run the following command in your shell :

```
composer require paypayopa/php-sdk
```

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

[](#getting-started)

You need to setup your key and secret using the following:

```
include('PATH_TO_SDK_FOLDER/Client.php');

$client = new Client([
    'API_KEY' => 'YOUR_API_KEY',
    'API_SECRET'=>'YOUR_API_SECRET',
	'MERCHANT_ID'=>'YOUR_MERCHANT_ID'
]);
```

### \[Note:\] Setter chaining in request payload classes

[](#note-setter-chaining-in-request-payload-classes)

In the examples below methods are written one after the other for the sake of your understanding. However you can save a few keystrokes by chaining multiple setter functions like so:

```
use PayPay\OpenPaymentAPI\Models\CreateQrCodePayload;
$cqcp = new CreateQrCodePayload();
$cqcp->setMerchantPaymentId('Test123')->setRequestedAt()->setCodeType();
```

Dynamic QR Code
---------------

[](#dynamic-qr-code)

### Create a dynamic QR Code to receive payments.

[](#create-a-dynamic-qr-code-to-receive-payments)

```
use PayPay\OpenPaymentAPI\Models\CreateQrCodePayload;
use PayPay\OpenPaymentAPI\Models\OrderItem;
/*
.....initialize SDK
*/
// setup payment object
$CQCPayload = new CreateQrCodePayload();

// Set merchant pay identifier
$CQCPayload->setMerchantPaymentId("YOUR_TRANSACTION_ID");

// Log time of request
$CQCPayload->setRequestedAt();
// Indicate you want QR Code
$CQCPayload->setCodeType("ORDER_QR");

// Provide order details for invoicing
$OrderItems = [];
$OrderItems[] = (new OrderItem())
    ->setName('Cake')
    ->setQuantity(1)
    ->setUnitPrice('amount' => 20, 'currency' => 'JPY']);
$CQCPayload->setOrderItems($OrderItems);

// Save Cart totals
$amount = [
    "amount" => 1,
    "currency" => "JPY"
];
$CQCPayload->setAmount($amount);
// Configure redirects
$CQCPayload->setRedirectType('WEB_LINK');
$CQCPayload->setRedirectUrl($_SERVER['SERVER_NAME']);

// Get data for QR code
$response = $client->code->createQRCode($CQCPayload);

$data = $response['data'];
```

```
For a list of params refer to the API guide :
https://www.paypay.ne.jp/opa/doc/v1.0/dynamicqrcode#operation/createQRCode

```

### Delete a particular Dynamic QR Code

[](#delete-a-particular-dynamic-qr-code)

```
/*
....initialize SDK
*/

$response =  $client->code->deleteQRCode('ID_OF_CODE');
$data = $response['data'];
```

### Fetch a particular QR CODE payment detail

[](#fetch-a-particular-qr-code-payment-detail)

```
/*
.....initialize SDK
*/

$response =  $client->code->getPaymentDetails('MERCHANT_PAYMENT_ID');
$data = $response['data'];
```

### Cancel a payment

[](#cancel-a-payment)

```
/*
.....initialize SDK
*/

$response =  $client->code->cancelPayment('MERCHANT_PAYMENT_ID');
$data = $response['data'];
```

### Get User Authorization URL

[](#get-user-authorization-url)

```
/*
.....initialize SDK
*/

use PayPay\OpenPaymentAPI\Models\AccountLinkPayload;
$payload = new AccountLinkPayload();
$payload
    ->setScopes(["direct_debit"])
    ->setRedirectUrl("https://merchant.domain/test/callback")
    ->setReferenceId(uniqid("TEST123"));
$resp = $client->user->createAccountLinkQrCode($payload);
$url=$resp['data']['linkQRCodeURL'];
echo $url.'   ';
$nonce = $payload->getNonce();
/*
.... store nonce for later integrity checks in session or DB
*/
```

### Decode user authorization from token

[](#decode-user-authorization-from-token)

The PayPay authorization system will redirect user back to your site with a JWT token in the `responseToken` URL parameter.

```
/*
.....initialize SDK
*/
$token = $_GET['responseToken'];
$authorization = $client->user->decodeUserAuth($token);
/*
...fetch stored nonce for integrity check
*/
$userAuthorizationId = false;
if ($authorization['result']==='succeeded' && $authorization['nonce']===$fetchedNonce){
    $userAuthorizationId = $authoriresponseTokenzation['userAuthorizationId']
}
```

### Capture payment details

[](#capture-payment-details)

```
use PayPay\OpenPaymentAPI\Models\CapturePaymentAuthPayload;
/*
.....initialize SDK
*/
// setup payment object
$CAPayload = new CapturePaymentAuthPayload();

// Use the `merchantPaymentId` from a successful invocation of the create payment authorization API.
$CAPayload->setMerchantPaymentId("YOUR_TRANSACTION_ID");

$amount = [
    "amount" => 1,
    "currency" => "JPY"
];
$CAPayload->setAmount($amount);

// Set a unique value to identify this capture.
$CAPayload->setMerchantCaptureId("MERCHANT_CAPTURE_ID")

$CAPayload->setRequestedAt();
$CAPayload->setOrderDescription("ORDER_DESCRIPTION")
$response = $client->payment->capturePaymentAuth($CAPayload);

$data = $response['data'];
```

```
For a list of params refer to the API guide :
https://www.paypay.ne.jp/opa/doc/v1.0/dynamicqrcode#operation/capturePaymentAuth

```

### Fetch a particular Direct Debit payment detail

[](#fetch-a-particular-direct-debit-payment-detail)

```
/*
.....initialize SDK
*/

$response =  $client->payments->getPaymentDetails('MERCHANT_PAYMENT_ID');
$data = $response['data'];
```

### Revert payment

[](#revert-payment)

```
use PayPay\OpenPaymentAPI\Models\RevertAuthPayload;
/*
.....initialize SDK
*/
// setup payment object
$RAPayload = new RevertAuthPayload();
$RAPayload->setMerchantRevertId("UNIQUE_REVERT_ID");
$RAPayload->setPaymentId("MERCHANT_PAYMENT_ID");
$RAPayload->setRequestedAt();
$RAPayload->setReason("REASON_FOR_REFUND");

 $response = $client->payment->revertAuth($RAPayload)
```

```
For a list of params refer to the API guide :
https://www.paypay.ne.jp/opa/doc/v1.0/dynamicqrcode#operation/revertAuth

```

### Refund payment

[](#refund-payment)

```
use PayPay\OpenPaymentAPI\Models\RefundPaymentPayload;
/*
.....initialize SDK
*/

// setup payment object
$RPPayload = new RefundPaymentPayload();
$RPPayload->setMerchantRefundId('MERCHANT_REFUND_ID');
$RPPayload->setMerchantPaymentId('MERCHANT_PAYMENT_ID');
$amount = [
    "amount" => 1,
    "currency" => "JPY"
];
$RPPayload->setAmount($amount);
$RPPayload->setRequestedAt();
$RPPayload->setReason("Refunds test");
$response = $client->refund->refundPayment($RPPayload);
$data = $response['data'];
```

```
For a list of params refer to the API guide :
https://www.paypay.ne.jp/opa/doc/v1.0/dynamicqrcode#operation/refundPayment

```

### Fetch refund status and details

[](#fetch-refund-status-and-details)

```
/*
.....initialize SDK
*/
$response=$client->refund->getRefundDetails('UNIQUE_REFUND_ID');
$data = $response['data'];
```

```
For a list of params refer to the API guide :
https://www.paypay.ne.jp/opa/doc/v1.0/dynamicqrcode#operation/getRefundDetails

```

License
-------

[](#license)

[![FOSSA Status](https://camo.githubusercontent.com/1a9566eb40d1aa069592907f1c5a3b51ef96e33346907e2973ae1357e00e2017/68747470733a2f2f6170702e666f7373612e636f6d2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532467061797061792532467061797061796f70612d73646b2d7068702e7376673f747970653d6c61726765)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpaypay%2Fpaypayopa-sdk-php?ref=badge_large)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c70f1c5a9eadef73fdce57d8929188c6f0df681dcf4a73bd4af5a208d8be511c?d=identicon)[Gorchel567](/maintainers/Gorchel567)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (113 commits)")[![paypay-ayas](https://avatars.githubusercontent.com/u/63552995?v=4)](https://github.com/paypay-ayas "paypay-ayas (113 commits)")[![curtisfennerpaypay](https://avatars.githubusercontent.com/u/85128697?v=4)](https://github.com/curtisfennerpaypay "curtisfennerpaypay (57 commits)")[![ashraf-km](https://avatars.githubusercontent.com/u/73993781?v=4)](https://github.com/ashraf-km "ashraf-km (41 commits)")[![sunaoka](https://avatars.githubusercontent.com/u/105845?v=4)](https://github.com/sunaoka "sunaoka (19 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (18 commits)")[![javidlulu](https://avatars.githubusercontent.com/u/64267505?v=4)](https://github.com/javidlulu "javidlulu (14 commits)")[![chao-chang-paypay](https://avatars.githubusercontent.com/u/52404151?v=4)](https://github.com/chao-chang-paypay "chao-chang-paypay (5 commits)")[![navin-math](https://avatars.githubusercontent.com/u/47411102?v=4)](https://github.com/navin-math "navin-math (4 commits)")[![marchenko93](https://avatars.githubusercontent.com/u/161819605?v=4)](https://github.com/marchenko93 "marchenko93 (3 commits)")[![sanmai](https://avatars.githubusercontent.com/u/139488?v=4)](https://github.com/sanmai "sanmai (2 commits)")[![mike-traff-paypay](https://avatars.githubusercontent.com/u/52951742?v=4)](https://github.com/mike-traff-paypay "mike-traff-paypay (1 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")

### Embed Badge

![Health badge](/badges/perfectpanel-paypayopa-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/perfectpanel-paypayopa-sdk/health.svg)](https://phpackages.com/packages/perfectpanel-paypayopa-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

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