2021-04-08 06:37:05 +02:00
@using BTCPayServer.Views.Stores
@model BTCPayServer.Plugins.Shopify.Models.ShopifySettings
2020-09-18 17:20:31 +02:00
@{
2021-04-08 06:37:05 +02:00
Layout = "../Shared/_NavLayout.cshtml";
ViewData["NavPartialName"] = "../Stores/_Nav";
ViewData.SetActivePageAndTitle(StoreNavPages.Integrations, "Integrations");
var shopifyCredsSet = Model?.IntegratedAt.HasValue is true;
var shopifyUrl = Model?.ShopifyUrl;
2020-09-18 17:20:31 +02:00
}
<form method="post" id="shopifyForm">
<h4 class="mb-3">
Shopify
2021-04-08 15:32:42 +02:00
<small>
<a href="https://docs.btcpayserver.org/Shopify" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
</small>
2020-09-18 17:20:31 +02:00
</h4>
@if (!shopifyCredsSet)
{
2020-09-26 12:51:29 -05:00
<p class="alert alert-info">Create a Shopify Private App with the permissions "Orders - Read and write"</p>
2020-09-18 17:20:31 +02:00
2020-09-25 13:50:04 -05:00
<div class="form-group">
2021-05-19 04:39:27 +02:00
<label class="form-label" for="exampleUrl">Example Url from Shopify Private App</label>
2020-09-25 13:50:04 -05:00
<input class="form-control" id="exampleUrl" name="exampleUrl">
2020-09-18 17:20:31 +02:00
</div>
2020-09-25 13:58:52 -05:00
<button name="command" type="submit" class="btn btn-primary" value="ShopifySaveCredentials">Connect to Shopify</button>
2020-09-18 17:20:31 +02:00
}
2020-09-21 12:36:09 +02:00
else
2020-09-18 17:20:31 +02:00
{
2020-09-25 13:50:04 -05:00
<div class="form-group">
2021-05-19 04:39:27 +02:00
<label asp-for="ShopName" class="form-label"></label>
2020-09-25 13:50:04 -05:00
<div class="input-group">
2021-04-08 06:37:05 +02:00
@if (!Model?.ShopName?.Contains(".") is true)
2020-09-25 13:50:04 -05:00
{
2021-05-19 04:39:27 +02:00
<span class="input-group-text">https://</span>
2020-09-25 13:50:04 -05:00
}
2021-04-08 06:37:05 +02:00
<input asp-for="ShopName" class="form-control" readonly="@shopifyCredsSet" />
2020-09-25 13:50:04 -05:00
2021-04-08 06:37:05 +02:00
@if (!Model?.ShopName?.Contains(".") is true)
2020-09-25 13:50:04 -05:00
{
2021-05-19 04:39:27 +02:00
<span class="input-group-text">.myshopify.com</span>
2020-09-25 13:50:04 -05:00
}
</div>
2021-04-08 06:37:05 +02:00
<span asp-validation-for="ShopName" class="text-danger"></span>
2020-09-25 13:50:04 -05:00
</div>
<div class="form-group">
2021-05-19 04:39:27 +02:00
<label asp-for="ApiKey" class="form-label"></label>
2021-04-08 06:37:05 +02:00
<input asp-for="ApiKey" class="form-control" readonly="@shopifyCredsSet" />
<span asp-validation-for="ApiKey" class="text-danger"></span>
2020-09-25 13:50:04 -05:00
</div>
<div class="form-group">
2021-05-19 04:39:27 +02:00
<label asp-for="Password" class="form-label"></label>
2021-04-08 06:37:05 +02:00
<input asp-for="Password" class="form-control" type="password" value="@Model?.Password" readonly="@shopifyCredsSet" />
<span asp-validation-for="Password" class="text-danger"></span>
2020-09-25 13:50:04 -05:00
</div>
2020-09-28 08:42:03 +02:00
<div class="alert alert-warning">
<p>
2021-05-19 04:39:27 +02:00
In Shopify please paste following script at <a href="@shopifyUrl/admin/settings/checkout#PolarisTextField1" target="_blank" class="fw-bold"> Settings > Checkout > Order Processing > Additional Scripts</a>
2020-09-28 08:42:03 +02:00
</p>
<kbd style="display: block; word-break: break-all;">
2021-04-08 06:37:05 +02:00
@($"<script src='{Url.Action("ShopifyJavascript", "Shopify", new {storeId = Context.GetRouteValue("storeId")}, Context.Request.Scheme)}'></script>")
2020-09-28 08:42:03 +02:00
</kbd>
</div>
2020-09-26 12:55:26 -05:00
<p class="alert alert-warning">
2021-05-19 04:39:27 +02:00
In Shopify please add a payment method at <a target="_blank" href="@shopifyUrl/admin/settings/payments" class="fw-bold"> Settings > Payments > Manual Payment Methods</a> with the name <kbd>Bitcoin with BTCPay Server</kbd>
2020-09-26 12:55:26 -05:00
</p>
<p class="alert alert-success">
2021-04-08 06:37:05 +02:00
Orders on <b>@Model.ShopName</b>.myshopify.com will be marked as paid on successful invoice payment.
Started: @Model.IntegratedAt.Value.ToBrowserDate()
2020-09-18 17:20:31 +02:00
</p>
<button name="command" type="submit" class="btn btn-danger" value="ShopifyClearCredentials">
2020-09-28 09:09:28 +02:00
Stop Shopify calls and clear credentials
2020-09-18 17:20:31 +02:00
</button>
}
</form>