#jcalentine

1 messages · Page 1 of 1 (latest)

rustic pivotBOT
#

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.

spice forum
#

Hi, sure! What about the metadata?

ornate cradle
#

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

spice forum
#

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?

ornate cradle
#

ok so i will show you my entire function that handles initiate payment

spice forum
#

You can just tell me where you want to see the metadata on

ornate cradle
#

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

spice forum
#

Are you not seeing the metadata on the 'checkout.session.completed ' event?

ornate cradle
#

Excuse all the edits lol, i did not get much sleep last night.

#

let me double check because the webhook is failing

spice forum
#

I'm sorry to hear that, no worries!

ornate cradle
#

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

spice forum
#

It looks correct, is it not working for you?

ornate cradle
#

no

#

I am goin to try to log it to my db

spice forum
#

No it's not working, or no, it is working?

ornate cradle
#

no it is not working

spice forum
#

When you log, what do you see?

ornate cradle
#

I am still waiting for the new deployment, one sec

spice forum
#

Sure!