diff --git a/BTCPayServer.Client/Models/CreateInvoiceRequest.cs b/BTCPayServer.Client/Models/CreateInvoiceRequest.cs index c37f6a1b7..e017b9b20 100644 --- a/BTCPayServer.Client/Models/CreateInvoiceRequest.cs +++ b/BTCPayServer.Client/Models/CreateInvoiceRequest.cs @@ -17,6 +17,7 @@ namespace BTCPayServer.Client.Models public class CheckoutOptions { + [JsonConverter(typeof(StringEnumConverter))] public SpeedPolicy? SpeedPolicy { get; set; } @@ -30,6 +31,9 @@ namespace BTCPayServer.Client.Models public TimeSpan? Monitoring { get; set; } public double? PaymentTolerance { get; set; } + + [JsonProperty("redirectURL")] + public string RedirectURL { get; set; } } } } diff --git a/BTCPayServer/Controllers/InvoiceController.cs b/BTCPayServer/Controllers/InvoiceController.cs index 55d27d908..eed7bbd7a 100644 --- a/BTCPayServer/Controllers/InvoiceController.cs +++ b/BTCPayServer/Controllers/InvoiceController.cs @@ -181,6 +181,7 @@ namespace BTCPayServer.Controllers excludeFilter = PaymentFilter.Where(p => !supportedTransactionCurrencies.Contains(p)); } entity.PaymentTolerance = invoice.Checkout.PaymentTolerance ?? storeBlob.PaymentTolerance; + entity.RedirectURLTemplate = invoice.Checkout.RedirectURL?.Trim(); if (additionalTags != null) entity.InternalTags.AddRange(additionalTags); return await CreateInvoiceCoreRaw(entity, store, excludeFilter, cancellationToken); diff --git a/BTCPayServer/wwwroot/swagger/v1/swagger.template.invoices.json b/BTCPayServer/wwwroot/swagger/v1/swagger.template.invoices.json index 4eb27d578..399881293 100644 --- a/BTCPayServer/wwwroot/swagger/v1/swagger.template.invoices.json +++ b/BTCPayServer/wwwroot/swagger/v1/swagger.template.invoices.json @@ -611,7 +611,7 @@ "metadata": { "type": "object", "nullable": true, - "description": "Additional information around the invoice that can be supplied." + "description": "Additional information around the invoice that can be supplied. Some metadata are treated differently by BTCPay Server: \n * `orderId`: A string, you can use this property to store the ID of an external system. We allow you to search in the invoice list based on this ID." }, "checkout": { "nullable": true, @@ -642,7 +642,7 @@ "nullable": true, "items": { "type": "string" - }, + }, "description": "A specific set of payment methods to use for this invoice (ie. BTC, BTC-LightningNetwork). By default, select all payment methods activated in the store." }, "expirationMinutes": { @@ -662,6 +662,11 @@ "minimum": 0, "maximum": 100, "description": "A percentage determining whether to count the invoice as paid when the invoice is paid within the specified margin of error. Default to the store's settings. (The default store settings is 100)" + }, + "redirectURL": { + "type": "string", + "nullable": true, + "description": "When the customer paid the invoice, the URL where the customer will be redirected when clicking on the `return to store` button. You can use placeholders `{InvoiceId}` or `{OrderId}` in the URL, BTCPay Server will replace those with this invoice `id` or `metadata.orderId` respectively." } } },