集成站内支付
最后更新于
最后更新于
$sessiontoken = $asiabill->request('sessionToken');
// 获取jssdk脚本
$asiabill->getJsScript();
初始化表单 elementInit
创建支付方式 confirmPaymentMethod
获得customerPaymentMethodId,用户发起扣款
$data参数
$data = array(
'body' => array(
'callbackUrl' => $callbackUrl,
'customerId' => $customersId,
'customerPaymentMethodId' => $customerPaymentMethodId,
'shipping' => array(
'address' => array(
'line1' => 'line1',
'line2' => 'line2',
'city' => 'BR',
'country' => 'country',
'state' => 'CE',
'postalCode' => '666666'
),
'email' => '123451234@email.com',
'firstName' => 'firstName',
'lastName' => 'lastName',
'phone' => '13800138000',
),
'goodsDetails' => array(
array(
'goodsCount' => '1',
'goodsPrice' => '6.00',
'goodsTitle' => 'goods_1'
),
array(
'goodsCount' => '1',
'goodsPrice' => '8.00',
'goodsTitle' => 'goods_2'
)
),
'isMobile' => $asiabill->isMobile(),
'customerIp' => '127.0.0.1',
'orderAmount' => '7.00',
'orderCurrency' => 'USD',
'orderNo' => getOrderNo(),
'platform' => 'php_SDK',
'remark' => '',
'returnUrl' => $returnUrl,
'webSite' => $_SERVER['HTTP_HOST'],
'tokenType' => ''
)
);
$confirmCharge = $asiabill->request('confirmCharge',$data);
if( $confirmCharge['code'] == '00000' ){
/* Your business code */
}
$asiabill->request('paymentMethods_list',array(
'path' => array(
'customerId' => $customerId,
)
));
$asiabill->request('paymentMethods_attach',array(
'path' => array(
'customerId' => $customerId,
'customerPaymentMethodId' => $customerPaymentMethodId
)
));
$asiabill->request('paymentMethods_update',array(
'body' => array(
'customerPaymentMethodId' => $customerPaymentMethodId,
'billingDetail' => array(
'address' => array(
'line1' => 'line1',
'line2' => 'line2',
'city' => 'BR',
'country' => 'country',
'state' => 'CE',
'postalCode' => '666666'
),
'email' => '123451234@email.com',
'firstName' => 'firstName',
'lastName' => 'lastName',
'phone' => '13800138000',
),
'card' => array(
'cardNo' => '4111111111111111',
'cardExpireMonth' => '05',
'cardExpireYear' => '2055',
'cardSecurityCode' => '123'
)
)
));
$asiabill->request('paymentMethods_detach',array(
'path' => array(
'customerPaymentMethodId' => $customerPaymentMethodId
)
));