SDK for integration of PHP applications with the PicPay API. This is an unofficial open source project.
- PHP 5.5 and later
- Composer installed
- PicPay Token E-commerce
docs/
src/
example/
lib/
tests/
To install the bindings via composer
:
$ composer require santanamic/php-picpay-sdk
To run the unit tests:
composer test
This example shows how to get payment URLs. Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure 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' => 'teste@picpay.com',
'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;
}
?>
All URIs are relative to https://appws.picpay.com/ecommerce/public/
Class | Method | HTTP request | Description |
---|---|---|---|
CancelamentoApi | postCancellations | POST /payments/{referenceId}/cancellations | Cancel Request |
RequisioDePagamentoApi | postPayments | POST /payments | Payment Request |
StatusApi | getStatus | GET /payments/{referenceId}/status | Status Request |
- To communicate with the API you need to obtain the PicPay access credentials
- Please let me know if you need anything. Send me an email.
- The MIT License (MIT). Please see License File for more information.
- This project was built with OpenAPI Specification and Swagger CLI