#mfoley_docs

1 messages ยท Page 1 of 1 (latest)

desert shuttleBOT
#

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

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

eternal sedge
#

For instance, let's say my company is a house-cleaning service. Our pricing model is that the customer purchases 1 cleaning, and we bill them based on how many square feet we had to clean. Does Stripe's pricing models support this?

long coral
#

Yep, our standard prices should allow for that. Finding our docs on pricing models that may be helpful for you here

eternal sedge
#

Ok, but the docs I've been able to find primarly talk about subscription-based pricing. Can you refer me to an example of the pricing I'm trying to implement?

#

Or can you point me to pricing model docs that aren't subscription based or for recurring payments?

long coral
#

Two things that may be helpful for you depending on the specifics of how you are charging here are transform_quantity which lets you set a price based on every X units and unit_amount_decimal which allows you to set a price in units lower than cents.
https://docs.stripe.com/api/prices/create#create_price-transform_quantity
https://docs.stripe.com/api/prices/create#create_price-unit_amount_decimal

eternal sedge
#

Thanks! Looks like I have more to investigate.

#

One more question: how do I programmatically create a Price that is one-off? Your docs only provide examples of how to create recurring Price objects via the API.

long coral
#

You can leave out the recurring parameter. Unless you specify a recurring interval we make a one-time price

eternal sedge
#

Ok, thanks!

#

Hi Pompey! I just tried to create a Price with the following params:

params := &stripe.PriceParams{
        Currency: stripe.String(string(stripe.CurrencyCAD)),
        Tiers: []*stripe.PriceTierParams{
            {UnitAmount: stripe.Int64(45), UpTo: stripe.Int64(1_500)},
            {UnitAmountDecimal: stripe.Float64(0.03), UpTo: stripe.Int64(10_000)},
            {UnitAmountDecimal: stripe.Float64(0.023), UpTo: stripe.Int64(30_000)},
            {UnitAmountDecimal: stripe.Float64(0.016), UpTo: stripe.Int64(100_000)},
            {UnitAmountDecimal: stripe.Float64(0.013), UpToInf: stripe.Bool(true)},
        },
        ProductData:   &stripe.PriceProductDataParams{Name: stripe.String("Cleaning Test")},
        TiersMode:     stripe.String(string(stripe.PriceTiersModeGraduated)),
        BillingScheme: stripe.String(string(stripe.PriceBillingSchemeTiered)),
    }

However, I get this error when I try to create the price:

Prices with type=one_time are not supported with tiered billing

#

Does this mean that I cannot use tiered pricing for a one-off charge (ie, a single house cleaning)?

long coral
#

Unfortunately, yes. My apologies I thought that our docs specified restrictions like that

#

Are you planning on using these prices with our hosted Checkout page? Or with our Invoices? Or with some other Stripe surface that works with Price objects? I can look in to whether there are workarounds that are more specific to what you are using

eternal sedge
#

Our initial use case was to use Invoices - we currently compute the prices with our own business logic, and then supply the prices + products as line items for the invoice. We are just investigating whether we can leverage Stripe for more uses

#

I actually have some questions about handling credits for invoices via Stripe (as this would greatly simplify our integration), but I need to do some more reading first ๐Ÿ™‚

long coral
#

Gotcha, unfortunately I am not seeing a way for Stripe to do the calculation here for you. I think you would basically need to create a separate price for each of those tiers, calculate how much quantity you are charging at each tier, and create an invoice item for each quantity at each price

eternal sedge
#

Yeah, that just won't work for us. Thanks for your help!