#linups_code
1 messages ยท Page 1 of 1 (latest)
๐ 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.
- linups_code, 4 days ago, 29 messages
- linups_code, 6 days ago, 7 messages
๐
What issue are you facing exactly ? what is blocking you from getting the client secret ?
Returned "$invoice" do not contain client_secret.
$paymentIntent = $invoice->payment_intent ?? null;
$clientSecret = $paymentIntent ? $paymentIntent->client_secret : null;
Which API version are you using? In newer versions, you should check the confirmation_secret: https://docs.stripe.com/api/invoices/object#invoice_object-confirmation_secret-client_secret
"stripe_version" => "2025-08-27.basil"
thank you, checking....
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 ?
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
what if i pass "cancel_at" with the future date?
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'
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?
yes setting cancel_at to a future date outside of the current billing period will always generate proration
https://docs.stripe.com/api/subscriptions/object#subscription_object-cancel_at
What if we pass "Cancel_at_period_end" ?
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)
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?
yes that's correct, one product should be used for multiple subscriptions/customers
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 ?
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
yes... but this time i do not get latest invoice from subscriptionSchedule object...
That's correct, but there is a subscription ID returned. You will need to retrieve that Subscription and expand the latest_invoice.confirmation_secret
oh, thanks. let me play with it.