1. Go to this page and download the library: Download santanamic/php-picpay-sdk 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/ */
santanamic / php-picpay-sdk example snippets
onfigure API key authorization: E-commerce Token
$config = PicPay\Configuration::getDefaultConfiguration()->setApiKey('x-picpay-token', 'YOUR_API_KEY');
$apiInstance = new PicPay\SDK\RequisioDePagamentoApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client([
'verify' => false,
'headers' => [
'Content-Type' => 'text/html; charset=UTF-8',
'Cache-Control' => 'no-cache',
'Accept-Encoding' => 'none'
]
]),
$config
);
//Pass the parameters and make the magic happen.
//Law the official documentation to know more details about the parameters
$body = new \PicPay\modelPackage\PaymentRequest([
'reference_id' => '123456',
'callback_url' => 'https://example.com/',
'return_url' => 'https://example.com/return',
'value' => '230.22',
'buyer' => [
'firstName' => 'João',
'lastName' => 'Da Silva',
'document' => '123.456.789-10',
'email' => '[email protected]',
'phone' => '+55 27 12345-6789'
]
]);
try {
$result = $apiInstance->postPayments($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling RequisioDePagamentoApi->postPayments: ', $e->getMessage(), PHP_EOL;
}
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.