I am a bit stuck so I'm turning to you.
I have a system of subscriptions. The customer can only upgrade his subscription.
So the idea is that you have the different plans we offer, let's say you have account: silver (30$) gold (90$) and platinium(180$)
if the user has a free account, it's a regular subscription creation.
So the scenario is the following:
My customer goest from free to silver.
After a weeks he realize gold is fitting to his needs so he upgrades he has a preview of his next invoice and this works no problem so far with the following function:
await stripe.invoices.retrieveUpcoming({
customer: this.body('customer'),
subscription: this.body('sub'),
subscription_plan: this.body('newPlan'),
});
so the problem arise when the customer wants to upgrade again. Using the subscription_plan parameters bugs, and prevent the upgrade from being done.
How can i do that ? Do i need to create a new subscription ? What am i doing wrong
Using subscription_items seemed to do the job, the the invoice is giving me hell to fetch the data correctly with the prorata.
You can upgrade (or downgrade) a subscription by calling stripe.subscriptions.update.
Notably this will take care of any prorations for you, and you can specify your preferred proration behaviour when updating. You can learn more about how Stripe handles prorations here.
Related
I am implementing the Stripe payment platform using JavaScript and the PHP SDK.
I don't have any issues with the implementation itself, but I am not sure whether I have to reuse an existing PaymentIntent or it's perfectly fine to have a bunch of them created and incomplete.
I searched for this in Stripe's documentation, but I can't seem to find anything related to this.
For example, in my test account I have this:
It's all for the same transaction, because I was changing some visuals and refreshing the browser.
I am aware that each PaymentIntent has an ID, but is it recommended to add it as a query parameter and retrieve it on refreshing, or is it better to always generate a new Payment Intent.
My main reasoning is to avoid having a huge collection of incomplete payment intents.
The default integration path for Stripe today is to create a PaymentIntent first so that you get a client_secret you can use client-side to render their UI via PaymentElement. This means that if your customers decide not to pay after all, you end up with an incomplete PaymentIntent which is expected.
This is not really a problem, other than appearing in the Payments list which can be confusing. You could also write a background job daily that would cancel any PaymentIntent via you know won't be completed because the customer left and you didn't have any data to contact them to upsell them for example but this isn't really needed.
Stripe also has a beta (docs) right now (Feb 2023) that changes the default integration path. This simplifies the experience because you can render the PaymentElement client-side with specific options such as amount and currency. You'd then only create the PaymentIntent at the end of the flow
when the customer is attempting to pay. That flow limits the number of incomplete PaymentIntents since you only create them when the customer really pays. You'd still get some, for example after a decline by the customer's bank though.
I am new to transferwise and want to ask if the thing i want to do is achiviable via the wise-api
The platform/business needs to automate one action among others:
Business need to ask the User to pay via Wise whenever they feel like ready.
Business give the balance account details (Wise balance account) (i think it is the borderless account, right? or is one of the overseas balance accounts [usd, eur, gbp...] )
User pay to business
Via webhook (i think so) we manage the user info and linked the stuff to the DB
Would be nice if i can use the "Request money" flow-endpoint which give you a payment-link with 14 days of exp. But i think you can't use that in the api :(
Are someone who made something like this before using wise?
I'm so new to wise and it is my first time implementing a thing like this from scratch (i'm the only backend dev haha)
I tried to folllow the docs, and i see the endpoints to do this in the Postman Collection, but i dont know if can solve the needs of the business.
If this the only way?
I cant use the "Request money" flow with the api?
Big thanks for reading!
So I have my clients app set up to work with plans, which I was testing with my account. I set those test plans a couple months back, but now that I'm setting it up on my client's account, when I create a product I can only create a price for it. Did something change. Can I create a plan or do I have to change my code?
Prices are a new abstraction that replace Plans, yes :
https://stripe.com/docs/billing/prices-guide
https://stripe.com/docs/billing/migration/migrating-prices
They're created by default in the dashboard now.
You shouldn't need to change any of your code though, it's completely backwards and forwards compatible.
You can simply pass a price_xxx ID into anything that takes a plan parameter, for example, code that creates a subscription and sets items[0].plan=price_xxx will just work. You'll also see that the API mirrors the Price into both plan and price fields when you read an object from the API so again, your code doesn't need to know a Price is being used.
Context: There is a Stripe plan "Starter". The customer subscribes to the "Starter" plan. Within a subscription period the user wants to up- or downgrade the subscription (in my case: the quantity will be increased or decreased). Programmatically I want to achieve this with a subscription update.
Problem: Stripe wants to make the update immediately. But I want to have it changed at the end of the period.
Alternatives:
I saw this Stackoverflow asking exact the same question, but is six years ago -> Stripe: downgrade a user at "period end". The proposed solutions are not really reflecting the desired solution and also do not work for me.
I saw that Stripe has a subscription schedule API. Is this probably related to the problem solution?
I'm relly looking forward for (high-level) solutions to solve this problem. Thank you in advance.
So you want to update the subscription details at the end of the current period. In that case, you may want to use the subscription webhook events mentioned here
"When the subscription period elapses, invoice.created event is sent, indicating the creation of a draft invoice."
"About an hour after the invoice is created, it is finalized (changes are no longer permitted), and an invoice.finalized event is sent."
So you can listen to that invoice.created event and then update the subscription.
This is what I discussed with the Stripe support channel:
I understand that scheduling is not the best fit for you, as you'd
have to release the schedule once the update is made so the new
subscription rolls over, and this doesn't cancel the subscription, but
start a new one.
What you could do, is to cancel the first subscription at_period_end,
and then start the next one when the event
customer.subscription.deleted comes through:
https://stripe.com/docs/api/events/types#event_types-customer.subscription.deleted
If you don't want to use Webhooks, you can also cancel at period end
and then generate the new subscription at the same time using the
billing cycle anchor
https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_cycle_anchor.
This will only work though for subscriptions with the same interval,
or if the second subscription interval is shorter than the first.
I implemented the webhook solution. It works perfectly for me.
I have a tested app that will hopefully go live in the short term.
However, it has 3 in app purchases.
If the situation arises where I need to do a further test of purchasing the in-app-purchases, is there any way I can cancel my own personal in-app-purchases up to that point so I will be testing from scratch?
Note: I am using the new Windows.Services.Store.StoreContext method, and not the old one.
First, there's no such API that can cancel your in-app-purchase currently. But you can still do your further test.
If the situation arises where I need to do a further test of
purchasing the in-app-purchases, is there any way I can cancel my own
personal in-app-purchases up to that point so I will be testing from
scratch?
According to your description, it seems your IAP type is durable. If so, you can specify the duration for the product as 1 day so that you can repurchase it after it expires.
If your IAP is developer-managed consumable type, you need to report the previous IAP as fulfilled after the user consumes all the items. Then they purchase it again.
If your IAP is Store-managed consumable type, you need to report any items consumed by user as fulfilled to the Store and the Store updates user's balance. After users consume all the items, the user can purchase that IAP again.
For more details, you may refer to In-app purchases and trials.