#satvik-techie_code
1 messages ยท Page 1 of 1 (latest)
๐ 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/1290613632115277915
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- satvik-techie_subscription-application-fee, 19 hours ago, 16 messages
- satvik-techie_code, 6 days ago, 33 messages
in above code i am creating a monthly subscription, i want to collect first payment different than other 11 months payment is it possible ?
Hi, let me help you with this.
first payment different
How different? Do you want to charge a higher amount?
yes a little higher
e.g firstpayment would be 3.36 pound
and remaining 11 installment would be 3 pound
You can add an extra one-time item with add_invoice_items, which will only be added to the first Invoice: https://docs.stripe.com/api/subscriptions/create#create_subscription-add_invoice_items
ok let me check and get back to you
var invoiceItems = new List<SubscriptionAddInvoiceItemOptions>();
invoiceItems.Add(new SubscriptionAddInvoiceItemOptions()
{
Price = "3.36"
});
subscriptionOptions.AddInvoiceItems = invoiceItems;
like this ?
No, Price must be the Price object ID: https://docs.stripe.com/products-prices/how-products-and-prices-work
ok let me modify
tried but getting error
Stripe.StripeException: 'The price specified is set to type=recurring but this field only accepts prices with type=one_time.'
Could you please share the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
okay
i think the issue is with the price and product, as i have created prouduct and price as recurring, but add_invoice_items accept only one time payment params
any guess ?
Hey! Taking over for my colleague. Let me catch up.
Sorry, still checking...
The price specified is set to
type=recurringbut this field only accepts prices withtype=one_time.
Here is the error message
In the add_invoice_items[0][price] you need to pass one time prices and not recurring.
i know that, but the main issue is i want to make first payment different amount and remaining 11 payments are with different amount
how come that is possbile with monthly subscription ?
thats why i have created price , product object as recurring
how come that is possbile with monthly subscription ?
You can achieve this using Susbcription Scheduler
okay let me check and implement
if any issue i will get back to you
so what is price_digital ?
It's a recurring price
one more question, how to get clientsecret ?
What Client Secret ?
to get the payment
i need to pass clientsecret
var elements = stripe.elements({
clientSecret: this.clientSecret,
});
const paymentElement = elements.create(
"payment",
{
layout: "accordion",
defaultValues: {
billingDetails: {
email: this.email,
address: {
city: this.city,
country: "GB",
postal_code: this.postCode,
},
},
},
}
);
paymentElement.mount("#payment-element");
no not that way, while creating a subscription i was getting clientsecret from
Subscription subscription = await subscriptionService.CreateAsync(subscriptionOptions, requestOptions);
but using scheduling how to get clientsecret ?
You can retrieve it from the latest invoice of the Subscription
hi! I'm taking over this thread. let me know if you have nother questions.
i want to collect first payment different than other 11 months payment is it possible ?
while creating a monthly subscription
what do you mean by "different"? what are you trying to do exactly?
i am creating a montly payment subscription
now i want to take first payment as diffrent amount
and remaing 11 payment have different amount
e.g
1st payment = 3.36 pound
remaining 11 payment = 3.12 pound
sure that's possible. how do you create the Subscription? With Checkout Session, the Subscription endpoint, something else?
so you directly call the Subscription endpoint.
the simplest solution is to create a subscription with two prices:
- a recurring price of
3.12 pounds - a one time price of
0.24 pounds
this way, the first month will be3.36 pounds, and the other months3.12 pounds
so do i need to create 2 (price , product) with one time payment
and 2 (price , product) with recurring payment
and then adding both price in below code
var subscriptionOptions = new SubscriptionCreateOptions
{
Customer = customer.Id,
Items = new List<SubscriptionItemOptions>
{
new SubscriptionItemOptions
{
Price = price.Id,
},
},
PaymentSettings = paymentSettings,
PaymentBehavior = "default_incomplete",
}; ?
i mean in subscriptionitemoptions
yes something like this.
- set the recurring price in
items: https://docs.stripe.com/api/subscriptions/create?lang=node#create_subscription-items - set the one time price in
add_invoice_items: https://docs.stripe.com/api/subscriptions/create?lang=node#create_subscription-add_invoice_items
tried, but getting exception
'The price specified is set to type=one_time but this field only accepts prices with type=recurring.'
did you read my above message? you need to use add_invoice_items for the one time price
okay let me check