2

我们正在使用 Stripe 处理我们正在开发的网站上的付款

每当客户注册时,我们都会在 Stripe 上创建一个客户并将其保存customer_Id在数据库中以针对该客户。

此外,当客户在网站上下订单时,我们可以选择保存卡以供将来使用。因此,我们将针对客户的卡保存为条带上的付款来源。

这是我们用来创建支付源的代码:

public void CreatePaymentSource(int customerId, string paymentToken)
{


    var customer = _customerProvider.GetLoggedInCustomer(customerId);

    //returns the customer_id e.g. cux_XXXXXXX from the customers table in our DB
    var userStripeId = _customerProvider.GetCustomerStripeId(customerId);


    var customerService = new StripeCustomerService();

    // paymentToken is the secure token provided by Stripe.js in the card details entry form

    var updateOptions = new StripeCustomerUpdateOptions()
    {
        Email = customer.Email,
        SourceToken = paymentToken
    };

    // update customer to create a payment source
    var stripeCustomer = customerService.Update(userStripeId, updateOptions);


}

现在在文档中说,如果我们想对现有卡收费,我们所要做的就是传递card_id、'customer_id' 和 'amount' - 基于此示例:https ://stripe.com/docs/charges#saving -信用卡详细信息,供以后使用

我想要的是这样的:

在此处输入图像描述

1 - 我想显示卡的最后 4 位数字已保存

我可以使用从条带返回的信息来执行此操作 -

在此处输入图像描述

我的问题

2 - 我希望用户每次使用卡下订单时都输入安全号码。但是我们如何验证卡上的安全号码呢?

编辑 - 我的新问题

正如评论和另一个问题中指出的那样,Stripe 无法进行 CVC 检查 - 那么检查用户是否是卡的所有者的替代方法是什么?

注意:我们正在使用 stripe.net - 但任何平台或编程语言的回答都会有所帮助。

4

0 回答 0