#thomasnevink
1 messages · Page 1 of 1 (latest)
Hello 👋
Is that from .NET SDK?
What version of the SDK are you running?
Can you share the exact code?
I'm using Stripe.net nuget package v42.6.0
Can you share the exact code you're using?
Can you share it in text and not pictures?
Sure
[HttpPost]
[Route("create")]
public ActionResult Create(PaymentIntentCreateRequest request)
{
int orderAmount = CalculateOrderAmount(request.Items);
var options = new PaymentIntentCreateOptions
{
Amount = orderAmount,
Currency = "INR",
AutomaticPaymentMethods = new PaymentIntentAutomaticPaymentMethodsOptions // optional
{
Enabled = true,
},
Metadata = new Dictionary<string, string>
{
{"Identifier", "321"},
{"AdditionalInfo", "xyz"}
}
};
if (request.SavePaymentMethod)
{
//// To set a card up for future payments, you must attach it to a Customer.
//// Create a Customer object when your customer creates an account with your business.
//// Customer objects allow for reusing payment methods and tracking across multiple payments.
// Create a Customer with a payment method attached
var customerOptions = new CustomerCreateOptions();
var customerService = new CustomerService();
var customer = customerService.Create(customerOptions);
options.Customer = customer.Id;
options.SetupFutureUsage = "off_session";
}
else
{
options.SetupFutureUsage = "on_session"; // Use on_session if you don't want to save the payment method
}
var paymentIntents = new PaymentIntentService();
var paymentIntent = paymentIntents.Create(options);
return Json(new { clientSecret = paymentIntent.ClientSecret });
}
Hello, looking in to this. Are you able to access other objects in out library or do you get this error for them too?
@south dawn want to make sure you're seeing our messages
Gotcha, I'm running that same code in my local .NET install with the same .NET version. It is hard to say what may be the issue here
I'm running it in VS 2019, is that a problem?