#DJB-metadata

1 messages · Page 1 of 1 (latest)

knotty ore
#

Hello

#

What is the call/code you're using that doesn't return the data you expect?

frozen furnace
#

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;
knotty ore
#

You mentioned JavaScript, yet that's .NET code

frozen furnace
#

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();
       }
     })
   });
knotty ore
#

So result.paymentIntent doesn't have the fields you expect?

frozen furnace
#

yes, exactly.

#

We see the response in Stripe portal, but its not coming in the metadata

knotty ore
#

Or I should say the fields that are returned are flagged accordingly:

frozen furnace
#

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?

knotty ore
#

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

frozen furnace
#

cheers