1. Go to this page and download the library: Download paypayue/paypay-soap-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
paypayue / paypay-soap-php example snippets
$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;
}
$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);
$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);
$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);