I've been using Stripe. When checkout X will create a Payment Intent every time a customer arrives on the checkout. This will result into an "Incomplete" payment.
I integrete STRIPE in my .Net Core application. Here the code below :
public void Pay(CardInfo cardInfo, double amount)
{
StripeConfiguration.ApiKey = _paramList["secretKey"];
State = PaymentState.Pending;
try
{
var options = new SessionCreateOptions
{
Mode = "payment",
SuccessUrl = "https://example.com/success",
CancelUrl = "https://example.com/cancel",
Customer = cardInfo.Owner,
CustomerEmail = cardInfo.ParamList["email"],
PaymentMethodTypes = new List<string>
{
"card",
},
LineItems = new List<SessionLineItemOptions>
{
new SessionLineItemOptions
{
Amount = Convert.ToInt64(amount.ToString().Replace(",","")),
Currency = "eur",
Quantity = 1,
Name = _paramList["account"]
},
},
};
var service = new SessionService();
service.Create(options);
State = PaymentState.Accepted;
}
catch (StripeException error)
{
State = PaymentState.Error;
PaymentReturn = error.Message;
Logger.Write(string.Format("Error STRIPE payment status {0} : ",PaymentReturn));
}
}
In my form payment, I'm not using stripe form but I've created one and I retrieve all information that I need (Card Number, CVV, Expiration, Email and Amount)