#john307-BillingPortal
1 messages · Page 1 of 1 (latest)
Hi there, the code that you are using creates a checkout session instead of a customer portal session.
Please take a look at https://stripe.com/docs/api/customer_portal/sessions/create?lang=dotnet for the Customer Portal Session creation API.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You might want to remove params LineItems, Mode, SuccessUrl and CancelUrl, these are for Checkout session.
After removing those here's what I got
"error": "Missing required param: success_url."
Then after adding success_url
`var options = new SessionCreateOptions
{
Customer = "cus_xxx",
SuccessUrl = "https://example.com/success",
CancelUrl = "https://example.com/cancel"
};
var service = new SessionService();
service.Create(options);
return Ok(service.Create(options))`;
It throws
"error": "You must pass either subscription_dataorline_itemsormode."
Can you remove SuccessUrl and CancelUrl, and add in ReturnUrl instead?
error CS0117: 'SessionCreateOptions' does not contain a definition for 'ReturnUrl'
did you import the SessionCreationOptions from Stripe.BillingPortal namespace?
Stripe.net is a sync/async .NET 4.6.1+ client, and a portable class library for stripe.com. - stripe-dotnet/SessionCreateOptions.cs at master · stripe/stripe-dotnet
Thats what I have missed I thought they share same namespace, good spot!
Thats all for now very thankful for your help
Cool, happy to know the problem is resolved!
Hey I still have some questions sorry
Can we use Stripe Billing to create payment or subscription ?
That's the job of Checkout Session, not Billing Portal Session.