jieyang/payssion-php

该包最新版本(v1.0.0)没有可用的许可证信息。

维护者

详细信息

gitee.com/jieyang/payssion-php

v1.0.0 2023-06-11 08:46 UTC

This package is not auto-updated.

Last update: 2024-09-30 13:38:34 UTC


README

先决条件

  • PHP 5.3 或更高版本
  • curl、json 和 openssl 扩展必须启用

使用方法

$payssion = new PayssionClient('your api key', 'your secretkey');
//please uncomment the following if you use sandbox api_key
//$payssion = new PayssionClient('your api key', 'your secretkey', false);

$response = null;
try {
	$response = $payssion->create(array(
			'amount' => 1,
			'currency' => 'USD',
			'pm_id' => 'alipay_cn',
			'order_id' => 'your order id',      //your order id
			'return_url' => 'your return url'   //optional, the return url after payments (for both of paid and non-paid)
	));
} catch (Exception $e) {
	//handle exception
	echo "Exception: " . $e->getMessage();
}

if ($payssion->isSuccess()) {
    //redirect the users to the payment URL
    $payment_url = $response['redirect_url'];
} else {
	//handle failure
}

PAYSSION PHP 库