#neha_api

1 messages · Page 1 of 1 (latest)

lyric folioBOT
#

đź‘‹ 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/1216826781676605620

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

marsh spokeBOT
#

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.

civic marsh
#
        return this.stripe.subscriptions.update(subscriptionId, {
          items: [{ id: subscription.items.data[0].id, price: finalPriceId }],
          billing_cycle_anchor: "now",
          proration_behavior: "always_invoice",
          payment_behavior: "pending_if_incomplete",
          // promotion_code: promoCode,
          proration_date: prorateDate,
        });

i want to invoice the customer if there's an outstanding balance but i can't get it to work

marsh spokeBOT
civic marsh
#

even in the UI, i set up the same parameters

#

why isn't the 7 cents getting invoiced asap?

brazen shore
#

Hi đź‘‹ can you elaborate a bit more about what you're trying to do/showing?
In the scenario you're describing, what is an "outstanding balance"?

civic marsh
#

i'm upgrading and downgrading between two subscriptions that differ by $10

#

when i downgrade, i want the credit to be added to the user's account
when i upgrade, i want the user to be credited for any unused time on their old sub, and then start a new sub for the full price (aka reset the billing cycle)

#
          items: [{ id: subscription.items.data[0].id, price: priceId }],
          billing_cycle_anchor: "now",
          proration_behavior: "always_invoice",
          payment_behavior: "pending_if_incomplete",
          proration_date: prorateDate,
        });```
#

so the invoices look right, the user gets $10 back or is invoiced $10 (approximately)

#

but there's only one payment, and the next payment is for 7 cents extra (aka the difference between all those invoices)

#

is there a rule on how big an invoice has to be?

#

from the docs:

Immediate payment
Stripe immediately attempts payment for these subscription changes:

From a subscription that doesn’t require payment (for example, due to a trial or free subscription) to a paid subscription
When the billing period changes
When billing is performed immediately, but the required payment fails, the subscription change request succeeds and the subscription transitions to past_due.

To bill a customer immediately for a change to a subscription on the same billing cycle, set proration_behavior to always_invoice. This calculates the proration, then immediately generates an invoice after making the switch. Combine this setting with pending updates so the subscription doesn’t update unless payment succeeds on the new invoice.

brazen shore
#

Can you share an ID of an object you're testing with? It's hard to tell from the sceenshots what could be going on. Credit balances and prorations are naturally tricky topic.

civic marsh
#

customer id cus_Pie6stDYvRVTgb

#

ooh

#

proration_behavior: "always_invoice",
payment_behavior: "pending_if_incomplete",

vs.

proration_behavior: "create_prorations",
payment_behavior: "pending_if_incomplete",

^ what's the difference here in practice?

#

i am concerned about payment failures so i always want to charge ahead of time, rather then retroactively, when possible

#

so is "always_invoice" the way to go?

brazen shore
#

If you always want to immediately create an Invoice for the prorated amounts, then always_invoice is the best option. create_prorations may not charge for the prorated amounts until the next naturally occurring Invoice is generated.

civic marsh
#

but then this line...

Stripe immediately attempts payment for these subscription changes:

From a subscription that doesn’t require payment (for example, due to a trial or free subscription) to a paid subscription
When the billing period changes

#
          proration_behavior: "always_invoice",
          payment_behavior: "pending_if_incomplete",```
#

if i'm setting "billing_cycle_anchor" then will "create_prorations" and "always_invoice" have the same effect?

brazen shore
#

If you're setting billing_cycle_anchor to now, then your request will move the Subscription to the next billing period and will generate the Invoice for that billing period which, I believe, will also contain the prorations.

civic marsh
#

ok thank you

#

and one more q

#

i'm updating a price from $25 to $24.99

#

is there a fast way to do this for everyone?

#

or do i have to write a script that goes through every sub and updates the price ID

brazen shore
#

You will need to step through and update all related Subscriptions individually, there is not a way to perform bulk updates.

civic marsh
#

and the rate limit is 100 parallel requests per second correct?

brazen shore
#

Correct, but it's usually the request-per-second limit of 100 that is hit before the concurrent request limiter is hit.

civic marsh
#

and what's that

#

limit

brazen shore
#

100