Examples / Ví dụ

English | Tiếng Việt

English

Basic Examples

Simple Payment

import { OlymPaySDK } from '@olympay/sdk';

const olymPay = new OlymPaySDK({
  apiKey: 'your-api-key',
  network: 'mainnet'
});

// Create and execute a simple payment
async function makePayment() {
  try {
    const payment = await olymPay.createPayment({
      amount: '100.00',
      currency: 'USD',
      recipient: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
      description: 'Payment for services'
    });

    const result = await payment.execute();
    
    if (result.success) {
      console.log('Payment successful:', result.transactionHash);
    } else {
      console.error('Payment failed:', result.error);
    }
  } catch (error) {
    console.error('Error:', error.message);
  }
}

makePayment();

Wallet Connection

E-commerce Examples

Online Store Integration

DeFi Examples

Liquidity Pool Management

Yield Farming

Cross-Chain Examples

CCIP Cross-Chain Transfer

Earning Platform Examples

Quest System

Error Handling Examples

Comprehensive Error Handling


Tiếng Việt

Ví dụ Cơ bản

Thanh toán Đơn giản

Kết nối Ví

Ví dụ Thương mại điện tử

Tích hợp Cửa hàng Trực tuyến

Ví dụ DeFi

Quản lý Pool Thanh khoản

Yield Farming

Ví dụ Chuỗi chéo

Chuyển Chuỗi chéo CCIP

Ví dụ Nền tảng Earning

Hệ thống Quest

Ví dụ Xử lý Lỗi

Xử lý Lỗi Toàn diện