托管支付
1. 配置您的 MoneyCollect 账户
2. 部署服务端
<html>
<body>
<button id="submit"><span id="button-text">结帐</span></button>
</body>
<script>
// 关于订单的信息
// 用于在服务器上计算订单总额
var orderData = {
items: [{ id: "photo-subscription" }],
currency: "usd"
};
document.querySelector("#submit").addEventListener("click", function(evt) {
evt.preventDefault();
// 发起支付
fetch("/create-checkout", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(orderData)
}).then(function(result) {
return result.json();
}).then(function(data) {
// 重定向到支付页面
window.location.href = data.url;
});
});
</script>
</html>3. 创建确认页面
4. 其他测试资源
卡号
品牌
描述
5. 付款后
Last updated