问题
We are using Stripe to process payments on a website we are working on
Whenever a customer signs up we create a customer on Stripe and save the customer_Id
in the DB against against the customer.
Also when a customer places an order on the website we give the option to save the card for future uses. So we save the card against the customer as a payment source on stripe.
This is the code we use to create the payment source:
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);
}
Now in the documentation it says that if we want to charge an existing card all we have to do is pass the card_id
, 'customer_id' and 'amount' - based on this example: https://stripe.com/docs/charges#saving-credit-card-details-for-later
What I want is something like this:
1 - I want to show that a card is saved with last 4 digits
I can do this using the information returned from stripe for a card -
My Question
2 - I want the user to enter the security number every time they want to use the card to place an order. But how do we verify the security number against the card?
EDIT - MY NEW QUESTION
As it has been pointed out in the comment and the other Question that CVC check is not possible with Stripe - So what is the alternative to check if the user is owner of the card?
Note: We are using stripe.net - but answer in any platform or programming language will be helpful.
来源:https://stackoverflow.com/questions/44326838/charging-existing-card-and-customer-with-security-code-on-stripe