#unmatchedplaya_api

1 messages ยท Page 1 of 1 (latest)

sage barnBOT
#

๐Ÿ‘‹ 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/1296688025539055636

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

humble crystal
unreal sage
#

Thanks, but these need to be different subscriptions due to different pricing and so on

#

based on some legacy requirements

#

from what I could work out, this was possible through the checkout page

humble crystal
#

ah, well, then unfortunately no, they can't be done in a single transaction / request. You need to make a few requests via the API

unreal sage
#

and there's no way to re-activate a cancelled subscription?

#

in case of payment failure?

humble crystal
#

there's no way to re-activate a cancelled subscription

unreal sage
#

mmm.. and invoicing, is it possible to create an invoice for the pro-rata refunds of the old, and pro-rata charges for the new in a single invoice before cancellation?

humble crystal
#

how about making sure the new subscription is successful then cancelling the old one?

unreal sage
#

we don't want "sticker shock" So if the old one is $9000, new $10000, we do not want them to pay $10k and then get $9k refund. Instead $1k invoice

#

I'm guessing it would be possible for us to do a invoice with those numbers calculated ourselves, with the charges/refunds calculated, but I would rather leave that to the experts ๐Ÿ˜„

#

and we would cancel + new with no pro-rata

humble crystal
#

hrm gimme a while to think about this

unreal sage
#

thanks

humble crystal
#

one idea that I have is to use preview invoice to calculate the proration when the subscription is cancelled, then add that amount to the customer balance. When the new subscription is created, it should automatically deduct that amount from the customer balance. You need to remember to remove the amount from the customer balance when the customer abandons attempts to pay the subscription though, otherwise customers could abuse the amount in their customer balance for something else. After the new subscription is successful, you can cancel the old subscription without any refunds

#

honestly, i think the easier solution here might be to upgrade your systems to accommodate subscription updates instead

unreal sage
#

thanks, i'll think about it.
Yes the main issue actually stems from the fact that we have two fees with each subscription, a company fee and per user fee. No the problem is that these need to be 2 prices on the one subscription so we do not need to manage multiple subscriptions to get these payments. Now originally I did a POC on using Stripe checkout to cancel one subscription and create another. This worked great, however the lines on the checkout screen indicate only the subscription, and no details about the price. So you would see 2 lines with the same subscription name, and 2 charges: 1 x company fee and 20 x user fee as an example. As this is not configurable, we have gone down this rabbit hole instead ๐Ÿ˜ฌ

#

I wish they would just get rid of the comany fee. My life would be much easier

humble crystal
#

if you want to go down this route, you'll want to make sure you have very clear notes about what each customer balance adjustment is for. Unlike when you update the subscription directly, it's not easy to figure out what the customer balance adjustment is for without detailed notes since the object itself is not directly linked to the actual proration of the cancellation of the subscription

unreal sage
#

Thanks! Yeah not entirely sure what to do but I'll try see what I can figure out

humble crystal
#

high level steps :

  1. create a preview to cancel a subscription at a certain date https://docs.stripe.com/api/invoices/create_preview#create_create_preview-subscription_details-cancel_at
  2. check how much the proration will be from step 1
  3. create a customer balance transaction for the proration from cancelling the subscription https://docs.stripe.com/api/customer_balance_transactions/create
  4. create the new subscription - the customer balance should be applied
  5. after new subscription is successfully created, cancel the old subscription

Note : I would consider blocking any other payments in the meantime on this customer until they either pay or abandon attempts to pay for the new subscription. Remember to adjust the customer balance back (i.e. remove the proration amount) if customer abandons attempt to pay for the new subscription. Otherwise that's essentially "free" money for the customer.

#

I haven't actually tested this out yet so i can't guarantee 100% it'll work

unreal sage
#

IS ther any way I can output this chat?

humble crystal
#

the link is always here for you to view

unreal sage
#

All good, that's wht POC is for

#

excellent, thanks

humble crystal
#

If the new subscription price (amount) that is going to be created will always be more than the previous subscription, there's a slightly better way to go about it. Typing it out now....

#
  1. create a preview to cancel a subscription at a certain date https://docs.stripe.com/api/invoices/create_preview#create_create_preview-subscription_details-cancel_at
  2. check how much the proration will be from step 1
  3. Create the new subscription with payment_behavior: "default_incomplete"
  4. Create a credit note on the new subscription's newly created invoice : https://docs.stripe.com/api/credit_notes/create for the amount you want to refund (proration for cancelled subscription). More info about credit notes : https://docs.stripe.com/billing/invoices/credit-notes
  5. have the customer make payment for the subscription by confirming the PaymentIntent on the frontend

Use the Dashboard to adjust or refund finalized invoices with credit notes.

unreal sage
#

awesome, i'll give that a go

#

thank you

humble crystal
#

iirc, the credit note amount can't be more than the invoice amount

unreal sage
#

ok i'll make sure to handle this

humble crystal
#

it could be a problem if you have discounts and possibly other refunds that were previously applied to the customer that are now in their customer balance. But yeah, test both suggestions out and see if either of them works