private StripeCharge PerformStripeRefund() { try { PaymentGateway pg = new PaymentGateway(); var merchant = pg.GetMerchant(invoice.MerchantId); var voice = pg.GetDisplayInvoice(invoice.InvoiceId); int amountInCentsTotalRefund = Convert.ToInt32((invoice.FinancialData.RefundAmount) * 100); var chargeService = new StripeChargeService(merchant.StripeConnectToken); StripeCharge stripeCharge = chargeService.Refund(voice.CustomerId, amountInCentsTotalRefund); invoice.PaymentProviderRefundedId = stripeCharge.Id; return stripeCharge; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return null; }
private StripeCharge PerformStripePaywallPurchaseCheckout() { try { PaymentGateway pg = new PaymentGateway(); var merchant = pg.GetMerchant(invoice.MerchantId); int amountInCentsTotalPayment = Convert.ToInt32((invoice.FinancialData.BasePriceForItems) * 100); int RDNationsCut = Convert.ToInt32(amountInCentsTotalPayment - (invoice.FinancialData.PriceSubtractingRDNationFees * 100)); var stripeService = new StripeChargeService(merchant.StripeConnectToken); //The token returned from the above method var stripeChargeOption = new StripeChargeCreateOptions() { AmountInCents = amountInCentsTotalPayment, Currency = "usd", Description = invoice.InvoiceId.ToString().Replace("-", "") + ": Payment to " + merchant.OwnerName, TokenId = invoice.StripeToken, ApplicationFeeInCents = RDNationsCut }; var response = stripeService.Create(stripeChargeOption); invoice.PaymentProviderCustomerId = response.Id; return response; } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return null; }