#Stone.D-

1 messages · Page 1 of 1 (latest)

orchid moat
languid forge
#

Yes, That's customer portal not for Subscription.

#

I need a link to manage Subscription.

orchid moat
#

It's the Customer Portal allows the customer to manager their Subscriptions

languid forge
#

It looks like all of Customer's Subscriptions, Could specify subscription to manage?

orchid moat
languid forge
#

Could i set configuration to prohibit to downgrade?

orchid moat
#

No, not that specifically. You can achieve somewhat similar behavior by limiting the price id can be updated to, in a product

languid forge
#

Thanks,

#

Could i custormize prorations rules?

orchid moat
#

There is a parameter on the link above!

languid forge
#

Could i custormize prorations calculate rules? e.g. calculate without factor remaining days. i.e. from $1 to $5 , charge customer $4 .

orchid moat
#

It would be completely disable Stripe proration, and implement a proration calculation logic yourself, and charge your customer on a separated Invoice Item

languid forge
#

Ok, Could i modify invoice on webhook invoice.upcoming event?e.g. add More invoice item to charge customer

orchid moat
languid forge
orchid moat
#

Then write your own logic by calculating the price diff, then create an Invoice Item like the above link

languid forge
#

Could this Invoice append to the Invoice of next cycle subscription invoice?

#

Like "id": "evt_1LV9i8IXF5VHSVPpXung6V24", How to append an invoice Item on it?

orchid moat
#

Yes. It's an Invoice Item and meant to be added to the next billing cycle Invoice:

These one-off items are added to the next invoice created for this customer. To make sure this is added to a specific subscription, use the optional subscription parameter to apply it to that subscription.

languid forge
#

If i do that, does the invoice of next of next cycle include this invoice item appended?

orchid moat
#

Yes

languid forge
#

That's not what i want.

#

What i want is The invoice of next of next cycle does not include this invoice item appended.

#

Could i only modify this invoice in the upcoming.invoice?

orchid moat
#

Sorry I may misunderstand your previous question, do you mean "next of next cycle"? No the added item will be in the next cycle, aka the upcoming Invoice

reef summit
#

If you add a manual invoice item, or make a change that creates proration items, that item "floats" on the customer. The next invoice for that customer (whenever it is) will pull in that floating item and consume it and charge for it. It's pretty simple.

languid forge
#

Sorry, how to add add a manual invoice item in a invoice returned in the upcoming.invoice?

languid forge
#

Is it?

reef summit
#

is what what?

#

use a full sentence please.

languid forge
#

Is it implemented with one of the two options of Invoice Item?

#

https://dashboard.stripe.com/apikeys// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
const stripe = require('stripe')('sk_test_51IqYnZIXF5VHSVPpqQ3KhEWa4ckfLMRIvMryPLUlwfB6JHChDmTxTZ8g2SIdeOeTDIKD8fBrfJgkv4EC42KZ101r008EYvLkWL');

const invoiceItem = await stripe.invoiceItems.create({
price: 'price_CBb6IXqvTLXp3f',
customer: 'cus_4fdAW5ftNQow1a',
invoice: 'xxxxxxxxxxxxxx'
});

reef summit
#

I don't understand your question I'm afraid.

#

what are you stuck with?

reef summit
#

yep, done.

#

there's example code there, are you stuck with some of it?

languid forge
#

Yes, The sample code does not explain how to associate an Invoice or subscription

reef summit
#

what does "associate" mean? What happened when you actually tried to run the code?

#

like the sample is really simple and complete, I don't know what is blocking you

languid forge
#

Should it be like this: const invoiceItem = await stripe.invoiceItems.create({
price: 'price_CBb6IXqvTLXp3f',
customer: 'cus_4fdAW5ftNQow1a',
invoice: 'xxxxxxxxxxxxxxx'
});

Add the invoice id option?

reef summit
#

you don't have to, since it works the way I said earlier where the item floats

#

If you add a manual invoice item, or make a change that creates proration items, that item "floats" on the customer. The next invoice for that customer (whenever it is) will pull in that floating item and consume it and charge for it.

#
const invoiceItem = await stripe.invoiceItems.create({
  price: 'price_CBb6IXqvTLXp3f',
  customer: 'cus_4fdAW5ftNQow1a',
});

adds a floating item and that item will be automatically included in the next invoice when it happens.

languid forge
#

InvoiceItem in sample just work for customer, But I need more precise control over Invoice or subscription.

Because in my scenario, one user may subscribe to multiple

reef summit
#

then yes you can pass the optional subscription or invoice parameters too, absolutely. You looked at the API reference and took a screenshot of it, which explains it in detail.

languid forge
#

Thanks you two.

#

I will test it.

languid forge
#

About code:
Map<String, Object> params = new HashMap<>();
params.put("customer", "cus_MDab9HWGlImsW1");
params.put(
"price",
"price_1LV5lMIXF5VHSVPp0mQjDzHR"
);

InvoiceItem invoiceItem =
InvoiceItem.create(params);

Can the price use a temporary price generated temporarily?

reef summit
languid forge
#

It ok tested.

#

Picture A is the invoice format I tested, and I want to get the format of picture B. How to achieve this?

reef summit
#

the second screenshot comes from updating the subscription in a way that generates proration.

#

so do that (as you already did?) instead of creating manual invoice items for custom amounts if that's what you want.

languid forge
#

Below the date of each item in picture A is a product name (I need a detailed description of the item, but this is not available). In Figure B, the description of the item is on the date....

reef summit
#

I mean your screenshots are two different things.

languid forge
#

Picture B is what I want

reef summit
#

One is from your Dashboard, the other I think is a PDF from the Invoice

#

I know, you did say that. Like I said, picture B is what gets generated when you use our proration feature. If you don't use it then you get other results.

languid forge
#

Yes,you are right.We observe the B chart, his spread is not calculated according to the daily calculation method of Prorations

#

Please reference the each Date in invoice。

reef summit
#

I can't understand you sorry, language barrier.

#

this thread has been ongoing for 4 hours now, can I ask you to take some time to experiment with the API, read some docs and come back later?

languid forge
#

Our B picture is different from the Invoice format in Prorations mode. The date of each entry in B picture is the same. In fact, I modified the subscription package a week ago.

reef summit
#

sorry, it's exhausting and unfair to us to just ask so many questions here on this channel for hours

sleek sparrow
#

@languid forge let's continue chatting here

languid forge
#

ok

sleek sparrow
#

it's not possible to change the format of the invoice template if that's what you're looking for

languid forge
#

This invoice may be just an appearance. The logic behind it is how to upgrade Subscription and achieve: the price difference is not calculated according to the day (Prorations calculation method), only the difference between the two packages is calculated.
e.g Subscribe to $5 package from August 1st to September 1st, upgrade to $10 package on August 15th, the difference should be $10-$5

sleek sparrow
#

combine proration_behaviour: "create_prorations" with billing_cycle_anchor: "unchanged" to achieve what you're expecting

languid forge
#

Never try to set billing_cycle_anchor: "unchanged"

#

Ok, Let me try it.

sleek sparrow
#

this will make the prorations take place without having to change the billing cycle

languid forge
#

The differece is calculated by Prorations. as pic, Upgade from $5 to $15

#

The difference is $10 I want

sleek sparrow
#

do you have the subscription update request id so I could look at it please?

languid forge
#

subId:sub_1LV9YkIXF5VHSVPp7kWEUZeU and evtId of customer.subscription.updated in webhook evt_1LVBzgIXF5VHSVPpoZrNJfuU

#

What's the request id, how to get?

sleek sparrow
languid forge
#

req_WGNcInluuT1OyZ

sleek sparrow
#

yes I found it

#

could you please try the same request but instead of create_prorations use always_invoice?

languid forge
#

Yes

#

req_5KFPNKZ1FyfFZS

languid forge
#

From $1 to $5, Should it charge $4.

reef summit
#

what do you mean exactly?

languid forge
#

The invoice format looks very similar to pic B, but the difference calculation is still calculated according to Prorations, not a simple subtraction

reef summit
#

yep, since you're using our proration logic, so of course it is :"calculated according to Prorations".

#

we don't do a 'simple subtraction', that's not how Stripe's proration works.

#

it prorates down to the exact second-based timestamp for when the update is done.

languid forge
#

Yes, How to archive the result like pic B?

reef summit
#

not sure I understand what you mean, can you elaborate?

languid forge
#

The picture is that I sent my invoice on August 7th after operating on an APP that's not mine.
I want to achieve the same functionality as it - upgrade

analyze:

Basic package is $5 , Standard package is $10 , Premium is $15 in Picture .

Package period from July 7th to August 7th,

On August 1st, the upgrade from Basic to Standard package resulted in two records of 1 and 2,

A few hours later, the upgrade from the Standard plan to the Premium plan produced two records of 3 and 4

As can be seen from the figure, the difference calculated each time is not calculated according to the remaining days, but simply subtracted.

reef summit
#

can you write an email to https://support.stripe.com/?contact=true with the specific Invoice ID and a clear description of the exact actions and API request you made so we can look at your account instead of trying to help on any anonymous Discord thread?

languid forge
#

How to get Invoice ID?

reef summit
#

When you're looking at an Invoice in the dashboard it's in the top right. (in_xxxx)

#

or the id field of the Invoice object in the API.

languid forge
#

It is D62246A0-0003 as figure

reef summit
#

I told you to write to our support team over email with that information. This is an anonymous unauthenticated channel so we can't help as well as they can if you write in.

#

Deeply investigating specific examples of real invoices on your account is a lot of work and not something we can do here

languid forge
#

I know that.

#

Just confirm the invoice ID.

reef summit
#

ok

#

what you posted is NOT the Invoice ID, no.

#

The invoice ID looks like in_xxx and I told you how to get it.

#

what you posted is the invoice number, which is not something I can use(but our support team can since they'd know what Stripe account you're using automatically and could look it up that way; here I don't know anything about your account at all).

languid forge
#

I have not Invoice ID.

reef summit
#

that's fine if you don't — like I said, the number is enough if you contact our support team with it.

languid forge
#

I don't have an invoiceId because this invoice was sent to me after I used it on other merchant APPs

reef summit
#

can I close this thread?

#

like are you saying, that screenshot you posted is not even your account, it's some other invoice that you as a private individual received from a different Stripe merchant?

reef summit
#

if so, we have no way to tell you how they created that Invoice, they might have made it entirely custom themselves and not used our proration, maybe they don't even use Stripe, who knows

#

it's impossible for me to help you understand what that other merchant did

#

sorry but this thread is going nowhere and you've been here asking questions for days.

#

are you finished? can I close this thread?