PHPackages                             paypayue/paypay-soap-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. paypayue/paypay-soap-php

AbandonedArchivedLibrary[API Development](/categories/api)

paypayue/paypay-soap-php
========================

PHP helper library for PayPay SOAP API integration.

1.12.3(5y ago)316.3k↓57.9%1MITPHPPHP &gt;=5.4.0

Since Aug 21Pushed 2y agoCompare

[ Source](https://github.com/paypayue/paypay-soap)[ Packagist](https://packagist.org/packages/paypayue/paypay-soap-php)[ Docs](https://github.com/paypayue/paypay-soap-php)[ RSS](/packages/paypayue-paypay-soap-php/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)DependenciesVersions (23)Used By (0)

Repo has been discontinued, please check out the [REST API documentation](https://paypay.pt/paypay/public/api/)
===============================================================================================================

[](#repo-has-been-discontinued-please-check-out-the-rest-api-documentation)

PayPay PHP SOAP Library
=======================

[](#paypay-php-soap-library)

Official library for PayPay SOAP API integrations written in PHP.

### Requirements

[](#requirements)

- The library requires PHP version 5.4.0 or higher and the [SOAP extension](http://php.net/manual/en/book.soap.php).

### Installation

[](#installation)

We recommend that you use [Composer](https://getcomposer.org/) a package manager for PHP. In the composer.json file in your project add:

```
"require" : {
    "paypayue/paypay-soap-php" : "^1.0"
}
```

In your project folder run the following command:

```
$ composer install
```

Then add the following line at the beginning of your code:

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

If you can't use Composer simply download our PHP library by hitting the link below then integrate it into your project.

- [Download PHP Library](https://github.com/paypayue/paypay-soap-php/archive/master.zip)

Getting started
---------------

[](#getting-started)

Configure the environment with your platform credentials, or use the following for testing:

```
$config = \PayPay\Configuration::setup(
    array(
        'environment'  => 'testing', // or production
        'platformCode' => '0004',
        'privateKey'   => 'Y1JgnTGN2lMOz8OXLs0s',
        'clientId'     => '503129445', // usually the client NIF
        'langCode'     => 'PT'
    )
);

$client = \PayPay\PayPayWebservice::init($config);
try {
    $response = $client->checkIntegrationState();
} catch (\Exception $e) {
    // if something is not right an exception will be thrown
    $response = $e;
}
```

Creating a payment reference
----------------------------

[](#creating-a-payment-reference)

Use this method to quickly obtain a payment reference that you can send to your customer.

```
$requestPayment = new \PayPay\Structure\RequestReferenceDetails(
    array(
        'amount'      => 1000,
        'productCode' => 'REF123', // Optional
        'productDesc' => 'Product description', // Optional
        'validStartDate' => '2049-06-27T00:00:00-03:00', // Optional
        'validEndDate' => '2050-06-27T23:59:59-03:00' // Optional
    )
);
```

(Optional) Specify the destination bank account for the payment

```
$requestPayment->withBankAccount('RDoHIUaw');
```

(Optional) Specify the payment options your customer may use to pay. Otherwise we will use the options configured on your PayPay account.

```
$requestPayment->withPaymentOptions(
    [
        \PayPay\Structure\RequestPaymentOption::MULTIBANCO(\PayPay\Structure\PaymentMethodType::NORMAL), // Check PaymentMethodType
        \PayPay\Structure\RequestPaymentOption::MBWAY(),
        \PayPay\Structure\RequestPaymentOption::CREDIT_CARD()
    ]
);

try {
    $response = $client->createPaymentReference($requestPayment);
} catch (\Exception $e) {
    $response = $e;
}
var_dump($response);
```

Refer to the following files for allowed parameters:

- [Codes](src/Structure/PaymentMethodCode.php)
- [Types](src/Structure/PaymentMethodType.php)

Payment with redirect
---------------------

[](#payment-with-redirect)

This method is recommended for instances where the payment is made straight away, such as during a checkout process.

```
try {
    $order = new \PayPay\Structure\RequestPaymentOrder(
        array(
            'amount'      => 1000,
            'productCode' => 'REF123', // Optional
            'productDesc' => 'Product description', // Optional
            'validStartDate' => '2049-06-27T00:00:00-03:00', // Optional
            'validEndDate' => '2050-06-27T23:59:59-03:00' // Optional
        )
    );
    $requestPayment = new \PayPay\Structure\RequestCreditCardPayment(
        $order,
        'http://www.your_store_url.com/return', // Optional
        'http://www.your_store_url.com/cancel' // Optional
    );
```

(Optional) Specify the destination bank account for the payment

```
    $requestPayment->withBankAccount('RDoHIUaw');
```

(Optional) Specify the payment options, default is credit card.

```
    $requestPayment->withMethods(
        array(
            \PayPay\Structure\PaymentMethodCode::CREDIT_CARD,
            \PayPay\Structure\PaymentMethodCode::MULTIBANCO,
            \PayPay\Structure\PaymentMethodCode::MBWAY
        )
    );

    $response = $client->doWebPayment($requestPayment);
    // save $response->token and $response->idTransaction
    // redirect to $response->url
} catch (\Exception $e) {
    $response = $e;
}

var_dump($response);
```

Additional payment information
------------------------------

[](#additional-payment-information)

(Optional) If you choose to send the customer info we can email them the payment receipt

```
$buyer = new \PayPay\Structure\RequestBuyerInfo(
    array(
        'firstName' => 'Manuel',
        'lastName' => 'Abreu',
        'email' => 'teste@teste.pt',
        'customerId' => '123'
    )
);

$requestPayment->withBuyer($buyer);
```

(Optional) If you choose to send the billing address add them the payment receipt

```
$billingAddress = new \PayPay\Structure\RequestBillingAddress(
    array(
        'country' => 'PT', // Country code according ISO 3166-1
        'state' => '30', // State/District code according ISO 3166 Alpha-2 Code
        'stateName' => 'Região Autónoma da Madeira',
        'city' => 'Ribeira Brava',
        'street1' => 'ACIN iCloud Solutions',
        'street2' => 'Estrada Regional, 104 Nº 42-A'
        'postCode' => '9350-203'
    )
);

$requestPayment->withBillingAddress($billingAddress);
```

(Optional) If you choose to send the shipping address add them the payment receipt

```
$shippingAddress = new \PayPay\Structure\RequestShippingAddress(
    array(
        'country' => 'PT', // Country code according ISO 3166-1
        'state' => '30', // State/District code according ISO 3166 Alpha-2 Code
        'stateName' => 'Região Autónoma da Madeira',
        'city' => 'Ribeira Brava',
        'street1' => 'ACIN iCloud Solutions',
        'street2' => 'Estrada Regional, 104 Nº 42-A'
        'postCode' => '9350-203'
    )
);

$requestPayment->withShippingAddress($shippingAddress);
```

Send references generated locally
---------------------------------

[](#send-references-generated-locally)

Use the following method to send references generated locally with a configured reference range. The reference range must be previously configured in PayPay only references that are within the configured range will be accepted.

```
$payments = array();

$payments[] = new \PayPay\Structure\RequestPaymentReference(
    '12797',
    '812331888',
    1000,
    "2020-06-22T08:30:49-03:00", //Optinal you can use in this format "d-m-Y H:i:s"
    "2020-06-22T08:30:49-03:00",
    "2020-07-22T08:30:49-03:00"
);

try {
    $response = $client->saveEntityPayments($payments);
} catch (\PayPay\Exception\IntegrationMultiResponseError $e) {
    // if something is not right an exception will be thrown
    $response = $e->getMultiResponseError(); //Optional you can use getIntegrationState() or getResponseErrors() to get individual response
} catch (\Exception $e) {
    // if something is not right an exception will be thrown
    $response = $e;
}

var_dump($response);
```

schedule for retry and/or discard submitted references

```
if (isset($response['responseErrors'])) {
    foreach ($response['responseErrors'] as $responseErrors) {
        echo 'Reference ->' . $responseErrors->reference . '';
        echo 'errorCode ->' . $responseErrors->errorCode . '';
        echo 'errorMessage ->' . $responseErrors->errorMessage . '';
        echo '========== ';
    }
}
```

Cancel payment
--------------

[](#cancel-payment)

Use this method to quickly cancel a payment that is no longer valid according to your business context. All payment methods will be cancelled currently only the following methods support cancellation:

- Multibanco Real-time;
- Credit/debit card;
- MB WAY.

```
try {
    $requestPayment = new \PayPay\Structure\RequestCancelPayment(
        123456, // Payment or transaction id
        'b180712cf8f6131b0d2950a83912ef7610ce0cde', // OR the payment hash
        'remarks' // some remarks or comments
    );
    $response = $client->cancelPayment($requestPayment);
} catch (\Exception $e) {
    $response = $e;
}
var_dump($response);
```

(Optional) Some methods cannot be cancelled (Eg.: Multibanco Normal) but you may bypass this and still mark the payment as cancelled.

```
$requestPayment->ignoreUnsupported();
```

Process incoming payments by Webhook
------------------------------------

[](#process-incoming-payments-by-webhook)

Use the following method to supply a url that will process all successful payments.

```
$webhook = new \PayPay\Structure\RequestWebhook(
    array(
        'action' => \PayPay\Structure\RequestWebhook::PAYMENT_CONFIRMED,
        'url' => 'htt://www.your_process_url.com'
    )
);
try {
    $response = $client->subscribeToWebhook($webhook);
} catch (\Exception $e) {
    $response = $e;
}

var_dump($response);
```

PayPay will make an HTTP request to your url with POST data of the payments that were confirmed. You can use the following code to jump start your payment processing.

```
try {
    $webhook = \PayPay\WebhookHandler::fromPost($config);
    $webhook->eachPayment(function($payment) {
        var_dump($payment); // loop the payments
    });
    http_response_code(200); // always return an HTTP status code.
} catch (\PayPay\Exception\Webhook $e) {
    http_response_code($e->getCode());
    echo $e->getMessage();
}
```

### Additional Notes

[](#additional-notes)

- PayPay expects a `HTTP 200 OK` header in response to the webhook request. This signals that the payments we're received successfully. Otherwise, we will retry calling your url 3 times within 30 minute intervals.
- Since PayPay may have to do repeat requests, as a failsafe you should check that each payment is not already processed on your side.
- The request has a 30s timeout so it's not recommended that you do any "heavy lifting" (eg. sending emails, slow queries, etc.) during this process.

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

[](#documentation)

- [Official Documentation](https://paypay.pt/paypay/public/api/) (portuguese)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 98.5% 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 ~64 days

Recently: every ~53 days

Total

21

Last Release

1994d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fae8ed762cda4dffea3442ecaf57ad3b9d78e29971460b5df116928f6f22e05?d=identicon)[paypayue](/maintainers/paypayue)

---

Top Contributors

[![apoiopaypay](https://avatars.githubusercontent.com/u/30622102?v=4)](https://github.com/apoiopaypay "apoiopaypay (134 commits)")[![fabio-abreu-acin](https://avatars.githubusercontent.com/u/40239123?v=4)](https://github.com/fabio-abreu-acin "fabio-abreu-acin (1 commits)")[![wilmergoncalvesacin](https://avatars.githubusercontent.com/u/30528307?v=4)](https://github.com/wilmergoncalvesacin "wilmergoncalvesacin (1 commits)")

---

Tags

apisoappaymentsmultibancopaypay

### Embed Badge

![Health badge](/badges/paypayue-paypay-soap-php/health.svg)

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

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1142.0M17](/packages/mollie-magento2)[transbank/transbank-sdk

Transbank SDK

62698.1k15](/packages/transbank-transbank-sdk)[openbuildings/paypal

PayPal SDK for ExpressCheckout and AdaptivePayments. Supports recurring payments, simple payments, parallel payments and chained payments.

31176.5k](/packages/openbuildings-paypal)[maksekeskus/maksekeskus-php

Maksekeskus PHP SDK

13208.2k](/packages/maksekeskus-maksekeskus-php)

PHPackages © 2026

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