> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paywithsoap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Learn how to make your first API call with Soap

## Environments

Soap provides two environments for development and production use:

### Sandbox

Use the sandbox environment for testing and development:

* Dashboard: [https://dashboard-sandbox.paywithsoap.com](https://dashboard-sandbox.paywithsoap.com)
* API: [https://api-sandbox.paywithsoap.com](https://api-sandbox.paywithsoap.com)
* Wallet: [https://wallet-sandbox.paywithsoap.com](https://wallet-sandbox.paywithsoap.com)

### Production

For live transactions, use the production environment:

* Dashboard: [https://dashboard.paywithsoap.com](https://dashboard.paywithsoap.com)
* API: [https://api.paywithsoap.com](https://api.paywithsoap.com)
* Wallet: [https://wallet.paywithsoap.com](https://wallet.paywithsoap.com)

## 1. Get Your API Key

Sign in to your [Soap Dashboard](https://dashboard-sandbox.paywithsoap.com) and navigate to the Developer section to get your API key.

While you're there, note that the Developer section also issues a separate **client secret**. You'll use your API key for almost everything in this guide; the client secret is only needed if you later call [Create Device Ping](https://docs.paywithsoap.com/api-reference/api-v1/device_pings/create.md) from the browser.

| Credential | Format | Used for |
| - | - | - |
| API key | `key_...` | Every endpoint in this guide |
| Client secret | `secret_...` | Only `POST /api/v1/device_pings` |

See [Authentication](https://docs.paywithsoap.com/api-reference/introduction.md#authentication) for the full explanation of both credentials.

## 2. Create a Customer

First, you need to create a customer in the Soap API.

```bash Curl theme={null}
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" }'
```

```javascript JavaScript theme={null}
const response = await fetch('https://api-sandbox.paywithsoap.com/api/v1/customers', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    first_name: 'John',
    last_name: 'Doe',
    email: 'john.doe@example.com'
  })
});

const customer = await response.json();
console.log(customer);
```

```python Python theme={null}
import requests

response = requests.post(
    'https://api-sandbox.paywithsoap.com/api/v1/customers',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'first_name': 'John',
        'last_name': 'Doe',
        'email': 'john.doe@example.com'
    }
)

print(response.json())
```

```ruby Ruby theme={null}
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://api-sandbox.paywithsoap.com/api/v1/customers')
request = Net::HTTP::Post.new(uri)
request.content_type = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_KEY'
request.body = {
  first_name: 'John',
  last_name: 'Doe',
  email: 'john.doe@example.com'
}.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
```

Response:

```json theme={null}
{
  "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 →](https://drive.google.com/file/d/1QJHS4QqnpExpCuNpHBd-6eDpo4lTD9KQ/view)

#### Receive Payments

> [card] [Draft King's Style Deposit](https://docs.paywithsoap.com/api-reference/api-v1/checkouts/draftkings-deposit.md)
>
> Input form where the customer enters a custom deposit amount.

> [card] [Preset Amount Deposit](https://docs.paywithsoap.com/api-reference/api-v1/checkouts/preset-deposit.md)
>
> Deposit a fixed amount (e.g. \$100) into the customer's balance.

> [card] [Digital Goods Purchase](https://docs.paywithsoap.com/api-reference/api-v1/checkouts/sweeps-purchase.md)
>
> Purchase virtual currency, in-game tokens, and other digital goods.

> [card] [Ecomm Purchase](https://docs.paywithsoap.com/api-reference/api-v1/checkouts/ecomm-purchase.md)
>
> Purchase physical goods such as nutraceuticals, peptides, supplements, and more.

#### Send Payments

> [card] [Balance Withdrawal](https://docs.paywithsoap.com/api-reference/api-v1/checkouts/balance-withdrawal.md)
>
> Input form where the customer withdraws up to their available balance.

> [card] [Preset Amount Withdrawal](https://docs.paywithsoap.com/api-reference/api-v1/checkouts/preset-withdrawal.md)
>
> 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.

```bash Curl theme={null}
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" }'
```

```javascript JavaScript theme={null}
const response = await fetch('https://api-sandbox.paywithsoap.com/api/v1/checkouts', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    customer_id: 'cus_LzgkjLVrNPnHqp6gUsK8TBtQPq4kf6R1',
    type: 'deposit'
  })
});

const checkout = await response.json();
console.log(checkout);
```

```python Python theme={null}
import requests

response = requests.post(
    'https://api-sandbox.paywithsoap.com/api/v1/checkouts',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'customer_id': 'cus_LzgkjLVrNPnHqp6gUsK8TBtQPq4kf6R1',
        'type': 'deposit'
    }
)

print(response.json())
```

```ruby Ruby theme={null}
require 'net/http'
require 'uri'
require 'json'

uri = URI.parse('https://api-sandbox.paywithsoap.com/api/v1/checkouts')
request = Net::HTTP::Post.new(uri)
request.content_type = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_KEY'
request.body = {
  customer_id: 'cus_LzgkjLVrNPnHqp6gUsK8TBtQPq4kf6R1',
  type: 'deposit'
}.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
```

Response:

```json theme={null}
{
  "id": "chk_xgTp6tGT9u5cnnY5SD5zUMoeca4SUtLJ",
  "client_secret": "HMC3VTosbzJd7cLsoP3geC5QmSz8jqF6",
  "url": "https://wallet-sandbox.paywithsoap.com?clientSecret=HMC3VTosbzJd7cLsoP3geC5QmSz8jqF6",
  "line_items": [],
  "line_items_total_amount_cents": null,
  "balance_amount_cents": null,
  "type": "deposit",
  "fixed_amount_cents": null,
  "experience": null,
  "payment_options": null
}
```

Now redirect the customer to the `url` returned in the response. We handle the rest of the checkout flow.

> [!TIP]
>
> Prefer to keep customers on your page? Instead of redirecting, embed the `url` in an `<iframe allow="payment; geolocation">` (`geolocation` is required for location checks that use the browser's location; a check Soap makes by IP address alone, where your account has that turned on, still works without it). See [Embedded Checkout](https://docs.paywithsoap.com/get_started/embedded-checkout.md).

## 4. Handle the Webhook

You will receive webhooks as the customer completes the checkout.

More on webhooks can be found in the [Webhooks](https://docs.paywithsoap.com/api-reference/api-v1/webhooks/webhooks.md) section. To configure your webhook URL and enable additional events, see [Receiving Webhooks](https://docs.paywithsoap.com/api-reference/api-v1/webhooks/setup.md).

> [!NOTE]
>
> Soap doesn't store your customers' balances — you own the ledger. For withdrawals, you supply the customer's balance yourself via `balance_amount_cents`. See [You Own the Ledger](https://docs.paywithsoap.com/api-reference/api-v1/checkouts/balance-withdrawal.md#you-own-the-ledger) for the full explanation, including the hold lifecycle that keeps customers from double-spending.

## Full Example

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

### Backend (Node.js)

```javascript theme={null}
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)

```javascript theme={null}
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;

    // Or, to keep the customer on your page, embed instead of redirecting:
    // document.querySelector('iframe').src = url;  // <iframe allow="payment; geolocation">
  } catch (error) {
    console.error('Error redirecting to checkout:', error);
  }
});
```

To render checkout in-context instead of redirecting, see [Embedded Checkout](https://docs.paywithsoap.com/get_started/embedded-checkout.md).

## Additional Examples + Webhook Handling

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

> [card] [Sample Code Repository](https://github.com/Soap-Payments/sample-code)
>
> Full working examples with webhook handling, error management, and more.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.