#linups_code

1 messages ยท Page 1 of 1 (latest)

open wraithBOT
#

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

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

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.

little patrol
#

๐Ÿ‘‹
What issue are you facing exactly ? what is blocking you from getting the client secret ?

fringe lotus
#

Returned "$invoice" do not contain client_secret.

#

$paymentIntent = $invoice->payment_intent ?? null;
$clientSecret = $paymentIntent ? $paymentIntent->client_secret : null;

tawny wind
fringe lotus
#

"stripe_version" => "2025-08-27.basil"

open wraithBOT
fringe lotus
#

thank you, checking....

fringe lotus
#

ok.. i think it works now.. but my subscription is infinite. I need to have only 6 cycles. i see parameters for the trial. But i do not see for regular charges, like "cycle count".

#

or just "cancel_at" is parameter ?

drifting lake
#

hey! taking over from my colleague

that's expected, as subscriptions recur indefinitely by default

if you want to limit a subscription to a certain number of cycles, you'll need to integrate with Subscription Schedules

fringe lotus
#

what if i pass "cancel_at" with the future date?

drifting lake
#

cancel_at can be used for this purpose, but it's tricky because you need to set the exact correct timestamp to avoid a prorated final invoice on the subscription

it's more reliable to use Subscription Schedules with a single phase and to set iterations to the number of cycles you want, and set end_behavior: 'cancel'

fringe lotus
#

Ok... lets say subscription is two month, will it be ok, if i pass date now()+60days+1 day (to be sure to cancel after user was charged).

#

or that 1 extra day can mess something?

drifting lake
fringe lotus
#

What if we pass "Cancel_at_period_end" ?

drifting lake
#

Subscription Schedules are the recommended solution for this scenario, specifically the scenario/use-case in the link I shared above

#

cancel_at_period_end only applies to the current period, so you'd have to set that on the subscription after the final billing period starts (i.e. update that property to true after the 6th payment)

fringe lotus
#

ah got it...

#

ok, lets try with subscription schedules.

#

$price = $stripe->prices->create
([
'unit_amount
' => 100000,
'currency
' => 'usd',
'product
' => 'prod_Hh99apo1OViyGW',
'recurring
' => ['interval
' => 'month'],
]);

#

This part is the same, as what you can do on webpage ,creatign subscription product?

#

i mean, this part is run one time and used for multiple customerS?

drifting lake
#

yes that's correct, one product should be used for multiple subscriptions/customers

fringe lotus
#

thank you.. almost done.... now, i need to get client secret and pass back to frontend... on regular subscription i was passing this param: "'expand' => ['latest_invoice.payment_intent'],". But on subscription schedules it doesnt help ?

tawny wind
#

You mean when you create a new Subscription by creating a new Subscription Schedule?

#

There you should fetch the Subscription returned when creating the Schedule, and as discussed above, you can expand the confirmation_secret

fringe lotus
#

yes... but this time i do not get latest invoice from subscriptionSchedule object...

tawny wind
#

That's correct, but there is a subscription ID returned. You will need to retrieve that Subscription and expand the latest_invoice.confirmation_secret

fringe lotus
#

oh, thanks. let me play with it.