Getting Started
Playsout Hybrid SDK (PHSDK) is a Web3 wallet App WebView SDK for web games. With one JS API, games can integrate:
- Wallet login (address identity)
- ERC20 payment purchases
- Entitlement delivery and restore (Phase 1: local)
- Wallet chain/account events
Phase 1 (v0.1) highlights
- No native host code required
- Relies on injected
window.ethereum(EIP-1193)- Payments are ERC20 transfers
- Best for offline or light-backend Web3 games
Use cases
✅ Good fit:
- Web3 wallet App WebView games
- ERC20 token payments (USDC / USDT / custom tokens)
- Offline games (local saves)
- Light-backend games (on-chain transactions are the source of truth)
⚠️ Phase 1 is NOT for:
- Fiat payments / IAP
- Host account login
- High-value items or strong anti-fraud (needs backend or native)
Install
NPM
npm install @playsout/hybrid-sdkCDN (example)
<script src="https://cdn.playsout.io/phsdk/v0.1/phsdk.min.js"></script>Debug: if the host only provides WebView +
window.ethereum, inject the mock bridge first:
<script src="/path/to/bridge.mock.js"></script>Initialize
import { PHSDK } from "@playsout/hybrid-sdk";
const sdk = await PHSDK.init({
pay: {
productMapping: {
/* See Examples */
},
},
});productMapping is the Phase 1 security boundary: the game client cannot pass arbitrary amounts; all pricing, token, and chain info comes from config.
Purchase (minimal)
const result = await sdk.pay.purchase({ productId: "coin_pack_1" });
console.log(result.status, result.txHash);Possible status values:
REJECTED: user rejected the signatureSUBMITTED: transaction broadcasted, pending confirmationCONFIRMED: at least 1 confirmationFAILED: transaction failed (revert / status=0)
Recommended: capability checks
const caps = await sdk.env.getCapabilities();
if (!caps.modules.pay.purchase) alert("Payment not supported in this wallet");Supported wallets
Any wallet App WebView that injects an EIP-1193 provider (window.ethereum), for example:
- MetaMask Mobile
- OKX Wallet
- Bitget Wallet
- Trust Wallet
- Other compatible wallets
Architecture (simplified)
Game (H5)
↓
Playsout Hybrid SDK (JS)
↓
Adapter (EIP-1193)
↓
window.ethereum
↓
Wallet AppRoadmap (Phase 2)
- Native host payments (Web2 / IAP)
- Host account login
- Secure Storage (native)
- Server-side entitlements
- Paymaster / gas-sponsored TX
- NFT / on-chain entitlements