#akashpatil7596_api
1 messages · Page 1 of 1 (latest)
👋 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/1232916972702793728
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- akashpatil7596_webhooks, 1 day ago, 18 messages
- akashpatil7596_api, 1 day ago, 22 messages
- akashpatil7596_api, 2 days ago, 18 messages
- akashpatil7596_api, 6 days ago, 29 messages
- akashpatil7596_api, 6 days ago, 33 messages
assign me to someone
Thanks for waiting!
Can you share the example subscription ID (sub_xxx) with the scenario you described?
When proration_behavior is set to none in https://dashboard.stripe.com/test/logs/req_UOVgCAcCYatPkf, no proration will be calculated, i.e. $500 won't be calculated as your request told Stripe not to calculate the proration
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
proration_behavior: 'none' is explained in https://docs.stripe.com/billing/subscriptions/prorations#disable-prorations
Okay but If customer upgrade subscription from $500 to $1000, I want to save $500 as credit balance of that customer
What is this $500 credit balance for? Is it for the customer to pay this amount in the next invoice?
No just want to save the $500.
I'm afraid this is not supported by Subscription API by default. You'd need to adjust Customer Balance by yourself: https://docs.stripe.com/billing/customer/balance
Please note that adjustments sum up to a balance on the customer can be used for future invoices.
So let me ask you a question If a customer buy $500 worth subscription today, and upgrade it by $100 worth subscription today, with proration_behaviour : none, Customer has to pay whole $1000, but what about the $500, where does $500 goes?
When your system told Stripe proration_behaviour : none, this also asks Stripe not to collect this prorated $500. This $500 will never be collected or go anywhere
proration_behaviour: none is to tell Stripe not to collect any proration amount from customer
So this $500 will be gone forever?
If you wish to collect this $500 from customer, then you shouldn't set proration_behavior to none
Can you share what you're trying to achieve here?
Setting proration_behavior to none simply tells Stripe that no proration will be collected, so Stripe follow the instruction accordingly that $500 will not be collected
I want that If customer switch from $500 to $1000, he/she, have to pay whole $1000 and $500 save into their credit balance
As mentioned earlier, adding fund to customer balance as a proration behavior for upgrading/downgrading a Subscription is not supported. You'd need to manage manually by yourself with Customer Balance Transaction API as suggested in https://docs.stripe.com/billing/customer/balance
How can I manage it manually?
I want this flow, can you help me how can I acheieve this?
Let's step back here. If a subscription is upgraded from $500 to $1000, do you intend to ask the customer to pay $500 prorated amount?
No
If a customer upgraded from $500 to $1000, I want them to pay $1000
But I also want to credit the old $500 in their acoount
Could you please tell me a way to achieve this?
Hello
@molten meteor
Thanks for waiting! Discord is busy now and will take time to reply
There is not straightforward way to do this. To achieve this, you will:
- Update the subscription from $500 to $1000 plan with
proration_behaviortonone, and add one-time price toadd_invoice_itemfor one-time charge of $1000: https://docs.stripe.com/api/subscriptions/update#update_subscription-add_invoice_items-price - This will allow the subscription to charge a one-time fee of $1000 and also update the $1000 plan instead of using the pre-built proration by Stripe - After the payment of $1000 is successful, then use Customer Balance Transaction API to create a $500 credit balance: https://docs.stripe.com/api/customer_balance_transactions/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Okay If customer upgraded from $500 to $1000 in one day, Then I have to credit $500 in their account, but If that's not the case,
e.g. subscription is $500/month, customer used it for 15 days and then upgrade to $1000 Then I have to credit something around $250, This $250 , Do I have to count it manually, or is there any feature/API from stripe that will do the calculation for me?
You can preview a proration using Upcoming Invoice API to instead of calculating proration yourself: https://docs.stripe.com/billing/subscriptions/prorations#preview-proration
If a customer buy $500/month and use it for 10 days, How can I get the amount I have to credit for customer? Any API?
Have you checked https://docs.stripe.com/billing/subscriptions/prorations#preview-proration ? Upcoming Invoice API supports calculating the prorated amount that can be used for credit balance
Um yes, but Do I have to hit this API before I upgraded from $500 to $1000, or after?
I'd recommend to do it before with the timestamp that you will be updating the subscription
in price I have to pass new priceID of $1000?
Yes, new price ID
Okay
I bought $500 subscription stimulate the clock for 10 days so the amount now should be 333.33
And then hit this API in the images
And in text file I send you the response, can you tell me where is the amount that are pointing that $500 - 10 days = $300
Can you share the request ID (req_xxx) of your Upcoming Retrieval as well? Here’s how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Hey I think I got it
I think in here I have to set proration_date , after 10 days, then it will count correctly
Yup! subscription_proration_date is the date when you plan to update the subscription
If you plan to credit the unused amount, then yes
Yes! I'd recommend trying it out in test mode to verify that meets your business requirements
Hello
How can I help?
So I did all that
first purchased $500 then $1000, but still the customer has to pay only $500 the remaining amount and not $1000
can you look into subscfription ID please?
Have you done this?
add one-time price to add_invoice_item for one-time charge of $1000: https://docs.stripe.com/api/subscriptions/update#update_subscription-add_invoice_items-price - This will allow the subscription to charge a one-time fee of $1000 and also update the $1000 plan instead of using the pre-built proration by Stripe
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
sub_1P9MsjSDdRXoIRTqi2L2Jh9q
But I can't add one time charge, I have to start a subscription
Stripe doesn't support full amount charge. Your system should add one-time charge of $1000 upon upgrading the plan using add_invoice_items
add_invoice_items should be added in the Update Request: https://dashboard.stripe.com/test/logs/req_4RrmUgcuMcHxkg
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
add_invoice_items has many parameters, which one I have to use and how?
It should be price (price_xxx) of the one-time price of $1000. Or if you should add on demand basis, then price_data can be used
You meadn I have to create priceId for $1000 with one-time-paymenyt and then pass into price parameter?
Yes
Hey , But I have to create a subscription of $1000
Yes! When you update the subscription into $1000 (https://dashboard.stripe.com/test/logs/req_4RrmUgcuMcHxkg), the new plan has already been updated to $1000 plan
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I don't think you are understanding
You said that I have to create priceId for $1000 with one-time payment and no recurring parameter
Then updated the subscription with priceId in add_invoice_items.price
but this won't effect the subscription?
Yes - Since you wish to collect the $1000 without proration, the only way is to add one-time price in addition to update the subscription plan, so that this $1000 can be collected. If not, by only updating the subscription will not collect this $1000
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Yes Hello
The scene is
Customer buys subscription $500/month use it for 15 days, the upgrade to $1000/year plan
I return the unused amount which is around $250 to customer's account,
Bu then I want that customer Have to pay whole $1000 which is not happening
Here's little of my code
I want to move $500/month to $1000/year
what I'm asking basically is do you want to start the new billing cycle right away or stick with the old billing cycle?
so let's say the customer subscribed on the 1st of the month and updated the subscription on the 15th, do you want the new cycle to be from the 15th to the next month's 14th?
or keep it from the 1st to the last of the month?
Yes I want new billing_cycle
If customer update to year plan on 15th of the month It should start from 15th to next year's 15th
I want the 250 to save in customer's credit balance
ok perfect
now that I have all of this info I can guide you through the steps
you can test these in test mode using test clocks
Thanks
if you're not familiar with test clocks you can take a look at this guide https://docs.stripe.com/billing/testing/test-clocks
No I'm familiar with test clocks
ok perfect
so you need to actually know what the proration is first
but not apply it because you want to add it to the customer's balance
so first thing you need to do, is to preview the invoice with the proration happening
Yes and I did that already
I got the unused amount with this.stripe.invoices.retrieveUpcoming and credit it to customer with this.stripe.customers.createBalanceTransaction
But the issue I'm getting is after done all of this, When I update my subscription to $1000, the payment deducted from customer is $500 and not $1000
You got my problem ? @lavish sierra
would you mind sharing the request ID?
I don't know how to, I can share the subscription id though
sub_1P9MsjSDdRXoIRTqi2L2Jh9q
no worries I can take a look
thanku
but for the future here's how you can find a request ID https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
okay
so you're using proration_behavior none, but you're not changing the billing_cycle_anchor
that's why you're just paying half of the month
wait
I might be saying something wrong
give me a second
Yes sure
OK I see now what's happening
you should apply the customer balance after you finish the subscription update
otherwise the amount will be used to cover this invoice
you mean first I update the subscription and then credit the unused amount to customer?
yes
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
Sure, what's the question?
Yes Hello
I have to create price for one time payment and subscription
for subscription I do this
const re = {
unit_amount: dataObj?.amount,
currency: dataObj?.currency,
recurring: { interval: dataObj?.recurring },
product: dataObj.productId,
};
return await this.stripe.prices.create(re);
And for one time payment what should I do?
Same but without recurring
const re = {
unit_amount: dataObj?.amount,
currency: dataObj?.currency,
product: dataObj.productId,
};
return await this.stripe.prices.create(re);
Like this?
Yes
Thanks
Happy to help.