Accept crypto on Shopify

Coming soon

There's no SorenPay app on Shopify yet, and checkout runs with test money only. Payments are recorded in your SorenPay ledger as a stablecoin credit that can't be spent or withdrawn yet.

Try it today (embed SDK on the product page, in sandbox)

You can add a "Buy with Crypto" button to product pages that opens our hosted checkout.

1. Add the script

In Shopify admin → Online Store → Themes → Edit code → theme.liquid, add before </head>:

<script src="https://sorenpay.com/checkout.js" async></script>

2. Create the session endpoint (Shopify App or external)

The endpoint that calls our API needs to live somewhere that can hold your apk_ key. Three options:

  • A. Shopify App proxy — set up an app proxy that forwards /apps/soren/session to your server
  • B. External serverless function — Vercel/Netlify/Cloudflare Worker
  • C. Embed Shopify Functions — use a backend extension with secret env vars

For (B), here's a Vercel function:

api/create-soren-session.tstypescript
export default async function handler(req, res) {
const result = await fetch("https://sorenpay.com/api/v1/checkout/sessions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SOREN_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    amountUsdCents: req.body.amountUsdCents,
    description: req.body.description,
    merchantReference: req.body.shopifyOrderId,
    successUrl: `https://yourstore.com/${req.body.shopHandle}/orders/${req.body.shopifyOrderId}/thanks`,
    acceptedAssets: ["USDC", "USDT"],
    // Leave out acceptedChains: the session takes the networks your coins can be paid on.
  }),
});
res.json(await result.json());
}

3. Add the button to product pages

In Shopify admin → Online Store → Themes → Customize → Product, drop a custom HTML block:

<button
data-soren-checkout
data-amount-cents="{{ product.price | times: 1 }}"
data-description="{{ product.title }}"
data-session-endpoint="https://your-vercel.app/api/create-soren-session"
class="btn btn--primary"
>
Buy with Crypto · {{ product.price | money }}
</button>

4. Mark the Shopify order paid after confirmation

When the checkout.session.completed webhook arrives (ask support@sorenpay.com to add your endpoint), call the Shopify Admin API to mark the order paid:

// In your webhook handler for checkout.session.completed
await fetch(`https://${shop}/admin/api/2024-10/orders/${orderId}/transactions.json`, {
method: "POST",
headers: { "X-Shopify-Access-Token": shopifyToken, "Content-Type": "application/json" },
body: JSON.stringify({
  transaction: { kind: "capture", status: "success", amount: event.data.amountUsdCents / 100 }
}),
});

Later (a Shopify payments app)

The plan is a Shopify payments app, so SorenPay shows up as a payment method in Shopify's own checkout with no theme edits. It isn't built or submitted to Shopify yet. See Shopify app status.