#cj_best-practices

1 messages ยท Page 1 of 1 (latest)

storm tideBOT
placid sableBOT
#

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.

storm tideBOT
#

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

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

opaque flicker
#

Hey this is what my invoice shows currently

rose token
#

Hi, what specifically are you looking for on the invoice that is not showing?

opaque flicker
#

I wanna the item lines to show something like
Room rental: $100
Service fee: $5

or somehow indicate that $5 portion is the service fee in the invoice

#

I tried updating the invoiceItems description but doesn't work

rose token
#

I see, when you create the CheckoutSession, are toy passing two price ids? One for the room rental, and the other for the service fee?

opaque flicker
#

just one at the moment

#

Do you recommend passing 2 - one for the room fee and one for the service fee?

#

untimately my goal is to just indicate in the invoice that $5 is service fee

rose token
#

Yes, with the above set up of having two separate prices, I would.

#

Can you try this?

opaque flicker
#

oh let me try one min

#

ah it says Generate a post-purchase Invoice for one-time payments. mine is subscription

#

will it still work?

#

i.e. I'm using subscription_data when creating the session

#

nah doesn't allow me You can only enable invoice creation when modeis set topayment. Invoices are created automatically when modeis set tosubscription, and are unsupported when set to setup. To learn more visit https://stripe.com/docs/payments/checkout/post-payment-invoice

rose token
opaque flicker
#

let me try

rose token
#

After testing the custom fields on the invoice, that is not what you'd want anyways. Also, it is not applicable since you're using subscriptions mode.

opaque flicker
#

are you referring to the Have you tried setting the description?

rose token
#

Nope, the custom fields - I just tested this for one time payment.

opaque flicker
#

I see

#

I tried setting the description. It doesn't seem to change anything on the generated invoice

#

I can see the description from the portal but nothing changed on the invoice

rose token
#

yes, same on my end. Let me test one more thing

opaque flicker
#

thannk you

rose token
#

After testing, if you want to show 2 line items, you would need to pass two price ids. One for the service fee, and the other for the rental fee.

However, if you're looking for manage prices with one line item, you could include the service fee in the description of the product id when you create it as shown on my test:

opaque flicker
#

I see hmm...

rose token
#

So for your breakdown, I think the best option is to pass two prices

opaque flicker
#

ok so this is what I'm thinking

rose token
opaque flicker
#
  1. Create a product called Service Fee
  2. Add price on that product of $5
  3. Add both prices to the session.create
rose token
#

Yes!

opaque flicker
#

The question I have with this approah is

#

is with step 2

#

Whenever I generate a invoice, they all have different service fee

#

which means I'll need to create another price everytime

#

is this a bad pratice?

#

In long term, this Service Fee product is going to have many many prices attached to it (i.e. $1 fee, $2 fee... etc)

rose token
opaque flicker
#

I think I'm ok with making an extra call, I'm just worried about the Service Fee product (from step 1) having many many prices

rose token
#

If that is what your business requires, that is fine.

opaque flicker
#

even if I use https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price_data its ganna create a prices right?

#

is there a way to avoid duping same price?

#

i.e. if there is already a prices of value $5, is there way to find this one instead of creating another $5

rose token
#

Yes, it would create a price object. No, there is not a way.

#

I think the best approach is to create the Service Fee product, add the specific prices so you can reuse them

opaque flicker
#

It's % of whatever price the host sets so will be a very wide range :S

#

is there stripe limit on how many prices can exist on a product?

rose token
#

Yeah, on your code you can look through your database and match the amount for the prices, then pull in that price id to charge for the service fee.

#

No, there is not

opaque flicker
#

ok - just to triple triple check before I commit to the route

#

there is no way to put some custom text on the generated invoice created via session.create?

rose token
#

There is not I'm afraid.

opaque flicker
#

thank you ๐Ÿ™‚ - if I use mode of payment, is this possible?

#

or same story as subscription

rose token
#

It would be similar to the Subscriptions. However, the customer fields I was referring to can be passed but it would now show a breakdown like you imagined. Here is my test with custom fields. You can see that information is on top left side of the invoice.

opaque flicker
#

I see... thank you so much ๐Ÿ™‚ I'll take your advice and create a seperate item

opaque flicker
#

is there a way to make the Rent fee be the first line item?

rose token
#

There is not a way to change the ordering of the line items I'm afraid.