#Suren
1 messages · Page 1 of 1 (latest)
My current subscription creation code looks like this:
Item subscriptionItem = Item.builder()
.setPrice(stripeConfig.getPriceId())
.setQuantity(initialUsageQuantity)
.build();
SubscriptionCreateParams.Builder subscriptionCreateParamsBuilder = builder()
.addItem(subscriptionItem)
.setCustomer(customerId)
.setTrialPeriodDays(stripeConfig.getTrialPeriodDays())
.putExtraParam("trial_settings", Map.of("end_behavior", Map.of("missing_payment_method", "cancel")));
Subscription.create(subscriptionCreateParamsBuilder.build());
Hello 👋
I don't think there's a way to combine trials and pre-payment from the get go.
You'd likely need to take a one-off payment and create a credit note on the customer for the amount you want to charge along with the trial
@sterile latch main problem is the subscription generated invoice "period_start" and "period_end" fields, that always show past month
Do you mean with the credit note? OR after the trial ends?
i dont know what is credit note but i can show you example of what i mean
sure
one minute i need to prepare
cus_NaMW3wO90XBaZd
in this account there is 4 invoices
First one is auto generated 0$ invoice with billing cycle:
Start: 2023-03-24T14:39:51Z | End: 2023-03-24T14:39:51Z
Second is 298$ with billing cycle which is generated with trial billing cycle:
Start: 2023-03-24T14:39:51Z | End: 2023-04-07T14:39:51Z
Third one is also 298$ but it generates as normal billing cycle but for past month:
Start: 2023-04-07T14:39:51Z | End: 2023-05-07T14:39:51Z
And 4th one is like third one...
problem is that stripe by default (or because of my bad configuration) count trial as billable period and always generate invoices in end of each billing cycle for past month, but i want to customer bill for every month before he uses my product in that month
hmm I believe that's how the API is designed to work with a trial period unfortunately. There's no way to prevent $0 invoices from being generated for the trial.
0$ invoice is okay, but can i configure subscription to generate invoice for upcoming month, like in billing cycle start?
You may want to play around with the billing cycle anchor for that. I've not tested the flow myself before so not sure if it'd 100% work but worth a try
https://stripe.com/docs/billing/subscriptions/billing-cycle