#rose-sun_api

1 messages ยท Page 1 of 1 (latest)

white fractalBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1334221792113594491

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

deft nebula
cobalt nexus
#

Well, I use the same checkout session to compare on both method.
checkout session X will show payment intent ID on postman with or without status filter.
checkout session X never show payment internt ID on stripe SDK API call

deft nebula
#

You are using the LIst call, not the retrieve call. How are you accessing?

cobalt nexus
#

here is my partial sample on using Stripe SDK AI...


cs = stripe.checkout.Session.list(limit=100, starting_after=last_checkoutsession)

    # Add the retrieved checkout session to the list
    checkoutsessionlist.extend(cs.data)

    # Update `last_charge` for the next pagination request
    last_checkoutsession = cs.data[-1].id

    for checkoutsession in checkoutsessionlist:
        checkout_session = []
        checkout_session.append(checkoutsession['id'])
        checkout_session.append(checkoutsession['object'])
        if checkoutsession.get('amount_subtotal') is not None:
            checkout_session.append(checkoutsession['amount_subtotal'] / 100)
        else:
            checkout_session.append(0)
        if checkoutsession.get('amount_total') is not None:
            checkout_session.append(checkoutsession['amount_total'] / 100)
        else:
            checkout_session.append(0)
        checkout_session.append(datetime.fromtimestamp(checkoutsession['created']))

        checkout_session.append(checkoutsession['currency'])
        checkout_session.append(checkoutsession['payment_intent'])

so I try to get the checkoutsession['payment_intent'] from the checkoutsession object in the loop

deft nebula
#

Do you have an example checkout session ID?

cobalt nexus
#

cs_live_a1vnRKzhZi4WNgc73rui1Osupo0wlV1BaytquPUGN45mPIYPnT1sFZwnZO

deft nebula
#

I don't see you passing a status filter there. Can you share an ID of a session where your loop does not find a payment_intent value?

cobalt nexus
#

this is the session ID cs_live_a1vnRKzhZi4WNgc73rui1Osupo0wlV1BaytquPUGN45mPIYPnT1sFZwnZO
and when loop into this session id, I got payment link, I got payment method, but only payment intent is null

#

I want to see ALL checkout session so I did not passing a status filter... Why the status matter ?

deft nebula
#

Because if a Checkout Session is not complete, it won't have a payment intent

#

I see pi_3QmLjWFku8dbQAsh0WLuoncP associated with this Checkout Session

cobalt nexus
#

okay, even I did not passing a complete status filter but this session is "complete" anyway and this session does include in the loop and this session has all value in the JSON but payment intent. That is why I don't understand why status filter matter. The loop will list all session that status is "complete" or "not complete" and I want to see them all for sure.
The thing I don't understand is why payment intent is null and all others value is there ?

deft nebula
#

A Checkout Session will only create a Payment Intent when the Customer completes the session. Your code should expect any Checkout Session with status != "complete" to have a null value for payment intent

cobalt nexus
#

so you are saying that becuase I did not have status filter on the code so the payment intent is null even the checkout session is completed ?

#

this session is COMPLETE and it DOES has payment intent 100%.

#

the loop does show this session no problem without status filter.

#

just that the payment intent ID is null which I don't get it

deft nebula
#

Can you share a checkout session that is currently showing a payment intent ID as null with a status of "complete"?

white fractalBOT
cobalt nexus
#

May you please tell me what is the correct syntax to add those status filter on the below ? The Stripe API documentation did not have the sample to show how to write the status filter syntax for the SDK...

stripe.checkout.Session.list(limit=100, starting_after=last_checkoutsession, status=('complete','expired')

bitter arch
#

๐Ÿ‘‹ stepping in

#

You would have to make multiple requests to list by multiple differents statuses

#

status is an enum so it only takes one value

cobalt nexus
#

??