集成站内支付

获取sessionToken

$sessiontoken = $asiabill->request('sessionToken');

前端集成JS SDK

// 获取jssdk脚本
$asiabill->getJsScript();
  1. 1.
    初始化表单 elementInit
  2. 2.
    创建支付方式 confirmPaymentMethod
  3. 3.
    获得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' => '[email protected]',
'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' => '[email protected]',
'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
)
));