#starky_api

1 messages ¡ Page 1 of 1 (latest)

low currentBOT
#

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

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

wicked wolf
#

How are you creating subscriptions via Checkout Sessions or directly?

dreamy sky
#

Directly via API. SubscriptionService8)

#

if (body.Subscription == true)
{
var paymentSettings = new SubscriptionPaymentSettingsOptions
{
SaveDefaultPaymentMethod = "on_subscription",
};

            var subscriptionOptions = new SubscriptionCreateOptions
            {
                Customer = customer2.Id,
                Items = new List<SubscriptionItemOptions>
                {
                    new SubscriptionItemOptions
                    {
                        Price = body.SubscriptionID,
                    },
                },
                PaymentSettings = paymentSettings,
                PaymentBehavior = "default_incomplete",
                ApplicationFeePercent = 3,
                Metadata = new Dictionary<string, string>(){
                    {"patid", body.Patid},
                    {"total",  $@"{(double.Parse(body.Amount) / 100).ToString()} EUR" },
                    {"value2",  body.Amount},
                    {"language", body.Language},
                    {"customer_name", body.Name},
                    {"customer_id", customer2.Id },
                    {"customer_id2", customer.Id },
                    {"email", body.Email},
                }
            };
            subscriptionOptions.AddExpand("latest_invoice.payment_intent");
            var subscriptionService = new SubscriptionService();
            Subscription subscription = subscriptionService.Create(subscriptionOptions, requestOptions);

            
        }
#

and then I get this:

Stripe.StripeException: You passed an empty string for 'items[0][price]'. We assume empty values are an attempt to unset a parameter; however 'items[0][price]' cannot be unset. You should remove 'items[0][price]' from your request or supply a non-empty value.
wicked wolf
dreamy sky
#

great and the VAT?

#

nevermind, I saw there is tax rates inside the price_data, so I will try this. Thank you @wicked wolf