payzmart / paynova_php

Paynova-payzmart PHP 客户端库

dev-master 2019-09-17 08:58 UTC

This package is not auto-updated.

Last update: 2024-09-25 10:54:35 UTC


README

这是使用 [Paynova REST API][] (Aero) 的 Paynova API PHP 客户端库的概述。更详细的信息可以在 [Wiki][] 中找到。[Paynova REST API]: http://docs.paynova.com/display/API/Paynova API Home [Wiki]: https://github.com/Paynova/paynova-api-php-client/wiki

依赖

PHP 版本 >= 5.3.0 需要。

以下 PHP 扩展是必需的

  • curl

入门

  • 通过下载 zip 文件开始

或者

  • 使用 composer
    {
    "require" : {
      "paynova/paynova_php": "v3.0.2"
    }
    }
    

快速示例

以下示例在 Paynova 中创建一个订单。

include YOUR_PATH."/lib/Paynova.php";

use Paynova\PaynovaConfig;
use Paynova\request\RequestCreateOrder;

/*
*	Set credentials here
*/
PaynovaConfig::endpoint("set-endpoint-url-here);//The API SERVER URL
PaynovaConfig::username("username);//Merchant id at Paynova
PaynovaConfig::password("password");//Merchant password at paynova

/*
* Create an order by using the factory method in RequestCreateOrder
* set the mandatory properties
*/
$request = RequestCreateOrder::factory(array(
		"orderNumber"=>"merchant-order-id-1",
		"currencyCode"=>"SEK",
		"totalAmount"=>"100.00",
));
/*
* Make the request to the API server
* and get ResponseCreateOrder
*/
$response = $request->request();

if($response->status()->isSuccess()==1) {
	//SUCCESS
}else{
	/*
	 * Use the error collection
	 * $initResponse->status()->errors();
	*/
}

许可证

阅读 LICENSE.md 文件