Guides
Create a payment link
Create a crypto payment link, QR code or website widget, and get paid in USDC or SOL. Use the dashboard or the API.
In the dashboard
Add the details
Open Payment links, then create a new link. Choose what it is for, then add a title and price. The preview shows what your customer will see.

The form and preview. Shown with sample data. Share it
Copy the link, download the QR code, or copy the code for your website.

Ways to share a payment link. Shown with sample data. Check what your customer sees

The payment page. Shown with sample data.
With the API
You need Node.js 22 or later, and an API v2 key with the links:write permission. Save connect.mjs in your project, then get a devnet key:
node connect.mjs links.env links:writeSave this sample in the same folder:
// Needs an API v2 key with the links:write permission.
const API = process.env.SWITRO_API_URL ?? "https://www.switro.com/api";
const response = await fetch(`${API}/v2/payment-links`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SWITRO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
title: "Blue stoneware plates",
description: "A set of four.",
amount: 58,
// Sending this again gives you the same link, not a second one.
idempotency_key: "plates-link-0001",
}),
});
const link = await response.json();
if (!response.ok) throw new Error(`Switro answered ${response.status}: ${link.message}`);
console.log(`Share this link: ${link.url}`);Then run it:
node --env-file=links.env create-payment-link.mjsUse a new idempotency key for each new link
See every field in the API reference.
On your website
Add this where you want the payment form to be. Replace YOUR_LINK_ID with your link's ID, or copy the finished code from the dashboard. You don't need an API key.
<div class="sw-widget" data-id="YOUR_LINK_ID"></div>
<script src="https://www.switro.com/static/js/sw-widget.js"></script>- Load the script only once, even if the page has several widgets.
- If your website has a Content Security Policy, allow
https://www.switro.cominscript-srcandframe-src. - In React, use
classNameinstead ofclass.
The widget does not prove payment


