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

# Marketplace Class – Multi-Seller Platform Reference

> Complete reference for the Marketplace class constructor configuration options, and sub-client modules for multi-seller platform integrations.

`Marketplace` is the client class for multi-seller platform integrations. It covers platform payment orders, connected seller accounts, Marketplace transaction cancellation, fund transfers, webhooks, and payment source helpers.

## Constructor

```typescript theme={null}
new Marketplace(options: {
  clientId: string;
  clientSecret: string;
  merchantId: string;
  apikey: string;
  sourceCode?: string | null;
  dev?: boolean;
  logs?: boolean;
})
```

Import and instantiate the Marketplace client with your platform credentials:

```typescript theme={null}
import { Marketplace } from '@nkhind/vivawallet-sdk';

const marketplace = new Marketplace({
  clientId: 'your-smartcheckout-client-id',
  clientSecret: 'your-smartcheckout-client-secret',
  merchantId: 'your-merchant-uuid',
  apikey: 'your-api-key',
  dev: false,
});
```

<ParamField path="clientId" type="string" required>
  OAuth 2.0 Client ID for the platform account.
</ParamField>

<ParamField path="clientSecret" type="string" required>
  OAuth 2.0 Client Secret paired with `clientId` for token requests.
</ParamField>

<ParamField path="merchantId" type="string" required>
  Merchant UUID of the platform account. Used as the username in Viva Basic Auth requests.
</ParamField>

<ParamField path="apikey" type="string" required>
  API key for the platform account. Used as the Basic Auth password.
</ParamField>

<ParamField path="sourceCode" type="string | null">
  Stored on the client for source-code helpers. Pass source codes in method options when a Marketplace endpoint requires one.
</ParamField>

<ParamField path="dev" default="false" type="boolean">
  When `true`, the client uses VivaWallet demo endpoints for API calls.
</ParamField>

<ParamField path="logs" default="false" type="boolean">
  Enables internal SDK error logging when `true`.
</ParamField>

***

## Sub-client Modules

Each module is available as a property on the `Marketplace` instance.

| Module         | Type                      | Description                                                                          |
| -------------- | ------------------------- | ------------------------------------------------------------------------------------ |
| `payments`     | `MarketPlacePayments`     | Create Marketplace payment orders and cancel unpaid orders through the shared helper |
| `sellers`      | `MarketPlaceSellers`      | Create, retrieve, and update connected seller accounts                               |
| `transactions` | `MarketPlaceTransactions` | Shared transaction helpers plus Marketplace transaction cancellation                 |
| `transfers`    | `MarketPlaceTransfers`    | Send funds to connected accounts and create transfer reversals                       |
| `webhooks`     | `VivaWebhooks`            | Webhook subscription management and webhook-key retrieval                            |
| `source`       | `VivaSourceCode`          | Payment source-code helpers                                                          |

***

## Common Methods

### `marketplace.transfers.sendFunds(data)`

```typescript theme={null}
marketplace.transfers.sendFunds({
  connectedAccountId: 'connected-account-id',
  amount: 4500,
  transactionId: 'transaction-id',
  description: 'Seller payout',
})
```

Sends funds from the platform account to a connected account.

### `marketplace.transfers.createTransferReversal(transferId, options)`

```typescript theme={null}
marketplace.transfers.createTransferReversal('transfer-id', {
  amount: null,
})
```

Creates a full or partial reversal for an existing transfer. Pass `amount: null` or omit the options object for a full reversal.

### `marketplace.transactions.cancelTransaction(transactionId, refundOptions)`

```typescript theme={null}
marketplace.transactions.cancelTransaction('transaction-id', {
  amount: 5000,
  reverseTransfers: true,
  refundPlatformFee: true,
})
```

Cancels or refunds a Marketplace transaction with Marketplace-specific refund options.

### `getVivaWebhookCode()`

```typescript theme={null}
marketplace.getVivaWebhookCode(): Promise<MethodReturn<string | null, 'webhookerror'>>
```

Deprecated compatibility helper. Prefer `marketplace.webhooks.retrieveWebhookKey()`.

```typescript theme={null}
const result = await marketplace.webhooks.retrieveWebhookKey();
```
