条纹充电后重定向到新页面 [英] Redirect To New Page After Stripe Charge
问题描述
条纹费用完成后是否可以重定向到新网页?我正在使用.NET C#
Is it possible to redirect to a new webpage after the stripe charge completes? I am using .NET C#
以下是代码:
<form action="/charge" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_6pRNASCoBOKtIshFeQd4XMUh"
data-image="/img/documentation/checkout/marketplace.png"
data-name="Stripe.com"
data-description="2 widgets"
data-amount="2000"
data-locale="auto">
</script>
</form>
之后,我想做的就是重定向到我网站上的另一个页面。
After, all I want to do is redirect to another page on my website.
谢谢!
推荐答案
此客户端代码仅将卡信息转换为令牌 - 它实际上不会产生费用。
This client-side code will only turn the card information into a token -- it won't actually create a charge.
当您提交表单时,参数(包括卡片令牌)将被发送到 / charge
(因为这是你设置为< form> $ c $的
action
属性c>标签)。然后,您需要使用这些参数来创建费用。您可以在本教程中找到更多信息。
When you submit the form, the parameters (including the card token) will be sent to /charge
(because that's what you set as the action
attribute for the <form>
tag). You then need to use these parameters to create a charge. You can find out more in this tutorial.
创建费用后,您可以使用适合您的语言和框架的任何方法将用户重定向到另一个页面,例如在PHP中你只需:
Once the charge has been created, you can redirect the user to another page using whatever method is appropriate for your language and framework, e.g. in PHP you'd simply do:
header('Location: /success');
将用户重定向到 / success
。
这篇关于条纹充电后重定向到新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!