I am new to Stripe. I implement a card payment system using Stripe in .NET.
My code is as under:
var options = new SessionCreateOptions
{
PaymentMethodTypes = new List<string> { "card", },
LineItems = new List<SessionLineItemOptions> {
new SessionLineItemOptions {
PriceData = new SessionLineItemPriceDataOptions {
UnitAmount = productPrice, // in cents
Currency = currency,
ProductData = new SessionLineItemPriceDataProductDataOptions {
Name = productName
},
},
Quantity = 1,
},
},
Mode = "payment",
PaymentIntentData = new SessionPaymentIntentDataOptions
{
ReceiptEmail = customerEmail,
Description = productName
},
SuccessUrl = domain + "/Home/PaymentSuccess?session_id={CHECKOUT_SESSION_ID}",
CancelUrl = domain + "/Home/PaymentCancel",
Customer = customerId // From database
};
var service = new SessionService();
Session session = service.Create(options);
jsonToReturn = Json(new { id = session.Id });
As you can see above, I am passing the CustomerId which I have stored with me in DB.
The problem is that with each payment customer enters the same card 4242 4242 4242 4242 with the same expiry 12/20 and CVV 123, but the Stripe is creating multiple cards when seen on the dashboard for the same customer.
Further, can I pass a payment method Id (Card ID saved wth Stripe for past checkout), so that customer doesn't need to enter card details and can choose directly the card that was used to checkout in past ?
