using Stripe; using Stripe.Checkout; using Hutopy.Application.Common.Interfaces; namespace Hutopy.Infrastructure.Stripe; public class StripeService : IStripeService { public StripeService() { // I removed the key to push. Will need to be in config. StripeConfiguration.ApiKey = ""; } public async Task CreateCheckoutSession(int price, string currency = "cad") { var options = new SessionCreateOptions { LineItems = [ new SessionLineItemOptions { PriceData = new SessionLineItemPriceDataOptions { UnitAmount = price, Currency = currency, ProductData = new SessionLineItemPriceDataProductDataOptions { Name = "Tip", }, }, Quantity = 1, } ], Mode = "payment", UiMode = "embedded", ReturnUrl = $"http://localhost:5173/creatorfolio", }; var service = new SessionService(); Session session = await service.CreateAsync(options); return session.ClientSecret; } }