#chiefmcconnell.eth
1 messages · Page 1 of 1 (latest)
Can you send me the ID of the checkout session that this was for?
That does look like it should pass on the ID
cs_test_a1Rwzul2Ohcn9jiH3aExSC9c5uHXFzVTv4XTsQYwvUDv67I3XxVuDjizQi
yeah i did everything the way it should be. consulted with another dev yesterday here to make sure
¯_(ツ)_/¯
Thanks for the ID, checking in to this
i can also send you the page where im using the payment method if you would like to test it that way. you would just have to create an account and then you would be able to make a test payment
Yes that would be helpful if you can send it. Apologies was trying to recreate this but other threads got busy so I wasn't able to. Trying again now
And thanks! Just a fan of Roman history
nice. i study Stoicism daily. moving to Sicily soon
disregard all the other mess on the page. we are using it for testing purposes at the moment
Interestingly when I am do this same code with my own pricing table the client reference ID is getting passed on properly
yeah that is strange
When I am on that page now I actually don't see the client-reference-id set
</stripe-pricing-table>```
And the same console command does not show it as being set
Can you try reloading the page without cache and see if it changes for you?
you made an account or did it not prompt you to make an account?
ahhh .it doesn't prompt you to create an account
Yeah
so if you go to the base url... it should have a sign in page where you can create an account
sorry for that
I forgot I made the page unauthenticated
once you create an account you can then go to /download-files and it should then show you a user ID
Now that I am logged in the value is populated and it is properly showing up on the Checkout Session cs_test_a1FAenFDNh7c7Id2TYGCif0w84s5QJ1acDpH9bZ0MQrQjjvPouo5Ws8PVG
Can you try again and see if this is working for you as well?
yep. seeing it now. so does that client_reference_id not show up in the invoice.payment_succeeded json?
asking because I want to be able to use it when checking status of subscription in the future. at the moment I have no access to webhooks unless I use a third party (or if you know a way to install webhooks with just javascript rather than running in node)
when I check the status now it will be an API call each time they log in
Yeah, I think client reference ID is only on the Checkout Session itself. I don't think the subscription or invoice objects have properties for that but you can use the initial checkout.session.completed event to set the reference ID as metadata on the subscription https://stripe.com/docs/api/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.
Metadata typically isn't copied between objects but one exception is that invoice line items will pull their metadata from their related subscription. So you would be able to access the metadata from that event if it is set on the subscription
Or it may just be easier to save a subscription->client_reference_id mapping in your database and refer to that
yeah that is why I was trying to include this so I have the checkout id and our user id from our backend. so when checking I can cross reference both to ensure the user is 1)logged in, 2)has a subscription 3)subscription is active and then letting them access the tool
but again, i have to do all of this with api calls since I can't use webhooks inside of the page itself at the moment. i only have API and server-side API out at the moment. no API/webhooks in
no problem. you are all busy today
Is there something outstanding here that I can help with?
the only outstanding thing I guess I was wondering is... setting the value I passed into client_reference_id to show up in either the invoice.payment_succeeded data or... set it in their stripe user data which I guess is what pompey said above using the api call to set it into the metadata
which would probably be first an api call for the payment in order to get their stripe userID and then making a second call to set what I want into their metadata
Yep that would be the way if you aren't using Webhooks
do you know how i could set up webhooks with just vanilla js? or is that not a thing since it is serverside only usually
im not 100% sure I can just import express.js and just have it work. i think it requires some node dependencies
Yeah your Webhook handler is required to be server-side
ok, sounds good. thanks to both of you!!! appreciate it!