#starky_api
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/1235940803071971328
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
How are you creating subscriptions via Checkout Sessions or directly?
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.
You can pass price_data instead to define prices inline: https://docs.stripe.com/api/subscriptions/create#create_subscription-items-price_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.