san tan ami c / php-picpay-sdk
v1
2019-04-04 05:39 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2024-09-16 08:57:28 UTC
README
PHP应用程序与PicPay API集成的SDK。这是一个非官方的开源项目。
要求
- PHP 5.5及以后版本
- 已安装Composer
- PicPay Token电子商务
结构
docs/
src/
example/
lib/
tests/
安装与使用
Composer
通过composer
安装绑定
$ composer require santanamic/php-picpay-sdk
测试
运行单元测试
composer test
入门
以下示例展示了如何获取支付URL。请按照安装过程进行,然后运行以下命令
<?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; } ?>
API端点文档
所有URI都是相对于https://appws.picpay.com/ecommerce/public/
官方文档
如何获取PicPay Token
- 要与API通信,您需要获取PicPay访问凭据
与作者联系
- 如果您需要任何帮助,请告知我。可以通过发送电子邮件给我。
许可证和关于项目
- MIT许可证(MIT)。有关更多信息,请参阅许可证文件。
- 该项目使用OpenAPI规范和Swagger CLI构建。