server/pkg/payment/stripe.html
Chang lue Tsen 8addcc584b init: 1.0.0
2025-04-25 12:08:29 +09:00

40 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://js.stripe.com/v3/"></script>
</head>
<body>
<button id="payment">提交</button>
<script>
const stripe = Stripe('pk_test_51L4gYuHqdC7TVcHRMpjoxpdlNM3MwlcWHFYHmSSUjkjzE9x0IlKqxcYvSxnPXD5ahxdxSxVf6kJf7AEwpwmTqATx005M6v5QDe');
const btn = document.getElementById('payment');
btn.addEventListener('click',async ()=>{
try {
// wechatpi_3Q8kM5HqdC7TVcHR10ESkDJD_secret_sEJxtzWruoYEPjLbpKIC4Z0Ae
// alipaypi_3Q8kTxHqdC7TVcHR08NCtdE5_secret_wpc54Pa1EXxoccznERFjKvxHr
const {error, paymentIntent}= await stripe.confirmAlipayPayment('',
{
payment_method_options: {
wechat_pay: {
client: 'web',
},
},
},
{
handleActions: false,
}
)
if (error) {
console.error(error)
} else {
console.log(paymentIntent)
}
}catch (e) {
console.log(e)
}
})
</script>
</body>
</html>