mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 01:22:50 -05:00
process off session payment methods
This commit is contained in:
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Bit.Core;
|
||||
using Stripe;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
@ -52,5 +53,19 @@ namespace Bit.Api.Controllers
|
||||
var invoice = await _bitPayClient.CreateInvoiceAsync(model.ToBitpayClientInvoice(_globalSettings));
|
||||
return invoice.Url;
|
||||
}
|
||||
|
||||
[Authorize("Application")]
|
||||
[HttpPost("~/setup-payment")]
|
||||
[SelfHosted(NotSelfHostedOnly = true)]
|
||||
public async Task<string> PostSetupPayment()
|
||||
{
|
||||
var options = new SetupIntentCreateOptions
|
||||
{
|
||||
Usage = "off_session"
|
||||
};
|
||||
var service = new SetupIntentService();
|
||||
var setupIntent = await service.CreateAsync(options);
|
||||
return setupIntent.ClientSecret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user