paytota/paytota-sdk-php
Composer 安装命令:
composer require paytota/paytota-sdk-php
包简介
README 文档
README
Requirements
PHP 7.2 and later.
The following PHP extensions are required:
- curl
- json
- openssl
Installation
Composer
composer install
Getting Started
Simple usage looks like:
<?php require_once 'vendor/autoload.php'; $paytota = new \Paytota\PaytotaApi($config['brand_id'], $config['api_key'], $config['endpoint']); $client = new \Paytota\Model\ClientDetails(); $client->email = 'test@example.com'; $purchase = new \Paytota\Model\Purchase(); $purchase->client = $client; $details = new \Paytota\Model\PurchaseDetails(); $product = new \Paytota\Model\Product(); $product->name = 'Test'; $product->price = 100; $details->products = [$product]; $purchase->purchase = $details; $purchase->brand_id = $config['brand_id']; $purchase->success_redirect = 'https://gate.paytota.com/api/v1/?success=1'; $purchase->failure_redirect = 'https://gate.paytota.com/api/v1/?success=0'; $result = $paytota->createPurchase($purchase); if ($result && $result->checkout_url) { // Redirect user to checkout header("Location: " . $result->checkout_url); exit; }
Testing
./vendor/bin/phpunit tests
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-10