private async Task HandleCardUpdated(Stripe.Card card)
        {
            var db      = Context.GetDatabase();
            var billing = await db.Get <BillingRecord>(b => b.Stripe !.CustomerId == card.CustomerId);

            if (billing == null)
            {
                return;
            }
            billing.Card = new Card()
            {
                Last4 = card.Last4,
                Brand = card.Brand
            };
            await db.SetField(billing, b => b.Card, billing.Card);
        }
Exemple #2
0
        private async void SaveCard(Models.Card card)
        {
            var stripeCard = new Stripe.Card
            {
                Name        = card.Name,
                Number      = card.Number,
                ExpiryMonth = card.ExpiryMonth,
                ExpiryYear  = card.ExpiryYear,
                CVC         = card.CVC
            };

            try
            {
                await StripeClient.CreateToken(stripeCard, StripeClient.DefaultPublishableKey);

                StripeConfiguration.SetApiKey(StripeClientConstants.ApiKey); //"sk_test_BQokikJOvBiI2HlWgH4olfQ2");
            }
            catch (Exception ex)
            {
                // Handle a failure
                Console.WriteLine(ex);
            }
        }