paytota/paytota-sdk-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-10