#ayuan-checkout-subscription

1 messages · Page 1 of 1 (latest)

chrome sedgeBOT
#

Hello! We'll be with you shortly. 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.

  • ayuan, 3 days ago, 27 messages
vital aurora
#

HI 👋

So are you saying you want one of the line items to bill one-off?

split snow
#

yes, but it also needs to occur for every billing cycle

#

so subscription recurs. second invoice should also contain 2 line items. one billed across period, one "one off"

vital aurora
#

Sorry but that doesn't make sense

#

You mean you want one item to bill at the start of the billing period and one to bill at the end?

split snow
#

no, i want one to bill fully at the start of the billing period, and one to bill over the course of

#

charge 5 bux now, charge 15 bux over the month.
at end of month, charge another 5 bux immediately, and charge another 15 over the next month

vital aurora
#

What do you mean "over the month"? Can you describe exactly how often your would want a customer to be charged?

split snow
#

customer gets charged once every month
but one line item is calculated as billed over the month. so if the customer cancels, they will get prorated refund on that line item
but one line item is calculated as billed once at start of month. so if customer cancels, they will not get a refund on that line item

vital aurora
#

Okay those are two different billing schedules. I don't know that we can effectively model that. It isn't something you would configure on the Checkout Session itself but rather when you change the Subscription (which is when prorations are calculated).

chrome sedgeBOT
split snow
#

so when i do this through dashboard, i get the correct behavior by adding two products to a subscription. one is a one-off price interval one-time. another is a recurring price interval every month.
Let's say i don't want to use those specific products via my api. can i create a one-off price when creating the subscription via stripe checkout?

vital aurora
#

That one-off price is only billed for the first invoice. That's how "one-off" prices work.

scenic coral
#

ayuan-checkout-subscription

split snow
#

sorry. i want to add a 'price' to a subscription with a 'type = one_time'

#

along with a 'price' to a subscription with a 'type = recurring'
it seems that by default, items configured in stripe checkout api when mode is subscription get type=recurring

scenic coral
#

And this works totally fine with Checkout

#

You can create a Checkout Session and have two line items. One is for a recurring Price, will be billed on a recurring basis. One is one-time and will only be billed once on the first Invoice

split snow
#

oh ok. does this work if i don't pre-create/reference the price?

#

this gets into the weeds, but the one-time is a tax charge. i need to display the tax rate on the invoice. because of that, i can't? reference an existing price because i need the display name to display a different percentage each time. so that's why i was doing something like ```
line_items: (
subscriptionItems.map((item) => {
return {
...item,
plan: undefined,
price: item.plan,
};
}) as Stripe.Checkout.SessionCreateParams.LineItem[]
).concat(
taxItems.map((item) => {
return {
price_data: {
currency: item.price_data.currency,
unit_amount: item.price_data.unit_amount,
product_data: {
name: Sales Tax (${taxRate.toLocaleString(undefined, { maximumFractionDigits: 2 })}%),
},
},
quantity: 1,
};
}),
),

scenic coral
#

Honestly I don't understand this code at all right now unfortunately. But you as the developer need to pass 2 separate line items with the right Price or price_data yes

split snow
#

in the api, i don't see any way to set "type = one_time" on the price data object

scenic coral
#

if you don't pass recurring then it will be "one time" automatically

split snow
#

i'm not seeing this be true.

scenic coral
#

I mean it is absolutely true. If you give me a clear exact example I can show you what you did wrong.

split snow
#

ok. gimme a sec. in a meeting. will try to repro for you. thanks for the eyes, koopajah

split snow
#

hihi
here's the checkout session create payload

{
core-api:   customer: 'cus_PdQofYiy2mGJ04',
core-api:   subscription_data: { trial_period_days: undefined },
core-api:   payment_method_collection: 'always',
core-api:   line_items: [
core-api:     {
core-api:       plan: undefined,
core-api:       quantity: 1,
core-api:       price: 'academic-individual-annual-420'
core-api:     },
core-api:     { price_data: {
core-api:     currency: 'usd',
core-api:     unit_amount: 5460,
core-api:     product_data: { name: 'Sales Tax (13%)' }
core-api:   }, quantity: 1 }
core-api:   ],
core-api:   cancel_url: 'http://localhost:3000/billing_details',
core-api:   success_url: 'http://localhost:3000/account/billing?checkout-session=completed',
core-api:   mode: 'subscription',
core-api:   expires_at: 1708983293,
core-api:   custom_text: {
core-api:     submit: {
core-api:       message: 'Applicable sales tax will be added to the recurring charge per year'
core-api:     }
core-api:   },
core-api:   metadata: { avaTaxSaleInvoices: '6214ae37-5e99-49e2-a316-5892f53928a1' }
core-api: } 
#

invoice screenshot - tax is displayed as over a period

scenic coral
#

It being displayed over a period isn't really saying anything about this Price being recurring in any way right?

#

Like the way you configured the code, that second line items will not be added to future Invoices, only the first one will because it's recurring annually

split snow
#

hmm. you're right. let me think
thanks

chrome sedgeBOT
split snow
#

ok. you're right but is there a way to hide the displayed period?

#

finance is complaining that customers are complaining xD

sand wolf
#

Good question, as far as I am aware it is not possible to hide those dates but I will double check and get back to you

#

Yeah unfortunately not seeing a way to do this. If you write in to support you can raise this as a feature request but for now I think you would have to generate your own invoice PDFs to not have the date shown like that.

split snow
#

ok because at some point, our invoices looked like this
that sales tax was referenced by product id to prod_NC9AUiJWoNPy0J

sand wolf
#

Interesting, I am not immediately sure why we made that change. Also not seeing it in the API version changelog notes, so I am not sure when this behavior change happened