#caze_api
1 messages ยท Page 1 of 1 (latest)
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.
- caze_api, 53 minutes ago, 21 messages
๐ 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/1243302234675216506
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
const updatedSubscription = await stripe.subscriptions.update(
purchase?.subscriptionId,
{
items: items,
billing_cycle_anchor: "now",
metadata: { purchaseId: newPurchase.id },
}
);
hello again ๐
NP!
how do I get the difference value right after or right before the difference value?
Can you explain a bit more or share an example? I don't understand what you're trying to get here
Is there a way to get the difference value before this code so I can update in my systems the value paid for each change?
like the different values on the image
What do you mean difference value?
Faturas = Invoices
You mean, see what the payment amount will be?
yes
yes*
If I pay on the first plan 12 USD, and on the next one 36 USD, the differente will be 24 USD
So I would bay 12 USD on the first one and 24 USD on the second one
or something like that
Getting this ahead of time is possible but a bit trickier, I'll explain afterwards first
You can use expansion in the Subscription update request to get the full latest_invoice in the response and inspect the latest_invoice.amount_due for example:
https://stripe.com/docs/expand
expand: ['latest_invoice']
Ooh, thanks! I'll try that, thanks a lot!
Before you make the update, you can using the invoice preview API to specify your customer, subscription and revised items to get a preview of the invoice that would get created if you update the subscription:
https://docs.stripe.com/api/invoices/create_preview
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
This amount_due is a number, right? Can this number be negative if the amount of the second subscription is smaller? Is this number the amount in smaller units or the full price of the currency?
๐ Stepping in for my teammate
amount_due is an integer, yes. It won't be negative ,no, but might be less than what it was for the first invoice depending on the items you include in the subscription update.
Is this number the amount in smaller units or the full price of the currency?
Depends on the currency you're using. We list what we call "zero-decimal currencies" here: https://docs.stripe.com/currencies#zero-decimal
as well as three-decimal currencies: https://docs.stripe.com/currencies#three-decimal