#Huzaifa
1 messages · Page 1 of 1 (latest)
So that error is saying that some of your prices have different intervals. Basically every price on your subscription needs to renew at the same cadance. For example you can't have a monthly price with a yearly price, they would both need to be monthly or both need to be yearly
Have you double checked that all of your prices have the same interval?
yes
thats the thing
i am building an eccommerce
customer can add one yearly subscription product and one monthly subscription product
and then checkout
is there any api for that
We don't have anything pre-made for that. You would either need to make two subscriptions or you would have to make a monthly subscription, track how many months go by, and add a one time charge representing the yearly rate every 12 months.
You can make weekly prices via the dashboard or API
i want to do it from api
Have you looked in the API reference?
for all in single transaction
for weekly, monthly, year
You cannot do that unless you track the time yourself
So it would be a weekly subscription, every time a month passes you add the monthly price, every time 52 weeks pass you add the yearly charge
The month charge wouldn't quite line up but that is the closest you can get on one subscription
i can track year
like if customer select 1 year it will be like 12 months
but how can i track weeks like if customer select 1 week , what it will be 0.25 month ???
No, it is only whole values.
If you check the API reference, there is a week interval length https://stripe.com/docs/api/prices/create#create_price-recurring-interval
Also there is an option in the dashboard when creating prices
i have created the price
i want to use multiple interval price in same subscription api
which i cant do because interval should be same
so now how can i use multiple interval now
thats my question
Stripe does not support multiple intervals on the same subscription
The thing I suggested is a workaround so that you can charge like that, but it will take custom code on your side
i want to make a single charge
i am a coder
i can code
i just want to understand how can i do it
I think we might be talking past each other a bit here. Is it clear what I suggested with my workaround of one weekly subscription that you add one time prices to?
ok tell me is there any limit for prices per order ?
Subscriptions can have up to 20 recurring prices on them, but you can add more to their invoices https://stripe.com/docs/api/subscriptions/create#create_subscription-items
Oh and to be clear, to do that, you would listen for the invoice.created webhook event, that will be sent out when the invoice is first created. Invoices will stay in a draft state for one hour after creation and you can add invoice items to them during that time. Will look for a doc on this
You can do that via the Stripe Dashboard using the search bar, but if you want to do that via the API, then you'll need to use the Search API to get a Customer by their email (see here: https://stripe.com/docs/search#customers-email-search) then use the List Subscription method to get all Subscriptions by the Customer ID (see here: https://stripe.com/docs/api/subscriptions/list)
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [obj],
default_payment_method: paymentMethod.id,
metadata: {
email: req.body.email,
orderid: req.body.orderid,
},
});
is the above code is correct to create subscription with metadata
Looks alright to me, provided all the variables have what the API is expecting.
giving no error on api but empty when viewing on dashboard
in logs i can see the metadata but its not displaying on dashboard
Do you have a request ID for the request?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
ah
got it
its inside billings > subscription
is there any webhook which notify me 3 days before the next subscription delivery date ??
????