@inject BTCPayServer.Security.ContentSecurityPolicies csp @model PayButtonViewModel @{ Layout = "../Shared/_NavLayout.cshtml"; ViewData.SetActivePageAndTitle(StoreNavPages.PayButton, "Pay Button", Context.GetStoreData().StoreName); csp.AllowUnsafeHashes("onBTCPayFormSubmit(event);return false"); } @section PageHeadContent { } @section PageFootContent { if (!window.btcpay) { var script = document.createElement('script'); script.src=@(Safe.Json(Model.UrlRoot + "modal/btcpay.js")); document.getElementsByTagName('head')[0].append(script); } function onBTCPayFormSubmit(event) { event.preventDefault(); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200 && this.responseText) { window.btcpay.showInvoice(JSON.parse(this.responseText).invoiceId); } }; xhttp.open('POST', event.target.getAttribute('action'), true); xhttp.send(new FormData(event.target)); } }
Configure your Pay Button, and the generated code will be displayed at the bottom of the page to copy into your project.
The URL to post purchase data.
Receive email notification updates.
Where to redirect the customer after payment is complete.
Specify additional query string parameters that should be appended to the checkout page once the invoice is created.
For example, lang=da-DK
would load the checkout page in Danish by default.
Link this Pay Button to an app instead. Some features are disabled due to the different endpoint capabilities. You can set which perk/item this button should be targeting.