Switro Hosted Checkout
Switro Hosted Checkout lets you accept secure, instant Solana wallet-to-wallet payments directly on your website or app—no intermediaries, no custody risk, and no withdrawal steps. Instantly convert received SOL to USDC to avoid market volatility, all with a low 0.5% fee (paid by the payer).
Whether you’re selling products, subscriptions, or services, Switro Hosted Checkout is a simple, no-code solution for crypto payments.
Demo Widget
This demo shows the customer experience when using Switro Hosted Checkout.
How It Works
The diagram above outlines the standard process when a customer initiates a purchase (checkout) on your platform:
- Your server initiates a checkout session by sending an API request to the Switro server.
- Switro responds with a hosted checkout page URL, provided as a redirect URL.
- Redirect the customer to the hosted checkout page to complete the payment process.
- Once the customer securely completes the wallet-to-wallet payment on Solana, Switro sends a webhook notification to your server.
- Your system verifies the payment status and proceeds to fulfill the order.
Getting Started
Get Your API Key
To start using Switro Hosted Checkout, you’ll need API credentials:
- Sign up for a Switro account at switro.com/app/dashboard
- Navigate to Settings > API Settings
- Get an API key for your environment (test or live)
- Store your API key securely—never expose it in client-side code
Create a Checkout Session
Use the API to create a checkout session for your customer. Switro supports wallet-to-wallet Solana payments and instant USDC conversion.
CURL
curl -X POST https://switro.com/api/v1/checkout \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_api_key>" \
-H "X-Network: mainnet" \
-d '{
"customer_name": "John Doe",
"customer_email": "john@example.com",
"customer_phone": "+1234567890",
"customer_address": "123 Main St, City, Country",
"amount_total": 326.48,
"amount_shipping": 12.99,
"amount_tax": 8.99,
"amount_currency": "USD",
"cancel_url": "https://example.com/cancel",
"success_url": "https://example.com/success",
"items": [
{
"item_title": "Headphone",
"item_quantity": 1,
"item_amount": 80.50,
"item_description": "JBL Tune 720BT",
"item_image_url": "https://example.com/image.jpg"
},
{
"item_title": "Tab",
"item_quantity": 2,
"item_amount": 112.00,
"item_description": "Lenovo Tab M10 HD 2nd Gen Folio Case",
"item_image_url": "https://example.com/image.jpg"
}
]
}'
API Response
When this request is successfully processed by the server, it returns a structured JSON object containing essential details about the hosted checkout page. The response includes a unique id for the page and a full url, which can be used for redirection. This allows you to programmatically handle user navigation or integrate the hosted page into different parts of your application.
{
"id": "5b34490d-89f9-4f16-be7a-331cb672d095",
"url": "http://localhost:3001/p/checkout/5b34490d-89f9-4f16-be7a-331cb672d095"
}
Checkout API Fields Configuration
Switro’s checkout page lets you control what information is collected from customers. You can configure required and optional fields, and specify redirect URLs after success or cancellation. All payments are processed directly from the payer’s wallet to your wallet—no custody, no withdrawal steps.
Required Fields
Switro does not compute the grand total by aggregating item amounts, shipping fees, and taxes. Instead, it directly displays and processes the amount_total value provided in the request. Therefore, please ensure that this parameter reflects the final total after all necessary calculations.
Field | Description | Type |
---|---|---|
amount_total | This will be the total of items+shipping+taxes | Numeric |
amount_currency | the currency you want your customer to pay | String |
items | list of the items to show the customer | Array |
Optional Fields
All other fields are optional and can be left null if not applicable.
URL Redirects
Type | Description | Example |
---|---|---|
Success URL | After successful payment | https://yourdomain.com/thank-you |
Cancel URL | If customer cancels checkout | https://yourdomain.com/cancel |
- These two fields are used to specify the URLs where users should be redirected after a successful or failed payment. Both fields are optional — if left empty, the success or failure status will be displayed on the same page by default. However, we strongly recommend providing appropriate URLs to ensure a smoother and more controlled user experience.
Always use HTTPS URLs for security and trust.
Webhooks
Webhooks allow your system to receive real-time updates about payment status changes.
Setting Up Webhooks
- Go to Switro dashboard at switro.com/app/dashboard
- Navigate to Settings > API Settings in your Switro dashboard
- Enter the URL where Switro should send event notifications
- Select the events you want to receive (we recommend at least
payment.succeeded
andpayment.failed
) - Save your webhook configuration