#glenb.

1 messages · Page 1 of 1 (latest)

night joltBOT
misty needle
#

hello! can you share the event id where you're expecting to see the metadata?

high ruin
#

evt_3O0IRKJAdtV4PHZl0tV50HCb

misty needle
high ruin
#

But I am passing it (in the code)?

misty needle
#

i suggest debugging or stepping through your code. It could be that you're updating a section of code that is not actually used

high ruin
#

I stepped through it and it's correct. Is there any chance it is an issue with your beta version of ui_mode: 'embedded' ?

misty needle
#

hmmm, gimme a second to test it out

high ruin
#

I have the output of the session object and it doesn't include the payment_intent_data. Happy to paste it into this if you need it. Will wait to hear how your test goes - thanks.

#

Any luck?

misty needle
#

we just tested it and it works perfectly fine for us

high ruin
#

Really, that's odd. I stepped through the code I pasted and the session object doesn't include the payment_intent_data? Did you use ui_mode: 'embedded' in your test?

misty needle
#

yep, we did that

#

how about you try creating an entirely separate and new example from scratch instead and see if you're still having the same issue?

high ruin
#

You can see the code I'm using to create the session - what's wrong with it?

misty needle
#

it looks correct to me too. But when we copied your exact code, and assigned a value to the variable, it worked as expected for us

#

it'll be easier if you can create a simple sample that replicates the issue using glitch or codesandbox for us to take a look at. Without an example that replicates the issue which we can look at, it's difficult for us to troubleshoot further

high ruin
#

Alex, I'm not familiar with glitch or codesandbox? Would it help if I made a sample using values instead of the variables?

misty needle
#

i would say reach out to us at https://support.stripe.com/contact/email and share your sample that we can just download and run as it is. You could possible upload your code to github gists as well and share a link to that. If you do share code please be sure to remove any API Keys or other sensitive information.

high ruin
#

Not helpful Alex. I don't have time to send an email to support and wait for a response. Same code, new delivery...? Can you share the code you used to replicate my session creation so I might see what's different, or is there someone else who might be able to work out what's wrong? My code follows all your requirements?

#

Basically, I just need to be able to capture that the payment was successful and the metadata to tell me what it was for....

civic robin
#
  const tokenName = 'test'
  const tokenID = 'test2'
  const preTaxAmountToPay = 1000
  const stripeCustomerID = 'cus_OkBZiJJJ2a6QLI'
  const returnURLBase = 'https://www.example.com'

  const checkoutSession = await stripe.checkout.sessions.create({
    line_items: [
      {
        price_data: {
          currency: 'aud',
          product_data: {
            name: `Reactivate token: ${tokenName} (${tokenID})`
          },
          unit_amount: preTaxAmountToPay,
          tax_behavior: 'exclusive'
        },
        quantity: 1
      }
    ],
    payment_method_types: ['card'],
    mode: 'payment',
    ui_mode: 'embedded',
    customer: stripeCustomerID,
    automatic_tax: {
      enabled: true
    },
    billing_address_collection: 'required',
    customer_update: {
      address: 'auto',
      name: 'auto'
    },
    payment_intent_data: {
      metadata: {
        updateReason: 'reactivate',
        [tokenID]: 'add'
      }
    },
    return_url: `${returnURLBase}/tms/checkoutCompleted?session_id={CHECKOUT_SESSION_ID}`
  });
  console.log(checkoutSession)
}```
#

Hi @high ruin This is the code I run based on the code you provided earlier.

high ruin
#

Ok, thanks. Give me a sec to run it?

civic robin
#

Sure thing

high ruin
#

I ran it and have the same issue. The output of the checkoutSession in your code also doesn't include the payment_intent_data?

civic robin
#

Can you share with me the request ID?

high ruin
#

Ok, is this it: cs_test_a1kRsLZ6OwbF4juFq3MGquxUeApWchJnVXfRkK0Y33ywmKwvQRhvD1QAG3

misty needle
#

the response for the Checkout Session creation doesn't have a PaymentIntent. A PaymentIntent is only created when you attempt to pay

#

so if you try to make payment, and then examine the corresponding PaymentIntent, you would probably be able to see the metadata on the created PaymentIntent now

high ruin
#

Ok, I'll give it a try...

#

Hey, I'm trying mine again - I'll give you the id - can you check the response on that please?

misty needle
#

sure

high ruin
#

cs_test_a1MZohezD2OiXLYF0yQjhgE8meaSXRnmKv0rMPoLnPHxuM0Fq0k9dv6zTk

misty needle
#

yep, payment_intent_data.metadata is also being passed in for cs_test_a1MZohezD2OiXLYF0yQjhgE8meaSXRnmKv0rMPoLnPHxuM0Fq0k9dv6zTk

high ruin
#

Ok, that's good. Maybe it was there all along but the metadata isn't coming up in the webhook event? Let me process the payment and see....

#

Ok, I'm getting the metadata in payment.intent_succeeded now. Thanks Alex - appreciate your help.