#DJB-metadata
1 messages · Page 1 of 1 (latest)
hi. var options = new PaymentIntentCreateOptions
{
Description = "Stripe payment through Campus",
Amount = 35000,
Currency = "usd",
PaymentMethodTypes = new List<string>
{
"card",
},
Metadata = new Dictionary<string, string>
{
{ "OrderId", "U242D131242342356R" },
}
};
var service = new PaymentIntentService();
var paymentIntent = service.Create(options);
clientSecret = paymentIntent.ClientSecret;
You mentioned JavaScript, yet that's .NET code
This one is javascript part defined in .aspx page
var form = document.getElementById("paymentform");
form.addEventListener("submit", function(e) {
e.preventDefault();
// Tokenize payment details and confirm the payment intent.
stripe.confirmCardPayment(
"<%= clientSecret %>",
{
payment_method: {
card: cardElement,
billing_details: {
name: name.value,
}
}
}
).then(function(result) {
if(result.error) {
alert(result.error.message);
} else {
debugger;
alert(result.paymentIntent);
console.log("successful payment!");
form.submit();
}
})
});
So result.paymentIntent doesn't have the fields you expect?
yes, exactly.
We see the response in Stripe portal, but its not coming in the metadata
Yep, we don't return metadata field following confirmCardPayment as you're using your publishable keys. It's noted here: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Or I should say the fields that are returned are flagged accordingly:
ok then we will refer these documents you provided to look for the solution. Many thanks
Are you aware of any other fields we can use for posting our internal invoice\order number number when sending the payment data to Stripe so we get the same value back when Stripe returns the result so we can verify the transaction being returned from Stripe?
metadata is probably the right field for that, tbh. I'd recommend instead relying on a webhook/event data for that kind thing
So listen for payment_intent.succeeded events, which will include the full PI object you need
cheers