#jacob_api

1 messages ยท Page 1 of 1 (latest)

tranquil shellBOT
hearty isleBOT
#

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.

tranquil shellBOT
#

๐Ÿ‘‹ 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/1237157818570899587

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

smoky vine
#

Lemme know if trial_period_days is not workable with existing stripe subscription prices

regal token
#

it's returning a 'subscription not found' error
Do you have more context here?

#

What's returning the error exactly?

smoky vine
#

{
"message": "Subscription bcccce7d-df56-4566-b04d-9abfc558dbd1 not found",
"error": "Not Found",
"statusCode": 404
}

#

The embedded checkout flow.

#

This error is returned from trying to retrieve the client secret

regal token
#

Do you have a request ID for that error?

smoky vine
#

I don't actually. It doesn't seem to be even adding a log in the developer Stripe tab

#

But if I initiate without the free trial argument it runs just fine as seen here: req_kww62jKZQ6GoAc

regal token
#

I can confirm that adding a trial works just fine

#

Let me dig into the request you shared

smoky vine
#

Ok cool.

regal token
#

Hm, can you share more of your code? Do you recognize what the ID bcccce7d-df56-4566-b04d-9abfc558dbd1 refers to?

smoky vine
#

if (freeTrialDays > 0) {
return await this.stripe.checkout.sessions.create({
payment_method_types: ['card'],
line_items: [
{
price: priceId,
quantity: 1,
},
],
subscription_data: {
application_fee_percent: platformFee,
on_behalf_of: connectedAccountId,
trial_period_days: freeTrialDays,
transfer_data: {
destination: connectedAccountId,
},
},
mode: 'subscription',
ui_mode: 'embedded',
return_url:
this.configService.get<string>('BASE_URL') +
/checkout/return?session_id={CHECKOUT_SESSION_ID},
});
}

smoky vine
#

Let me take a look

#

I have absolutely no idea where that's coming from.

#

Only difference in working code and not working is that trial_period_days line

#

Is trial_period_days the correct field to use if I want to add a free trial to an existing subscription price?

regal token
#

Yes, it is.

#

I'm doing something like this and it works:

  cancel_url: "https://example.com/cancel",
  line_items: {
    0: {
      price: "price_abc",
      quantity: "1",
    },
  },
  mode: "subscription",
  subscription_data: {
    on_behalf_of: "acct_123",
    transfer_data: {
      destination: "acct_123",
    },
    trial_period_days: "3",
  },
  success_url: "https://example.com/success",
}```
#

Are you sure it's that part of your code that is returning the "Subscription bcccce7d-df56-4566-b04d-9abfc558dbd1 not found" message?

smoky vine
#

Hmm

#

Lmaooo. Figured it out, somehow there was an edge case where the subscription being selected on the client would update the id being passed to the initiate checkout endpoint. In this case, a database id was being used rather than a Stripe Price ID.

#

Apologies, appreciate you checking this out ๐Ÿค