定制 peyemapi/sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

peyemapi/sdk

Composer 安装命令:

composer require peyemapi/sdk

包简介

PHP SDK for PeyemAPI - Haitian payment gateway

README 文档

README

A modern, PSR-4 compliant PHP SDK for integrating PeyemAPI payments.

Installation

Install via Composer:

composer require peyemapi/sdk

(Note: Ensure you have Guzzle installed or a compatible PSR-18 client.)

Usage

Initialize the Client

use Peyem\Sdk\Client;

$client = new Client('your_secret_key');

// Optional: Override API URL (can also be set via PEYEM_API_URL env var)
// $client = new Client('your_secret_key', 'https://custom-api.com');

Create a Payment

try {
    $response = $client->createPayment([
        'amount'      => 500, // HTG
        'referenceId' => 'ORDER-123',
        'returnUrl'   => 'https://example.com/return',
        'description' => 'Optional description'
    ]);

    if (!empty($response['payment_url'])) {
        header('Location: ' . $response['payment_url']);
        exit;
    }
} catch (\Peyem\Sdk\Exceptions\PeyemException $e) {
    echo "Error: " . $e->getMessage();
}

Check Payment Status

$status = $client->checkStatus('ORDER-123');
echo "Status: " . $status['status'];

Get Account Balance

$balance = $client->getBalance();
echo "Balance: " . $balance['balance'] . " " . $balance['currency'];

Webhook Verification

Verify incoming webhooks from PeyemAPI:

$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';
$webhookSecret = 'whsec_...';

if (\Peyem\Sdk\Client::verifyWebhookSignature($payload, $signature, $webhookSecret)) {
    // Valid webhook
}

Running Tests

To run the test suite:

composer install
vendor/bin/phpunit

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固