在条纹中添加客户的信用卡信息 [英] Adding customer's Credit card info in stripe

查看:21
本文介绍了在条纹中添加客户的信用卡信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个可供用户注册的 ReactJS 应用程序.我们有自己的积分系统,用户将使用这些积分购买产品.对于积分,要么有人将其作为礼物赠送,要么他们可以使用信用卡(主要)购买积分.首先我们想将信用卡存储在 DB 中,然后我们意识到 PCI 合规性和其他危险或将 CC 信息保存在 db 中.所以现在我们使用的是 Stripe.

I am working on a ReactJS app where users will register. we have our own points system, users will use those points to buy products. for points either someone will give them as a gift or they can purchase points using credit card (primarily). First we wanted to store credit cards in DB, then we realize about PCI compliance and other danger or saving CC info in db. so now we are using Stripe.

我正在使用 Stripe 的 ReactJS 库.我知道有一个选项可以将用户注册为客户,我做到了.但我对如何向这些客户添加和保存信用卡感到困惑.以便将来用户想要使用该卡时,他们可以通过选择付款方式来使用.Stripe 提供了这些对象:卡对象、支付方法对象、设置意图、来源和支付意图.它们每个都请求相似的数据并返回相似的数据.

I am using ReactJS library of Stripe. I understand there is an option to register users as a customer, which I did. but I am confused about how to add and save credit cards to those customers. so that whenever in future a user want to use that card, they can use by selecting payment method. Stripe provides these objects: Card object, Payment Method object, Setup Intent, Sources and Payment Intent. each of them request similar data and returns similar data.

我的主要目标是获取信用卡信息,将其存储在条带中,作为回报,条带会给我一些 ID(就像它给了我客户 ID 以获取客户数据).我会将该 ID 存储在我的数据库中.将来我会将该 ID 传递给 Stripe,以便 Stripe 可以根据该 ID 向客户收费.

My main objective is to get credit card info, store it in stripe, in return stripe will give me some ID (like it gave me customer id to get customer data). I will store that ID in my database. in future I will pass that ID to stripe so that stripe can charge the customer against that ID.

注意:

  • 我已经使用 react 使用了前端,我使用 stripe.createPaymentMethod() 函数添加了一个支付方式,该方式返回了一个像 pm_1Haffm2eZvKYxxx 这样的 ID.所以我需要一个正确对象的名称.
  • 应用有时会在用户的帐户中向用户提供退款或提款.所以我会将金额存入同一张卡.(这可能吗?)
  • I have already working frontend using react where I used stripe.createPaymentMethod() function to add a payment method which returned an ID like pm_1Haffm2eZvKYxxx. so I need a name of correct Object.
  • App will sometime give users money in their account as a refund or withdraw. so I will deposit amount to that same card.(is this possible?)

推荐答案

您使用 createPaymentMethod 的方法可能就足够了,然后您应该 将付款方式附加到客户.

You approach of using createPaymentMethod might suffice, and you should then attach the payment method to a Customer.

如果您想处理 SCA 并预先验证持卡人的身份,您应该使用 Setup Intents 使用 Elements 保存卡片详细信息在设置模式下通过结帐推送您的客户.如果需要,这两者都将帮助您处理 3D 安全操作.

If you want to handle SCA and authenticate the cardholder up front, you should use Setup Intents to save the card details with Elements or push your Customer though Checkout in setup mode. Both of these will help you handle 3D Secure actions if needed.

使用这些方法中的任何一种,您最终都会得到一个客户和一个或多个附加的付款方式.然后您可以稍后付款 在创建付款意向时提供客户 payment_method.

Using any of these approaches, you would end up with a Customer and one or more attached payment methods. You can then make payments later by providing the customer and payment_method when creating a payment intent.

这篇关于在条纹中添加客户的信用卡信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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