PHP code example of asiabill / asiabill_php_sdk
1. Go to this page and download the library: Download asiabill/asiabill_php_sdk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
asiabill / asiabill_php_sdk example snippets
use \Asiabill\Classes\AsiabillIntegration;
$model = 'test'; // test or live
$asiabill = new AsiabillIntegration($model,$gateway_no,$sign_key);
$asiabill->startLogger($bool,$dir);
$asiabill->request($type,$data);
$asiabill->payment()->request($type,$data);
$asiabill->openapi()->request($type,$data);
$asiabill->getJsScript();
$result = $asiabill->request('checkoutPayment',['body' => [
'billingAddress' => [
'address' => 'address',
'city' => 'BR',
'country' => 'country',
'email' => '[email protected] ',
'firstName' => 'firstName',
'lastName' => 'lastName',
'phone' => '13800138000',
'state' => 'CE',
'zip' => '666666'
],
'callbackUrl' => $http_type.'://'.$_SERVER['HTTP_HOST'].'/Asiabill/return.php',
'customerId' => '', // asiabill创建的客户id,非网站用户id
'deliveryAddress' => [
'shipAddress' => 'mfdgohmqkpocemkqwtks',
'shipCity' => 'MQOHUPOX',
'shipCountry' => 'BR',
'shipFirstName' => 'SFDMPG',
'shipLastName' => 'USJAXT',
'shipPhone' => '62519594707',
'shipState' => 'WEWBZ',
'shipZip' => '512008'
],
'goodsDetails' => [
[
'goodsCount' => '1',
'goodsPrice' => '6.00',
'goodsTitle' => 'goods_1'
]
],
'isMobile' => $asiabill->isMobile(), // 0:web, 1:h5, 2:app_SDK
'orderAmount' => '7.00',
'orderCurrency' => 'USD',
'orderNo' => getOrderNo(),
'paymentMethod' => 'Credit Card', // 其它支付方式请参考文档说明
'platform' => 'php_SDK', // 平台标识,用户自定义
'remark' => '', // 订单备注信息
'returnUrl' => $http_type.'://'.$_SERVER['HTTP_HOST'].'/Asiabill/return.php',
'webSite' => $_SERVER['HTTP_HOST']
]]);
if($result['code'] == '0000'){
/* Your business code */
}
$asiabill->openapi()->request('orderInfo',['path' => [
'tradeNo' => $tradeNo
]]);
$asiabill->request('customers',['body' => [
'description' => 'test customer',
'email' => '[email protected] ',
'firstName' => 'firstName',
'lastName' => 'lastName',
'phone' => '13800138000'
]]);
$asiabill->request('customers',['path' => [
'customerId' => $customer_id
],'delete' => true]);
$asiabill->verification()
$asiabill->getWebhookData();
$asiabill->addRequest($request_type,$request_path)->request($request_type,$data);
$asiabill->addRequest($request_type,$request_path)->openapi()->request($request_type,$data);