raphaeltrust/paytredphp
最新稳定版本:v1.0.0
Composer 安装命令:
composer require raphaeltrust/paytredphp
包简介
Official PHP library for Paytred API
README 文档
README
Requirements
Curl 7.34.0 or more recent (Unless using Guzzle)
PHP 5.4.0 or more recent
Installation
Via Composer
$ composer require raphaeltrust/paytredphp
Via download
Download a release version from the releases page. Extract, then:
require 'path/to/src/
To make a payment do a redirect to the authorization URL received from calling the /pay endpoint. This URL is valid for one time use, so ensure that you generate a new URL per transaction.
When the payment is successful, we will call your callback URL (as setup in your dashboard or while initializing the payment) and return the reference and transaction status as a query parameter.
Using the API
Check your Paytred wallet balance
The endpoint for checking wallet balance is [/balance]
<?php
$paytred = new \Raphaeltrust\Paytredphp\PaytredApi('https://api.paytred.com/v1/balance','YOUR_API_KEY');
try {
//get response
$response = $paytred();
//print response
echo $response;
} catch (\RuntimeException $ex) {
// catch errors
die(sprintf('Http error %s with code %d', $ex->getMessage(), $ex->getCode()));
}
A JSON response will be returned.
Create a new product token
The endpoint for creating a new product token is [/create-token] Required fields:
-
product_name: (string)/ Name of the product
-
product_amount: (float)/ The product amount
-
product_type: (int)/ The type of product. (1) Physical Product (2) Digital Product (3) Service
-
product_timeframe: (int)/ Number of days
$paytred = new \Raphaeltrust\Paytredphp\PaytredApi('https://api.paytred.com/v1/create-token','YOUR_API_KEY'); try { //fields $response = $paytred([ 'product_name' => 'Mecury Photo Art', 'product_amount' => 50000, 'product_type' => 1, 'product_timeframe' => 30,
]); //print response echo $response; } catch (\RuntimeException $ex) {
// catch errors die(sprintf('Http error %s with code %d', $ex->getMessage(), $ex->getCode())); }
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-06-01