Skip to Content
Switro Hosted Checkout

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

Checkout Flow light

The diagram above outlines the standard process when a customer initiates a purchase (checkout) on your platform:

  1. Your server initiates a checkout session by sending an API request to the Switro server.
  2. Switro responds with a hosted checkout page URL, provided as a redirect URL.
  3. Redirect the customer to the hosted checkout page to complete the payment process.
  4. Once the customer securely completes the wallet-to-wallet payment on Solana, Switro sends a webhook notification to your server.
  5. 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:

  1. Sign up for a Switro account at switro.com/app/dashboard
  2. Navigate to Settings > API Settings
  3. Get an API key for your environment (test or live)
  4. 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 -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.

FieldDescriptionType
amount_totalThis will be the total of items+shipping+taxesNumeric
amount_currencythe currency you want your customer to payString
itemslist of the items to show the customerArray

Optional Fields

All other fields are optional and can be left null if not applicable.

URL Redirects

TypeDescriptionExample
Success URLAfter successful paymenthttps://yourdomain.com/thank-you
Cancel URLIf customer cancels checkouthttps://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

  1. Go to Switro dashboard at switro.com/app/dashboard
  2. Navigate to Settings > API Settings in your Switro dashboard
  3. Enter the URL where Switro should send event notifications
  4. Select the events you want to receive (we recommend at least payment.succeeded and payment.failed)
  5. Save your webhook configuration