#Sagar Thakkar-price-api-error

1 messages · Page 1 of 1 (latest)

lament rampart
#

Hey! What's the use case for a one-time subscription payment?

#

Are you also using a recurring price?

ripe orbit
#

I have 2 use cases.

  1. Seller can define the recurring package. ex: charge $50 monthly for 12 months.

  2. 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.

lament rampart
#

Is the $500 essentially a discounted annual plan?

#

Or is it completely separate from the recurring price?

ripe orbit
#

that's completely different from the recurring price. It depends on the seller what price they would set in the portal.

lament rampart
#

Ok, got it

#

And you're not using Checkout? You've build your own integration, right?

ripe orbit
#

yes

#

Essentially, I want to use the Stripe Connect for the subscription. So, I can set a platform fees on each payment

lament rampart
#

Cool! So you'll need to add a line item for the one-time fee to the initial Invoice object generated by the Subscription

ripe orbit
#

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.

lament rampart
#

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

ripe orbit
#

I am a little confused here. The subscription has not been created yet. How do I link that invoice to a subscription?

lament rampart
#

The invoice will be created when you create the subscription

ripe orbit
#

create subscription is giving me error. that's where I got stuck

lament rampart
#

Yes, because you're passing a Price object which is not type: 'recurring'

ripe orbit
#

ok

#

You mean for stipe Price Object which type: 'one_time'. We cannot create the subscription

lament rampart
#

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

ripe orbit
#

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

lament rampart
#

Then you should configure a recurring price with a year interval

ripe orbit
#

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.

lament rampart
#

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

ripe orbit
#

I understand that now.

#

Thank you for your help.

#

you are awesome.!

lament rampart
#

Np! Let me know if I can help with anything else

ripe orbit
#

I think I'm good.

ripe orbit
lament rampart
#

Why do you need a Subscription in this case then?

#

Why not do a one-time payment of $500?

ripe orbit
#

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.

lament rampart
#

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

ripe orbit
#

Yes, I will take that route now.