#amrit_code

1 messages ¡ Page 1 of 1 (latest)

rare gladeBOT
#

👋 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/1230161457660821545

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

west hatch
#

Using Simple code for create subscription right now, Problem is coming that I want to use my own prorated price

#

Code



            SubscriptionPaymentSettingsOptions paymentSettings = new SubscriptionPaymentSettingsOptions
            {
                SaveDefaultPaymentMethod = "on_subscription",
            };

            var subscriptionOptions = new SubscriptionCreateOptions
            {
                Customer = stripeCustomer.Id,
                Items = new List<SubscriptionItemOptions>
                {
                    new SubscriptionItemOptions
                    {
                        PriceData = new SubscriptionItemPriceDataOptions(){
                            Currency = "CAD",
                            Product = "prod_Pw4wtKhorIHbx5",
                            Recurring = new SubscriptionItemPriceDataRecurringOptions(){
                                Interval = "month"
                            },
                            UnitAmount = 101299
                        }

                    }
                },
                AddInvoiceItems = new List<SubscriptionAddInvoiceItemOptions>
                {
                    new SubscriptionAddInvoiceItemOptions
                    {
                        Price = "price_1P6CmqP1Tv1rSZRNKB2UbQHW",
                    },
                    new SubscriptionAddInvoiceItemOptions
                    {
                        Price = "price_1P6CnIP1Tv1rSZRNUC3pP2VA",
                    },
                },
                BillingCycleAnchor = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month + 1, 1),
                PaymentSettings = paymentSettings,
                PaymentBehavior = "default_incomplete"
            };

            subscriptionOptions.AddExpand("latest_invoice.payment_intent");
            var subscriptionService = new SubscriptionService();

            Subscription subscription = subscriptionService.Create(subscriptionOptions);
            Session["sub"] = subscription;

            return RedirectToAction("Success");
        }
dusky oarBOT