我正在尝试在我的网站上实现coinbase支付。
我在这里使用嵌入支付按钮:https://commerce.coinbase.com/docs/#payment-buttons
我正在使用Javascript BuyWithCrypto类注册一个回调,该回调调用一个脚本,该脚本在调用函数后处理客户的请求。被调用的PHP脚本应该用客户存入的金额更新数据库表。
BuyWithCrypto.registerCallback('onSuccess', function(e){
// Charge was successfully completed
window.location.assign("process.php")
});一切正常,但我在检测用户存入生成的地址的金额时遇到了问题。
我只想知道是否有可能在调用onSuccess函数时获得用户存入的金额。
发布于 2020-09-07 13:04:09
var amt=document.getElementById("amt");
var btn=document.getElementById("btn");
btn.addEventListener("click", purchase);
function purchase() { // put this in first line of callback
var amtPaid=parseFloat(
amt.options[amt.selectedIndex].innerText
);
console.log(amtPaid);
// do what you want with amtPaid
}Amount:
<select id="amt">
<option> 9.99</option>
<option>19.99</option>
<option>29.99</option>
</select>
<button id="btn">Pay</button>
https://stackoverflow.com/questions/63771512
复制相似问题