#Sagar Thakkar-price-api-error
1 messages · Page 1 of 1 (latest)
Hey! What's the use case for a one-time subscription payment?
Are you also using a recurring price?
I have 2 use cases.
-
Seller can define the recurring package. ex: charge $50 monthly for 12 months.
-
Seller can define the one-time charge package. ex: charge $500 in a single payment.
Although, recurring use cases work perfectly.
I am trying to same price id into subscription API, and that gives me an error.
Is the $500 essentially a discounted annual plan?
Or is it completely separate from the recurring price?
that's completely different from the recurring price. It depends on the seller what price they would set in the portal.
Ok, got it
And you're not using Checkout? You've build your own integration, right?
yes
Essentially, I want to use the Stripe Connect for the subscription. So, I can set a platform fees on each payment
Cool! So you'll need to add a line item for the one-time fee to the initial Invoice object generated by the Subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Currently I am using code below,
var subscriptionCreateOptions = new SubscriptionCreateOptions
{
Customer = stripeCustomerId,
CancelAt = cancelAt,
Items = new List<SubscriptionItemOptions>
{
new SubscriptionItemOptions
{
Price = stripePlanId
},
},
DefaultSource = subscribeToPlan.sourceId
};
subscriptionCreateOptions.AddExpand("latest_invoice.payment_intent");
var subscriptionService = new SubscriptionService();
var subscriptionCreated = await subscriptionService.CreateAsync(subscriptionCreateOptions);
Ok, You mean generated invoice directly and charge the invoice?
However this way I don't have the subscription created in the stripe dashboard.
Yes, it'll be added to the initial invoice for the subscription
You can't create a separate subscription for it. As the error you're seeing explains, it needs to be a recurring price for it to be used in a subscription
I am a little confused here. The subscription has not been created yet. How do I link that invoice to a subscription?
The invoice will be created when you create the subscription
create subscription is giving me error. that's where I got stuck
Yes, because you're passing a Price object which is not type: 'recurring'
ok
You mean for stipe Price Object which type: 'one_time'. We cannot create the subscription
Yes, exactly
If you need to charge an initial one-time fee as part of an subscription, then you can add it to the initial invoice as I described
Ok. I got it. However, the Initial charge is not my case.
let me give you the use case that I have.
Let's say, a seller on my platform named
"Audio Series" offers an audio service.
They have a plan of $500 which is a one-time payment.
Which offers me access to their audio service for a year.
I as a user want to subscribe to their service
Then you should configure a recurring price with a year interval
That makes sense to me.
and I was doing that before I had upgraded the stripe version.
I was using the stripe 2017 API version. in which I was using the Plan API.
which don't have the ability set to type: recurring or one-time
I understand Price API with type one-time works as a subsription just charges one time not the recurring.
I don't why stripe has added that type = one-time if they cannnot support this use case.
type one-time works as a subsription just charges one time not the recurring
No, that's not possible with Prices
Because you can use Price objects with non-subscription (one-time) payments, like with Checkout
Np! Let me know if I can help with anything else
I think I'm good.
and I have to set cancel_at date so, it won't charge again next year.
Why do you need a Subscription in this case then?
Why not do a one-time payment of $500?
I had defined database schema, understanding that one-time payment will work same as the subscription.
So, that's I am making sure I understand one-time payment should be different from the subscription
Now, I will re-visit the database schema to add one-time payments. and based on the update parts of the application which shows the this data.
Sounds to me like you don't really need a subscription if it's a one-time $500 payment for a year of access
Instead just provision access to the service for a year from the date/time of the payment
Yes, I will take that route now.