#jcalentine
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- jcalentine, 18 hours ago, 8 messages
- jcalentine, 4 days ago, 29 messages
Hi, sure! What about the metadata?
ok so I am trying to trigger a cron job when the metadata contains a product that is a membership. I wanted to know can i create a string and assign it accordingly within initiate payment. And then when i recieve the webhook even access that string from the metadata stripe object and check to see if it is indeed a membership and if so i trigger the cron job
payment_method_types=['card'],
line_items=[
{
'price': product_price,
'quantity': 1,
},
],
metadata = {"product_type" : product_type},
mode='payment',
customer_creation='always',
success_url=settings.DEFAULT_DOMAIN + '/payment_successful?session_id={CHECKOUT_SESSION_ID}',
cancel_url=settings.DEFAULT_DOMAIN + '/payment_cancelled',```
that is my code the product_type is a string
What does 'assign it accordingly within initiate payment' mean? Are you asking if you can assign a metedata to the PaymentIntent initiated from the Checkout Session?
ok so i will show you my entire function that handles initiate payment
You can just tell me where you want to see the metadata on
ok sorry
i want to be able to access this string that I assign based on conditionals, and I want to use that string somewhere in the webhook that I receive after the checkout.session.completed
Are you not seeing the metadata on the 'checkout.session.completed ' event?
Excuse all the edits lol, i did not get much sleep last night.
let me double check because the webhook is failing
I'm sorry to hear that, no worries!
this is so silly. Part of the problem is the application is deployed in California and I am in Ohio. I probably would not even need this cron job to delay the database update if i lived in california lol
can you tell me if I am extracting the metadata correctly: if event["type"] == "checkout.session.completed": session = event['data']['object'] session_id = session.get('id', None) product_type = session["metadata"]["product_type"]
By the way, I appreciate all your help and patience
It looks correct, is it not working for you?
No it's not working, or no, it is working?
no it is not working
When you log, what do you see?
I am still waiting for the new deployment, one sec
Sure!