payrightmy / payment-php
Payright API Client for PHP
v1.0.0
2022-02-28 15:10 UTC
Requires
- php: ^7.2 || ^8.0
- guzzlehttp/guzzle: ^6.5|^7.0.1
- laravie/codex: ^5.1
- laravie/codex-common: ^1.5
- laravie/parser: ^2.0
- php-http/guzzle7-adapter: ^0.1.1
- php-http/multipart-stream-builder: ^1.0
Requires (Dev)
- codexpertmy/tests: ^1.0
- mockery/mockery: ^1.3
- phpstan/phpstan: ^1.3
- phpunit/phpunit: ^7.5 || ^8.4 || ^9.0
This package is auto-updated.
Last update: 2025-02-28 22:06:28 UTC
README
This package is used to interacting with Payright payment API using PHP.
Installation
You can install the package via composer:
composer require payrightmy/payment-php
Usage basic
<?php use Payright\Client; use GuzzleHttp\Client as HttpClient; $payright = Client::make(new HttpClient(),[ 'api_key' => 'secret', 'sandbox' => true ]); $response = $payright->collections('v1') ->create([ 'name' => 'Collection name', 'status' => 'active' ]); echo $response->getStatusCode(); echo $response->getBody();
1. Create Bill
<?php use Payright\Client; use GuzzleHttp\Client as HttpClient; $payright = Client::make(new HttpClient(),[ 'api_key' => 'secret', 'sandbox' => true ]); $response = $payright->bills('v1') ->create([ 'collection' => '2Rjzopem', 'biller_name' => 'Muhammad Imran', 'biller_email' => 'imran@example.com', 'biller_mobile' => '60121234567', 'description' => 'Example bill description', 'amount' => 100, 'callback_url' => 'https://webhook.site/4370e625-4197-4059-911c-f4e16d6489f6', 'redirect_url' => 'https://example.com/redirect/', 'due_at' => '2021-12-01' ]); echo $response->getStatusCode(); echo $response->getBody();
2. Get Bill
<?php use Payright\Client; use GuzzleHttp\Client as HttpClient; $payright = Client::make(new HttpClient(),[ 'api_key' => 'secret', 'sandbox' => true ]); $response = $payright->bills('v1') ->get('7BeQgzGP'); echo $response->getStatusCode(); echo $response->getBody();
Available methods
- collections
- bills
- paymentchannel
- transactions
For more information, refer our official API Reference:
https://payright.stoplight.io/docs/api-reference/
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email dev@payright.my instead of using the issue tracker.