I am tryin to integrate youCan payment to my website and i don't now why it does't run and also there is no log been consoled this the my code :
useKeys('private_key', 'pub_key');
// 希望进行此次购买的客户的数据。
// 请保留这些密钥。
$客户信息 = [
'名称' => '',
'地址' => '',
'邮政编码' => '',
'城市' => '',
'状态' => '',
'国家代码' => '',
'电话' => '',
'电子邮件' => '',
];
$元数据= [
// 你能在这里插入你想要的东西吗...
//'键'=>'值'
];
$token = $youCanPay->token->create(
“订单号”,
"1000",
“美元”,
"123.123.123.123",
“https://yourdomain.com/orders-status/success”,
“https://yourdomain.com/orders-status/error”,
$客户信息,
$元数据
);
返回 $token->getId();
}
}
?>
****************************javascript*********************************
const ycPay = new YCPay(
“pub_a01b7b41-0e42-4a56-a165-1bc55244”, {
formContainer:“#payment-card”,
语言环境:“en”,
isSandbox:是的,
错误容器:“#错误容器”,
}
);
ycPay.renderCreditCardForm();
<script type="text/javascript">
document.getElementById("pay").addEventListener("click", function() {
step.
ycPay
.pay("<?php (new ExamplePayment())->createToken() ?>")
.then(successCallback)
.catch(errorCallback);
});
function successCallback(transactionId) {
alert("success");
}
function errorCallback(errorMessage) {
alert("faild");
}
</script>