Stripe Payment:保存令牌和客户,稍后从令牌付款 [英] Stripe Payment: Save token and customer and make payment later from token

查看:88
本文介绍了Stripe Payment:保存令牌和客户,稍后从令牌付款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以进行条带支付,

首先我们将使用条带验证信用卡,然后我们生成令牌并创建客户.我们将在数据库中保存令牌而不是信用卡信息,稍后我们将根据令牌或客户而不是信用卡信息向客户付款.

First we will validate credit card using stripe, then we generate token and create customers. we will save token instead of credit card information in database and later we will make payments from customers on basis of token or customer instead of credit card information.

在javscript文件中我们如何处理stripeResponseHandlerfunction stripeResponseHandler(status, response)?

In javscript file how do we handle stripeResponseHandler and function stripeResponseHandler(status, response)?

因为我们已经使用

Stripe.createToken({
            number: cardNumber,
            cvc: cardCVC,
            exp_month: $('#expiration-month').val(),
            exp_year: $('#expiration-year').val()
        }, stripeResponseHandler);

在支付步骤中我们如何调用stripeResponseHandler?

in payment step how we call stripeResponseHandler?

请理解要求

1- 通过验证信用卡信息保存令牌,在这种情况下不涉及付款.金额/价格将为零(0).

1- Save the Token by verifying credit card information, in this case no payment is involve. amount/price will zero(0).

2- 将此令牌保存在您的数据库中,但此令牌使用一次的次数并不多.如果以后使用此令牌,它将无法使用.

2- Save this Token in your database, but this token is use once not many time.If use this Token later it will not work.

3- Create customer 将在stripe.com 创建一个客户,我们也可以保存在我们的数据库中,但原因是我们不会从我们的网站充值,我们必须在stripe 登录.com 并从该网站充电.当我们从那个网站充值时,我们无法在我们的数据库中保存该记录.此外,在创建客户时,我们必须为后者创建一个充值.如果我们使用这个客户端,我们还需要再次使用信用卡.所以这是主要问题.

3- Create customer will create a customer at stripe.com and we can also save in our database but the reason is that we will not recharge from our site , we have to login at stripe.com and recharge from that site. when we recharge from that site , we are unable to save records of that in our database.Also at time of creating customer, we have to create a recharge for latter . we also need credit card again if we use this client. so this is the main issue.

4- 我们可以创建自己的函数 stripeResponseHandler ,因为通过 stripeResponseHandler 可以在 Stripe 服务器的 stripe.js 中验证卡片.

4- we can make own function stripeResponseHandler , because through stripeResponseHandler verification of cards can be done at stripe.js at stripe server.

推荐答案

我建议不要保存令牌本身,而是建议创建一个客户并保存您的客户 ID.然后,您可以在未来的任何时间向您的客户收费.请参阅我们关于保存卡详细信息以供日后使用的文档.

Instead of saving the token itself, I recommend creating a customer and saving your customer ID. You can then charge your customer at any time in the future. See our documentation on saving card details for later.

在javscript文件中我们如何处理stripeResponseHandler和函数stripeResponseHandler(status, response).

In javscript file how we handle stripeResponseHandler and function stripeResponseHandler(status, response).

您需要创建一个函数,并在调用 createToken 时将其作为您的 stripeResponseHandler 传递.此功能所需要做的就是将您的令牌插入表单并提交.这里有一个简单的例子:https://gist.github.com/boucher/1750375

You will need to create a function and pass it as your stripeResponseHandler when calling createToken. All this function needs to do is insert your token into your form and submit it. There's a simple example of that here: https://gist.github.com/boucher/1750375

这篇关于Stripe Payment:保存令牌和客户,稍后从令牌付款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆