#kral
1 messages · Page 1 of 1 (latest)
you can use a tiered price https://stripe.com/docs/products-prices/pricing-models#tiered-pricing
yeah but is there a simple way to just checkout to a sub
and I change the price & quantity dynamically
- unit price
I see that a competitor is doing this
im not sure if its tiered
tiered means that each tier has a unit price
yes i know
but it would take me 5 hours to come up with those tiers
range is 150 to 10000
you can also look at usage based https://stripe.com/docs/products-prices/pricing-models#usage-based-pricing
thats not what im looking for
i just want to set a unit price and quantity for a sub
on the fly
is this not possible
you can use price_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
can I do this with a checkout
yes
can you give me an example bro
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
let me know if you need any more help
Reason: please mind your language. you can take a look at the #📖rules if you need a quick reminder of how to behave on the server
how about you give me a proper answer
instead of linking me back to api docs
this is unbelievable
If you need help here, I refer you to #1 in #📖rules
Let me know once you've read that and you want to continue with us helping you
I have. However you can it's ridiculous that I had to talked to a rep for 6 minutes
and got an irrelevant link back
What I think is ridiculous is your condescending attitude and use of profanity
If you're prepared to be more polite and have some patience whilst we help you and other users, then I can try and help you with your questions
yes please
Great, let's start again. Help me understand your issue? What have you tried so far?
function customPrice(input) {
var priceMax = 0.66;
var priceMin = 0.49;
var slider_end = 1200;
var slider_start = 150;
if (input > slider_end) {
return priceMin;
} else if (input >= slider_start && input <= slider_end) {
var range = slider_end - slider_start; // range of input
var difference = input - slider_start; // difference from input to 1200
var priceRange = priceMax - priceMin; // range of price
var priceDifference = (difference / range) * priceRange; // calculate price difference based on input difference
console.log(priceMax - priceDifference)
return priceMax - priceDifference; // subtract price difference from max price to get price based on input
}
}
this is my calc
to set a custom price
so I need to use price_data for sure
I'm just at a loss at how this would work
Ok, great. Which part isn't working as you expect?
I still have no clue how to make the stripe work with this
do I make a product with a random price then use that product ID with the checkout + price_data
what happens when this is checked out and i get a webhook
Ok, one question at a time
Do you know which of our payment UIs you want to use? For example, there's hosted UIs like Checkout or you can build a custom flow with Elements
checkout definitely
Then yes you can create the Price (which is what your customers subscribe to) inline when you create the Checkout Session
Have you written any code to create a Checkout Session yet?
what happens to price_ids in this case
in the backend
does every customer get a random price_id
-- Stripe data
"stripeCustomerId" text,
"stripeSubscriptionId" text,
"stripePriceId" text,
"stripeSubscriptionStatus" text
I'm mostly stressed about managing these custom plans long-term
is there a way to test this against webhook
with stripe cli
Yes, every time you use price_data we will create a new Price object (with a unique price_xxx): https://stripe.com/docs/products-prices/pricing-models#inline-pricing
But that might not be appropriate for your pricing model. Can you help my understand that a bit better?
There is, but we'll get to that
For example, do you plan on reporting usage? In the screenshot it references 'credits'
reporting usage? no
simply put they adjust the slider to get their custom quote for the credits
they sub to this plan
then every month these credits are added to their acc
So the credit price is lower as the # of credits increases?
from competitor's site
yes
and it's a basic graph algo
so there's like 100s of tiers in reality
it may be that my competitor is using tiered pricing
but I want more flexibility
Tiered pricing (https://stripe.com/docs/products-prices/pricing-models#tiered-pricing) is suited for this use case, what flexibility is it missing?
For example, when you create the session you'd pass the quantity value that corresponds to the value of you selector: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-quantity
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
all the way down to 0.4~
Well you can configure the tiers that way. Sure would take some work, but it's better than having a unique Price object per subscriber as you described
const session = await stripe.checkout.sessions.create({
customer: stripeCustomerId,
payment_method_types: ["card"],
subscription_data: {
// Add a trial period for this subscription
//trial_period_days: 14,
// Uncomment to add a coupon code from request body
//coupon: body.coupon
},
line_items: [
{
price_data: {
currency:'USD',
product:'prod_OIVgCdVSlv8NRl',
unit_amount:100,
recurring:{
interval:'month'
}
},
quantity: 100
},
],
mode: "subscription",
success_url: "http://localhost:3000/success",
cancel_url: "http://localhost:3000/fuck",
});
like would this cause me a headache later on?
due to unique price ids
There's definitely downsides yep as they're not re-usable
could you elaborate on the downsides
Well they're immutable for start so you couldn't update them
Also may skew your Billing metrics (like MRR reporting) as everyone would be subscribed to a different plan
Definitely something for you to consider, but either of those approaches will work for you
Also will simplify your front-end logic as you would defer the pricing calculation to us
can you also help me understand how I can have 2 separate accounts
based on the same company
You can just create a new account from your Dashboard
yeah but that asks me to add a new company
as well
do i just fill in the same information
Yeah should be fine