Marketplace class is built for platform operators running multi-seller marketplaces. It uses your platform account credentials to create payment orders, onboard connected seller accounts, cancel marketplace transactions, and transfer funds between the platform and connected accounts.
Initialization
Your platform account’s OAuth 2.0 Client ID.
Your platform account’s OAuth 2.0 Client Secret.
Your platform merchant UUID, used for Basic Auth endpoints such as payment source management and webhook-key retrieval.
Your platform merchant API key, used as the Basic Auth password.
Stored on the client and used by the source-code helper when no source code is passed to that helper. Pass source codes in method options when a Marketplace endpoint requires one.
When
true, the client uses VivaWallet demo endpoints for API calls.Available Modules
payments
Create marketplace payment orders and cancel unpaid orders through the shared payment-order cancellation helper.
sellers
Create, retrieve, and update connected seller accounts, including payout settings supplied in account payloads.
transactions
Retrieve and create transactions through shared transaction helpers, and cancel Marketplace transactions with Marketplace-specific refund options.
transfers
Send funds to connected accounts with
sendFunds() and reverse transfers with createTransferReversal().webhooks
Manage webhook subscriptions and retrieve the platform account webhook key.
source
Manage payment source codes for the platform merchant account.
Usage Example
How Marketplace Payments Work
In a marketplace flow, payment orders are created under the platform account. Once a customer completes payment, your platform distributes funds to connected accounts using thetransfers module.
1
Create a payment order
Use
marketplace.payments.createOrder() to generate an order on the platform account.2
Redirect the customer
Use
getSmartCheckout() to build the checkout URL and redirect the customer.3
Handle the payment webhook
Use the webhook event payload to capture the transaction identifier and reconcile payment state.
4
Transfer funds to the connected account
Call
marketplace.transfers.sendFunds() with the connected account ID and amount to distribute.5
Reverse a transfer if needed
Use
marketplace.transfers.createTransferReversal(transferId, options) when a seller payout must be reversed.Related Guides
Marketplace Payments
Create marketplace payment orders on your platform account.
Marketplace Sellers
Onboard sellers as connected accounts and configure payout settings.
Marketplace Transfers
Send funds to connected accounts and handle reversals.