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.deo@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. The checkout session call should happen on the backend of your gaming platform. You will get a client secret that you will use to initialize the checkout page.
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/..."
}

4. Redirect the Customer to the Checkout Page

Now, redirect your player to the Wallet URL using the client_secret and returnUrl parameters.

Backend Code (Node.js)

After creating a checkout session, you’ll receive a response with the client_secret. Pass this to your frontend:
// In your backend route handler after creating checkout session
app.post('/deposit', async (req, res) => {
  try {
    // Make request to Soap API to create checkout session

    const user = { soap_customer_id: 'cus_LzgkjLVrNPnHqp6gUsK8TBtQPq4kf6R1' } // your signed in user
    
    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();
    
    // Return the client_secret to the frontend
    res.json({ 
      url: checkoutSession.url
    });
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});

Frontend Code (JavaScript)

In your frontend application, use the client_secret to construct the Wallet URL and redirect the user:
// Example usage
document.getElementById('checkout-button').addEventListener('click', async () => {
  try {
    // Fetch client_secret from your backend
    const response = await fetch('/deposit', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      }
    });
    
    const { url } = await response.json();
    
    // Redirect to Soap Wallet checkout
    window.location.href = url;
  } catch (error) {
    console.error('Error redirecting to checkout:', error);
  }
});
We handle the rest of the checkout flow for either a deposit or a withdrawal.

5. Handle the Webhook

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

6. Sample Code

We have a sample code repository that shows how to integrate Soap into your gaming platform, including how to handle webhooks. https://github.com/Soap-Payments/sample-code