Skip to main content

Environments

Soap provides two environments for development and production use:

Sandbox

Use the sandbox environment for testing and development:

Production

For live transactions, use the production environment:

1. Get Your API Key

Sign in to your Soap Dashboard and navigate to the Developer section to get your API key.

2. Create a Customer

First, you need to create a customer in the Soap API.
curl -X POST https://api-sandbox.paywithsoap.com/api/v1/customers \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"first_name": "John", "last_name": "Doe", "email": "john.doe@example.com" }'
Response:
{
  "id": "cus_LzgkjLVrNPnHqp6gUsK8TBtQPq4kf6R1",
  "first_name": "John",
  "last_name": "Doe",
  "email": "john.doe@example.com",
  "internal_id": null,
  "phone_number": null,
  "date_of_birth": null,
  "created_at": "2025-03-05T19:41:29.994Z"
}

3. Create a Checkout Session

Now, you can create a checkout session for the customer. This call should happen on the backend of your application or platform. View the Soap Experiences PDF →

Receive Payments

Draft King's Style Deposit

Input form where the customer enters a custom deposit amount.

Preset Amount Deposit

Deposit a fixed amount (e.g. $100) into the customer’s balance.

Digital Goods Purchase

Purchase virtual currency, in-game tokens, and other digital goods.

Ecomm Purchase

Purchase physical goods such as nutraceuticals, peptides, supplements, and more.

Send Payments

Balance Withdrawal

Input form where the customer withdraws up to their available balance.

Preset Amount Withdrawal

Withdraw a fixed amount (e.g. $100) from the customer’s balance.
Here’s an example deposit request. Now you can redirect the customer to the hosted checkout.
curl -X POST https://api-sandbox.paywithsoap.com/api/v1/checkouts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "customer_id": "cus_LzgkjLVrNPnHqp6gUsK8TBtQPq4kf6R1", "type": "deposit" }'
Response:
{
  "id": "chk_xgTp6tGT9u5cnnY5SD5zUMoeca4SUtLJ",
  "url": "https://wallet-sandbox.paywithsoap.com?clientSecret=HMC3VTosbzJd7cLsoP3geC5QmSz8jqF6",
  "line_items": [],
  "line_items_total_amount_cents": null,
  "balance_amount_cents": null,
  "type": "deposit",
  "experience": null
}
Now redirect the customer to the url returned in the response. We handle the rest of the checkout flow.

4. Handle the Webhook

You will receive webhooks as the customer completes the checkout. More on webhooks can be found in the Webhooks section.

Full Example

A complete backend + frontend integration showing how to create a checkout session and redirect the customer.

Backend (Node.js)

app.post('/deposit', async (req, res) => {
  try {
    const user = { soap_customer_id: 'cus_LzgkjLVrNPnHqp6gUsK8TBtQPq4kf6R1' }
    
    const response = await fetch('https://api-sandbox.paywithsoap.com/api/v1/checkouts', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${process.env.SOAP_API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        customer_id: user.soap_customer_id,
        type: 'deposit'
      })
    });
    
    const checkoutSession = await response.json();
    
    res.json({ url: checkoutSession.url });
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});

Frontend (JavaScript)

document.getElementById('checkout-button').addEventListener('click', async () => {
  try {
    const response = await fetch('/deposit', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' }
    });
    
    const { url } = await response.json();
    window.location.href = url;
  } catch (error) {
    console.error('Error redirecting to checkout:', error);
  }
});

Additional Examples + Webhook Handling

Check out our sample code repository for a complete integration including webhook handling.

Sample Code Repository

Full working examples with webhook handling, error management, and more.