1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

stripe subscription creation

This commit is contained in:
Kyle Spearrin
2017-04-04 10:13:16 -04:00
parent 5187f4c15f
commit a4ef7c906e
10 changed files with 29 additions and 11 deletions

View File

@ -8,6 +8,7 @@ using Bit.Core.Utilities;
using Bit.Core.Exceptions;
using System.Collections.Generic;
using Microsoft.AspNetCore.DataProtection;
using Stripe;
namespace Bit.Core.Services
{
@ -47,6 +48,15 @@ namespace Bit.Core.Services
throw new BadRequestException("Plan not found.");
}
var customerService = new StripeCustomerService();
var customer = await customerService.CreateAsync(new StripeCustomerCreateOptions
{
SourceToken = signup.PaymentToken
});
var subscriptionService = new StripeSubscriptionService();
var subscription = await subscriptionService.CreateAsync(customer.Id, plan.StripeId);
var organization = new Organization
{
Name = signup.Name,