Skip to main content

Quick Start 🚀

Get up and running with DolphinPay in just a few simple steps.

1. Prerequisites

Before you begin, make sure you have:

  • Node.js 18+ or Bun
  • Sui CLI installed
  • Sui Wallet (browser extension)
  • Testnet SUI tokens for testing

Install Sui CLI

# Using cargo (recommended)
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui

# Or download from releases: https://github.com/MystenLabs/sui/releases

Get Testnet SUI

  1. Join the Sui Discord
  2. Use the faucet command: !faucet <your-sui-address>
  3. Or visit: https://docs.sui.io/guides/developer/getting-started/get-coins

2. Smart Contract Setup

Clone and Build

# Clone the repository
git clone https://github.com/dolphinslab/dolphin-pay.git
cd dolphin-pay

# Build the smart contracts
sui move build

Deploy to Testnet

# Deploy to testnet
sui client publish --gas-budget 100000000

Expected Output:

Package ID: 0x9c7ca262d020b005e0e6b6a5d083b329d58716e0d80c07b46804324074468f9c
note

Save the Package ID - you'll need it for SDK integration!

3. SDK Integration

Install the SDK

cd sdk
npm install
npm run build

Basic Usage

import { createClient, suiToMist } from "@dolphinpay/sdk"

// Initialize client with your deployed package
const client = createClient({
packageId:
"0x9c7ca262d020b005e0e6b6a5d083b329d58716e0d80c07b46804324074468f9c",
network: "testnet",
})

// Create a payment
const txb = client.payment.buildCreatePayment({
merchant: "0xYOUR_MERCHANT_ADDRESS",
amount: suiToMist(10), // 10 SUI
currency: "SUI",
description: "Payment for services",
expirySeconds: 3600, // 1 hour
})

// Execute with wallet
await wallet.signAndExecuteTransactionBlock({
transactionBlock: txb,
})

4. Frontend Integration

Setup Frontend

cd frontend
npm install

# Copy environment variables
cp .env.example .env.local

Configure Environment

Edit frontend/.env.local:

NEXT_PUBLIC_SUI_NETWORK=testnet
NEXT_PUBLIC_PACKAGE_ID=0x9c7ca262d020b005e0e6b6a5d083b329d58716e0d80c07b46804324074468f9c

Run Development Server

npm run dev
# Open http://localhost:3000

5. Test Your Integration

1. Connect Wallet

  • Click "Connect Wallet" in the header
  • Select your Sui wallet
  • Switch to testnet if needed

2. Create a Payment

  • Navigate to "Create Payment"
  • Enter a merchant address (any Sui address)
  • Set amount (0.1 - 1000 SUI)
  • Add a description
  • Click "Create Payment"

3. Execute Payment

  • You'll be redirected to wallet approval
  • Confirm the transaction
  • Wait for confirmation

4. Verify on Explorer

  • Copy the transaction hash
  • Check on SuiVision Explorer
  • Verify the payment object was created

🚀 What's Next?

Now that you have a basic integration working, explore these next steps:

📚 Learn More

🏗️ Build Something

🛠️ Deploy to Production

💡 Tips for Success

  1. Start with Testnet - Always test on testnet first
  2. Use Dry Run - Test transactions without gas costs
  3. Monitor Gas Usage - Track transaction costs in production
  4. Handle Errors - Implement proper error handling
  5. Stay Updated - Follow Sui network updates and breaking changes

🔧 Troubleshooting

Common Issues

Transaction Failed

  • Check you have enough testnet SUI
  • Verify the merchant address is valid
  • Ensure amount is within limits (0.0001 - 1000 SUI)

Wallet Not Connecting

  • Ensure wallet extension is installed
  • Check wallet is on testnet
  • Try refreshing the page

Build Errors

  • Delete node_modules and reinstall
  • Check Node.js version (18+)
  • Verify all dependencies are installed

Get Help


Congratulations! 🎉 You've successfully integrated DolphinPay. Ready to build something amazing?