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:
@ -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,
|
||||
|
Reference in New Issue
Block a user