Exemple #1
0
        public async Task ConfirmPayment(string json, string stripSignatureHeader)
        {
            var paymentIntent = _stripeService.ConfirmPaymentIntent(json, stripSignatureHeader);

            var payment = new Payment
            {
                Amount          = paymentIntent.Amount,
                Created         = DateTime.UtcNow,
                ReservationId   = int.Parse(paymentIntent.Metadata[MetadataReservationIdKey]),
                Status          = PaymentStatus.Fulfilled,
                PaymentIntentId = paymentIntent.Id,
                UserId          = int.Parse(paymentIntent.Metadata[MetadataUserIdKey])
            };

            _meredithDbContext.Payments.Add(payment);
            await _meredithDbContext.SaveChangesAsync();
        }