#ryjin_api

1 messages · Page 1 of 1 (latest)

fervent perchBOT
#

👋 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/1393151390574055424

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

verbal root
#

Here's more info.

This is the line that throws an exception

    public async Task<Dictionary<string, string>> GetPaymentIntentMetaData(string paymentIntentId, string account)
        => (await new PaymentIntentService().GetAsync(paymentIntentId, requestOptions: new RequestOptions
        {
            StripeAccount = account
        })).Metadata;
#

I'm getting this:

Unrecognized request URL (GET: /v1/payment_intents/). If you are trying to list objects, remove the trailing slash. If you are trying to retrieve an object, make sure you passed a valid (non-empty) identifier in your code. Please see https://stripe.com/docs or we can help at https://support.stripe.com/.

gloomy tendon
#

hi there!

verbal root
#

Hello!

#

Is it possible to see whether it's the account or the paymentintentid that is missing here?

gloomy tendon
#

which event are you listening for to retrive the PaymentInent? checkout.session.completed?

verbal root
#

correct

gloomy tendon
#

and all Checkout Sessions are in mode: "payment"?

verbal root
#

This is how I create checkout sessions:


    public async Task<string> CreateCheckoutSession(IEnumerable<StripeProduct> products, CurrencyCode currency, string connectedAccountId, string orderId, SupportedLanguages customerLanguage, int? expirationTime)
    {
        var options = new SessionCreateOptions
        {
            LineItems = await CreateSessionLineItems(products, currency, connectedAccountId),
            UiMode = "embedded",
            Mode = "payment",
            ReturnUrl = $"{_baseUriProvider.GetBaseUri(BaseUriOptions.Anigma)}/return?session_id={{CHECKOUT_SESSION_ID}}",
            PaymentIntentData = new SessionPaymentIntentDataOptions
            {
                Metadata = new Dictionary<string, string>
                {
                    {
                        StripeMetadataKeys.OrderId, orderId
                    },
                    {
                        StripeMetadataKeys.Source, "regular_checkout"
                    },
                    {
                        StripeMetadataKeys.CustomerLanguage, customerLanguage.ToString()
                    }
                },
            },
            Currency = currency.ToString().ToLower(),
            ExpiresAt = expirationTime is { } ? DateTime.UtcNow.AddMinutes(expirationTime.Value) : null
        };

        var requestOptions = new RequestOptions
        {
            StripeAccount = connectedAccountId
        };

        var session = new SessionService().Create(options, requestOptions);

        return session.ClientSecret;
    }
gloomy tendon
#

got it. then yes I see mode: "payment". and you are creating the Checkout Session directly on the connected account

verbal root
#

There is no other code to create checkout sessions in the entire app as far as I'm aware

gloomy tendon
#

do you have a failed API request (req_xxx) when trying to retrieve the PaymentIntent?

verbal root
#

sec let me show you the evnts

#

Don't think I'm logging more than that unfortunately

gloomy tendon
#

wait, the Checkout Session you shared has amount_total: 0.

#

if there's nothing to pay, then as expected there will be no PaymentIntent

verbal root
#

Hmm, how can they even get to the checkout session? Stripe doesn't accept anything under a certain amount ,no?

gloomy tendon
#

there are three prices in that Checkout Session, all are for 0 SEK.

fervent perchBOT
gloomy tendon
#

so on the Checkout page, the user just had to enter their email (no payment method needed).

gilded jay
verbal root
#

cs_live_a1PGCxhnjy89vfY9XRkRdPbsJtiwm9gA5UMMiAsYiy4jM6IUBsW8aPEKZr

cs_live_b13tyOUR5e2sk1pD5onbA7H90M3gXlvJK54XTdNDTdZdTVEhhQ8dgZt34l

do these have the same problem?

gilded jay
#

If you're passing the same zero-amount Price objects, sure

verbal root
#

That I have no idea of. I'm trying to see if this is a recurring problem in how I calculate prices

gilded jay
verbal root
#

if those 2 also have a total amount of 0 then I guess its business logic in my app

gilded jay
#

But yes, same issue

verbal root
#

so let me just understand, you're saying every item in those checkout sessions were 0?

#

not just one?

gilded jay
#

So in those scenarios when the session is completed, payment_intent will always be null. You need to account for that in your code/logic

#

i.e. don't make the PI retrieval call if it's null

verbal root
#

Right yeah, I think I've found the issue in my code, just not entirely sure how the hell it can come out to 0 but I'll see if I can solve it. Thanks a lot

verbal root
#

How do I searc hfor eventids?

#

in the stripe dahsboard

#

like this one cs_live_b1QE0L5lypRr6pasxfWDMJc1KC7tiwMQEpVjZYwYe9yZGuuBbPK9gaz6XU

gilded jay
#

That's not an Event ID (evt_xxx). Did you try just putting it in search bar? It may not work as Checkout Sessions are really represented in the Dashboard

verbal root
#

sorry session Id i assume?

gilded jay
#

Yes that's a session ID

verbal root
#

can i search for customre names here in teh dashboard?

#

or session id

gilded jay
#

Have you tried?

verbal root
gilded jay
#

What are you trying to find exactly?

#

Works for me

verbal root
#

no cost orders just redirects me to dashoard. is it cuz i have to be on a specific conneted account?

gilded jay
#

Well yes if it's created on a connected account like cs_test_b1rxMola5fTx4OP01wTOPUnsOgvjCk1lpXR0N07DZcBlljFcjRoQnd2b2t then you need to be on the Dashboard in the context of that account

verbal root
#

Also, checkout.session.completed occurs almost immediately, right? there's not much delay from stripe to my webhook?

gilded jay
#

Yep, should be ~immediate

verbal root
#

this redirects me to the dashboard

#

i just want to see the session id so i can check something

gilded jay
#

Which ID are we look for here?

#

I'd guess acct_1PRsUyQHwUK2JlBY doesn't have any zero-cost orders so the Dashboard route is inaccessible
cs_test_b1rxMola5fTx4OP01wTOPUnsOgvjCk1lpXR0N07DZcBlljFcjRoQnd2b2t exists on acct_1QRYaW6UcxwQ9gqz