Пример #1
0
 public StripeAdapter()
 {
     _customerService      = new Stripe.CustomerService();
     _subscriptionService  = new Stripe.SubscriptionService();
     _invoiceService       = new Stripe.InvoiceService();
     _paymentMethodService = new Stripe.PaymentMethodService();
     _taxRateService       = new Stripe.TaxRateService();
     _taxIdService         = new Stripe.TaxIdService();
     _chargeService        = new Stripe.ChargeService();
     _refundService        = new Stripe.RefundService();
     _cardService          = new Stripe.CardService();
     _bankAccountService   = new Stripe.BankAccountService();
     _priceService         = new Stripe.PriceService();
     _testClockService     = new Stripe.TestHelpers.TestClockService();
 }
Пример #2
0
        private async Task HandleCheckoutSessionCompleted(Session session)
        {
            var service      = new SessionService();
            var priceService = new Stripe.PriceService();
            var priceOptions = new Stripe.PriceGetOptions {
                Expand = new List <string> {
                    "product"
                }
            };

            Stripe.StripeList <Stripe.LineItem> lineItems = service.ListLineItems(session.Id);
            var productIds = new List <string>();
            var userId     = "";

            productIds.AddRange(lineItems.Select(item => {
                var price = priceService.Get(item.PriceId, priceOptions);
                userId    = price.Product.Metadata["UserId"];
                return(price.Product.Metadata["AppId"]);
                // Filter out shipping line item if it was included
            }).Where(item => !item.Equals("-1")));

            await AddOrder(productIds, userId);
        }