Eppay 文档

集成和使用 Eppay 加密货币支付网关的完整指南

简介

Eppay 是一个安全、无缝的加密货币支付网关,旨在使 USDT 交易在多个区块链网络上轻松进行。无论您是希望进行加密货币支付的个人用户,还是将支付功能集成到应用程序中的开发人员,Eppay 都能提供您所需的工具和基础设施。

注意: Eppay 目前支持跨多个区块链网络的 USDT 交易,包括 Ethereum、Binance Smart Chain、Polygon、Avalanche 等。

面向用户

在多个区块链网络上快速、安全地发送和接收 USDT 支付,费用最低。

了解更多

面向开发者

使用我们简单的 API 和开发者友好的工具,将 Eppay 的支付系统集成到您的应用程序中。

了解更多

用户指南

开始使用

1

下载应用

从 App Store 或 Google Play Store 下载 Eppay。

2

创建钱包

按照屏幕上的说明创建您的安全钱包。确保安全存储您的恢复短语。

3

为钱包充值

从另一个钱包或交易所向您的钱包添加 USDT。确保有一些原生代币(ETH、BNB 等)用于交易费用。

4

设置安全

启用生物识别认证并创建 PIN 以增加安全性。这些将用于确认交易。

接收付款

Eppay 应用通过简单的二维码流程轻松请求和接收付款:

  1. 1

    点击应用中的"收款"按钮。

  2. 2

    在出现的模态窗口中,选择您希望接收付款的区块链网络。

  3. 3

    输入您希望接收的 USDT(或您选择的付款货币)金额。

    注意:您可以在应用设置中选择您的首选付款货币。

  4. 4

    点击"生成二维码"创建付款请求。

  5. 5

    与付款人分享生成的二维码。他们可以使用 Eppay 应用扫描它以完成付款。

  6. 6

    当付款在区块链上确认后,您将收到通知。

提示: 二维码包含所有必要的付款信息。付款人只需使用其 Eppay 应用扫描它 - 无需手动输入!

发送付款

使用 Eppay 进行支付快速而简单:

  1. 1

    打开 Eppay 应用并点击"付款"按钮。

  2. 2

    使用相机扫描收款人提供的二维码。

    二维码包含所有必要的付款信息,包括金额、收款地址和网络。

  3. 3

    查看屏幕上显示的付款详情。

  4. 4

    使用您的 PIN 或生物识别认证确认交易。

  5. 5

    等待交易在区块链上处理。

  6. 6

    确认后,您和收款人都将收到成功付款的通知。

重要: 始终确保您有足够的 USDT 和原生代币(ETH、BNB、MATIC 等)来支付付款金额和所选网络上的交易费用。

开发者指南

集成概述

Eppay 提供了一个简单的 API,允许开发人员将加密货币支付功能集成到他们的应用程序中。集成过程简单,所需设置最少。

注册并获取 API 密钥

eppay.io 创建账户并从仪表板生成您的 API 密钥。

API 集成

将 Eppay API 集成到您的应用程序中以生成付款请求并接收付款确认。

二维码生成

为用户生成并显示二维码,以便使用 Eppay 应用扫描。

付款验证

通过 API 调用验证付款状态并相应更新您的应用程序。

集成流程

以下是将 Eppay 支付集成到应用程序的分步过程:

  1. 1

    注册并获取 API 密钥

    eppay.io 注册并导航到仪表板中的 API 部分以生成您的 API 密钥。

  2. 2

    创建付款请求

    当用户在您的应用程序中发起付款时,向 Eppay API 端点(https://eppay.io/generate-code)发送 POST 请求,包含所需的付款详情:

    • 您的 API 密钥
    • 付款金额
    • 收款钱包地址
    • 网络 RPC 地址
    • 代币合约地址
    • 成功回调 URL
  3. 3

    接收付款 ID

    API 将为此交易返回唯一的 paymentId

  4. 4

    生成二维码

    创建格式为 product=uuideppay&id=PAYMENT_ID 的二维码,其中 PAYMENT_ID 是上一步的唯一标识符。

  5. 5

    向用户显示二维码

    向用户展示二维码,他们可以使用 Eppay 应用扫描它以完成付款。

  6. 6

    检查付款状态

    在显示二维码时,通过向 https://eppay.io/payment-status/{paymentId} 发送 GET 请求定期检查付款状态。

  7. 7

    处理付款确认

    当状态返回 true 时,付款已成功完成。相应更新您的应用程序并继续处理用户的订单或服务。

注意: Eppay 应用处理所有区块链交互,使付款过程对您的用户无缝衔接,无需他们具备加密货币交易的技术知识。

官方集成包

跳过手动集成!使用我们的官方包以最快的方式将 EpPay 集成到您的应用程序中。

Laravel 包

官方 Laravel 包,带有 Blade 组件、facades 和自动发现。非常适合 Laravel 10 和 11 应用程序。

安装:
composer require eppay/laravel-eppay
快速入门:
// .env
EPPAY_API_KEY=your-api-key

// Controller
use EpPay\LaravelEpPay\Facades\EpPay;

$payment = EpPay::generatePayment(100.00);

// Blade
<x-eppay-payment-qr
    :payment-id="$payment['paymentId']"
    :auto-refresh="true"
/>

JavaScript/TypeScript SDK

用于 Node.js 后端和前端框架(React、Vue、Angular、Next.js、Express)的完整 TypeScript SDK。

安装:
npm install eppay
# or
yarn add eppay
快速入门:
import { EpPayClient, EpPayWidget } from 'eppay';

// Backend (Node.js/Express/Next.js)
const client = new EpPayClient({ apiKey: 'your-key' });
const payment = await client.generatePayment({ amount: 100 });

// Frontend Widget
const widget = new EpPayWidget({
  paymentId: payment.paymentId,
  container: '#payment',
  autoRefresh: true
});
await widget.init();

Shopify 应用集成

使用我们的原生应用集成,直接在您的 Shopify 商店中接受加密货币支付。无需编码!

工作原理:
  1. 1. 访问 eppay.io/shopify 并安装应用
  2. 2. 使用 OAuth 认证连接您的 Shopify 商店
  3. 3. 将加密货币支付按钮添加到您的结账页面
  4. 4. 客户使用 EpPay 移动应用扫描二维码即可立即付款
集成代码:
<button onclick="payWithCrypto()">Pay with Crypto</button>

<script>
async function payWithCrypto() {
  const response = await fetch('https://eppay.io/shopify/api/payments/create', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      amount: {{ "{{ cart.total_price }}" }},
      order_id: {{ "{{ order.id }}" }}
    })
  });
  const { paymentId } = await response.json();
  window.location.href = 'https://eppay.io/shopify/payment/' + paymentId;
}
</script>

安全快速: OAuth 认证、实时付款验证、自动订单确认,支持多个区块链网络上的 USDT、USDC、ETH、BNB。

包功能:

所有包都包含:
  • 付款生成
  • 状态验证
  • 内置二维码生成
  • 自动轮询小部件
  • TypeScript/PHP 类型
  • 全面的文档
平台支持:
  • Laravel 10 & 11
  • React & Next.js
  • Vue.js & Nuxt
  • Angular
  • Express & Node.js
  • Shopify Stores

API 参考

生成代码

POST https://eppay.io/generate-code

创建新的付款请求并返回唯一的付款 ID。

请求参数

参数 类型 必需 描述
apiKey String 来自 Eppay 仪表板的 API 密钥
amount String 请求的 USDT 金额
to String 受益人的钱包地址
rpc String 网络的 RPC 地址
token String 所选网络上的 USDT 代币地址
success String 接收成功通知的回调 URL

请求示例

{
    "apiKey": "WlJSciIhgHkUzduirHj2AqIwxFvVGN",
    "amount": "1",
    "to": "0x8AB960B95aCCc5080c15721fdeA30e72C8251F0b",
    "rpc": "https://rpc.scimatic.net",
    "token": "0x65C4A0dA0416d1262DbC04BeE524c804205B92e8",
    "success": "https://eppay.io/payment-success"
}

响应

{
    "paymentId": "8a020135-19b7-42df-be4b-1a8722ad0570"
}

二维码格式

二维码应使用以下格式生成:

product=uuideppay&id=PAYMENT_ID

其中 PAYMENT_ID 是 API 返回的唯一标识符。

注意: product=uuideppay 部分是一个固定字符串,用于标识二维码为 Eppay 付款请求。Eppay 应用识别此格式并相应处理付款。

检查支付状态

GET https://eppay.io/payment-status/{paymentId}

使用付款 ID 检查付款状态。

路径参数

参数 类型 描述
paymentId String (UUID) 从 generate-code 端点返回的唯一付款 ID

响应示例

{
    "status": true
}

重要: 在向用户显示二维码时,您应该使用此端点定期检查付款状态。当状态返回 true 时,表示付款已成功处理。

状态值

描述
true (or 1) 付款已成功完成
false (or 0) 付款待处理或尚未发起

回调响应

当付款完成时,Eppay 还会向初始请求中指定的回调 URL 发送 POST 请求。

{
    "success": "success",
    "message": "Payment updated successfully",

}

代码示例

JavaScript 示例

// 1. Create Payment Request
const apiUrl = 'https://eppay.io/generate-code';
const data = {
    apiKey: "WlJSciIhgHkUzduirHj2AqIwxFvVGN",
    amount: "1",
    to: "0x8AB960B95aCCc5080c15721fdeA30e72C8251F0b",
    rpc: "https://rpc.scimatic.net",
    token: "0x65C4A0dA0416d1262DbC04BeE524c804205B92e8",
    success: "https://eppay.io/payment-success"
};

fetch(apiUrl, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => {
    console.log('Payment ID:', data.paymentId);

    // 2. Generate QR code with the format: "product=uuideppay&id=" + data.paymentId
    const qrCodeData = `product=uuideppay&id=${data.paymentId}`;
    generateQRCode(qrCodeData);

    // 3. Start checking payment status
    checkPaymentStatus(data.paymentId);
})
.catch(error => console.error('Error:', error));

// Function to check payment status periodically
function checkPaymentStatus(paymentId) {
    const statusUrl = `https://eppay.io/payment-status/${paymentId}`;
    const statusElement = document.getElementById('payment-status');

    // Check every 5 seconds
    const statusCheck = setInterval(() => {
        fetch(statusUrl)
            .then(response => response.json())
            .then(data => {
                if (data.status === true) {
                    // Payment successful
                    clearInterval(statusCheck);
                    statusElement.textContent = 'Payment Successful!';
                    document.getElementById('success-message').classList.remove('hidden');

                    // Proceed with order fulfillment or next steps
                    console.log('Payment confirmed, proceeding with order...');

                    // Redirect to success page
                    window.location.href = '/payment-success?id=' + paymentId;
                }
            })
            .catch(error => console.error('Error checking status:', error));
    }, 5000);

    // Set a timeout to stop checking after 30 minutes (optional)
    setTimeout(() => {
        clearInterval(statusCheck);
        statusElement.textContent = 'Payment Timeout';
        document.getElementById('timeout-message').classList.remove('hidden');
    }, 30 * 60 * 1000);
}

// Example function using qrcode.js library
function generateQRCode(data) {
    // Clear previous QR code if any
    document.getElementById('qrcode').innerHTML = '';

    // Generate new QR code
    new QRCode(document.getElementById('qrcode'), {
        text: data,
        width: 256,
        height: 256,
        colorDark: '#000000',
        colorLight: '#ffffff',
        correctLevel: QRCode.CorrectLevel.H
    });
}

PHP 示例

<?php
// 1. Create Payment Request
$apiUrl = 'https://eppay.io/generate-code';
$data = [
    "apiKey" => "WlJSciIhgHkUzduirHj2AqIwxFvVGN",
    "amount" => "1",
    "to" => "0x8AB960B95aCCc5080c15721fdeA30e72C8251F0b",
    "rpc" => "https://rpc.scimatic.net",
    "token" => "0x65C4A0dA0416d1262DbC04BeE524c804205B92e8",
    "success" => "https://eppay.io/payment-success"
];

$options = [
    'http' => [
        'header'  => "Content-Type: application/json\r\n",
        'method'  => 'POST',
        'content' => json_encode($data),
    ],
];

$context = stream_context_create($options);
$response = file_get_contents($apiUrl, false, $context);

if ($response === FALSE) {
    // Handle error
    die('Error creating payment request');
}

$result = json_decode($response, true);
$paymentId = $result['paymentId'];

// 2. Store payment ID in session for later verification
session_start();
$_SESSION['payment_id'] = $paymentId;

// 3. Display payment page with QR code
?>

<!DOCTYPE html>
<html>
<head>
    <title>Payment Page</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            line-height: 1.6;
            color: #333;
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
        }
        h1 {
            color: #225573;
            text-align: center;
        }
        #qrcode {
            display: flex;
            justify-content: center;
            margin: 30px 0;
        }
        #status {
            text-align: center;
            padding: 15px;
            border-radius: 4px;
            background-color: #f5f5f5;
            margin-top: 20px;
        }
        .success {
            background-color: #d4edda;
            color: #155724;
        }
        .instructions {
            margin-top: 20px;
            padding: 15px;
            background-color: #e8f4fd;
            border-radius: 4px;
        }
    </style>
</head>
<body>
    <h1>Complete Your Payment</h1>

    <div class="instructions">
        <p>Scan the QR code below with your Eppay app to complete the payment of 1 USDT.</p>
    </div>

    <div id="qrcode"></div>
    <div id="status">Waiting for payment...</div>

    <script>
        // Generate QR code
        var qrCode = new QRCode(document.getElementById("qrcode"), {
            text: "product=uuideppay&id=8a020135-19b7-42df-be4b-1a8722ad0570",
            width: 256,
            height: 256,
            colorDark: "#000000",
            colorLight: "#ffffff",
            correctLevel: QRCode.CorrectLevel.H
        });

        // Check payment status every 5 seconds
        var checkStatus = setInterval(function() {
            var xhr = new XMLHttpRequest();
            xhr.open('GET', 'check_payment_status.php', true);
            xhr.onload = function() {
                if (xhr.status === 200) {
                    var response = JSON.parse(xhr.responseText);
                    if (response.status === true) {
                        clearInterval(checkStatus);
                        document.getElementById('status').innerHTML = 'Payment successful!';
                        document.getElementById('status').className = 'success';

                        // Redirect to success page after 2 seconds
                        setTimeout(function() {
                            window.location.href = 'payment-success.php';
                        }, 2000);
                    }
                }
            };
            xhr.send();
        }, 5000);
    </script>
</body>
</html>

<?php
// check_payment_status.php
session_start();
$paymentId = $_SESSION['payment_id'];

$statusUrl = "https://eppay.io/payment-status/{$paymentId}";
$response = file_get_contents($statusUrl);
$result = json_decode($response, true);

// Return the status as JSON
header('Content-Type: application/json');
echo json_encode($result);
?>

Python 示例

import requests
import json
import time
import qrcode
from PIL import Image
from flask import Flask, render_template, session, jsonify

app = Flask(__name__)
app.secret_key = 'your_secret_key'

@app.route('/create-payment', methods=['POST'])
def create_payment():
    # 1. Create Payment Request
    api_url = 'https://eppay.io/generate-code'
    data = {
        "apiKey": "WlJSciIhgHkUzduirHj2AqIwxFvVGN",
        "amount": "1",
        "to": "0x8AB960B95aCCc5080c15721fdeA30e72C8251F0b",
        "rpc": "https://rpc.scimatic.net",
        "token": "0x65C4A0dA0416d1262DbC04BeE524c804205B92e8",
        "success": "https://eppay.io/payment-success"
    }

    response = requests.post(api_url, json=data)

    if response.status_code == 200:
        result = response.json()
        payment_id = result.get('paymentId')

        # Store payment ID in session
        session['payment_id'] = payment_id

        # 2. Generate QR code
        qr_data = f"product=uuideppay&id={payment_id}"
        img = qrcode.make(qr_data)
        img.save(f"static/qr_{payment_id}.png")

        return render_template('payment.html', payment_id=payment_id)
    else:
        return jsonify({"error": "Failed to create payment"}), 500

@app.route('/check-status', methods=['GET'])
def check_status():
    payment_id = session.get('payment_id')
    if not payment_id:
        return jsonify({"error": "No payment in progress"}), 400

    status_url = f"https://eppay.io/payment-status/{payment_id}"
    response = requests.get(status_url)

    if response.status_code == 200:
        return response.json()
    else:
        return jsonify({"error": "Failed to check payment status"}), 500

@app.route('/payment-success', methods=['GET'])
def payment_success():
    payment_id = session.get('payment_id')
    return render_template('success.html', payment_id=payment_id)

if __name__ == '__main__':
    app.run(debug=True)

Python 示例的 HTML 模板:

<!-- templates/payment.html -->
<!DOCTYPE html>
<html>
<head>
    <title>Eppay Payment</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            text-align: center;
        }
        h1 {
            color: #225573;
            margin-bottom: 20px;
        }
        .qr-container {
            margin: 30px 0;
        }
        #status-message {
            padding: 15px;
            border-radius: 4px;
            background-color: #f5f5f5;
            margin-top: 20px;
        }
        .success {
            background-color: #d4edda;
            color: #155724;
        }
        .info {
            background-color: #e8f4fd;
            color: #0c5460;
            padding: 15px;
            border-radius: 4px;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Complete Your Payment</h1>

        <div class="info">
            Scan the QR code with your Eppay app to complete the payment of 1 USDT.
        </div>

        <div class="qr-container">
            <img src="{{ url_for('static', filename='qr_' + payment_id + '.png') }}" alt="Payment QR Code">
        </div>

        <div id="payment-status">
            <div id="status-message">Waiting for payment...</div>
        </div>
    </div>

    <script>
        // Check payment status every 5 seconds
        function checkPaymentStatus() {
            $.ajax({
                url: '/check-status',
                type: 'GET',
                success: function(data) {
                    if (data.status === true) {
                        $('#status-message').text('Payment successful!');
                        $('#status-message').addClass('success');

                        // Redirect to success page after 2 seconds
                        setTimeout(function() {
                            window.location.href = '/payment-success';
                        }, 2000);
                    } else {
                        // Continue checking if payment is not yet complete
                        setTimeout(checkPaymentStatus, 5000);
                    }
                },
                error: function() {
                    $('#status-message').text('Error checking payment status');
                    // Try again after a delay
                    setTimeout(checkPaymentStatus, 10000);
                }
            });
        }

        // Start checking payment status when the page loads
        $(document).ready(function() {
            checkPaymentStatus();
        });
    </script>
</body>
</html>

<!-- templates/success.html -->
<!DOCTYPE html>
<html>
<head>
    <title>Payment Successful</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            text-align: center;
        }
        h1 {
            color: #225573;
            margin-bottom: 20px;
        }
        .success-container {
            background-color: #d4edda;
            color: #155724;
            padding: 20px;
            border-radius: 5px;
            margin: 30px 0;
        }
        .success-icon {
            font-size: 48px;
            color: #28a745;
            margin-bottom: 15px;
        }
        .order-details {
            background-color: #f8f9fa;
            padding: 15px;
            border-radius: 5px;
            margin-top: 20px;
            text-align: left;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Payment Successful!</h1>

        <div class="success-container">
            <div class="success-icon">✓</div>
            <p>Your payment of 1 USDT has been successfully processed.</p>
            <p>Payment ID: 8a020135-19b7-42df-be4b-1a8722ad0570</p>
        </div>

        <div class="order-details">
            <h3>Transaction Details:</h3>
            <p>Amount: 1 USDT</p>
            <p>Network: Scimatic</p>
            <p>Date: {{ now().strftime('%Y-%m-%d %H:%M:%S') }}</p>
        </div>

        <p>Thank you for using Eppay!</p>

        <a href="/">Return to Home</a>
    </div>
</body>
</html>

完整集成工作流程

以下是结合集成 Eppay 支付的所有关键要素的分步指南:

  1. 使用 Eppay API 创建付款请求,提供您的 API 密钥、金额、收款地址和区块链详情。
  2. 从 API 响应中接收唯一的付款 ID
  3. 生成格式为 product=uuideppay&id=PAYMENT_ID 的二维码
  4. 向用户显示二维码以便使用 Eppay 应用扫描。
  5. 定期轮询付款状态端点以检查付款是否已完成。
  6. 当状态返回 true 时处理付款确认,相应更新您的应用程序。
  7. 处理发送到成功 URL 的回调通知以进行冗余确认。

专业提示: 始终同时实施轮询机制和回调处理,以最大程度地提高检测已完成付款的可靠性。

支持的网络

Eppay 目前支持以下区块链网络上的 USDT 交易:

Ethereum

Ethereum

最初的智能合约平台,被广泛采用。

Binance Smart Chain

BSC

Binance Smart Chain 提供快速和低成本的交易。

Polygon

Polygon

Ethereum 的第 2 层扩展解决方案,吞吐量高。

Avalanche

Avalanche

确认时间快,可扩展性高。

Fantom

Fantom

基于 DAG 的智能合约平台,最终性快。

Arbitrum

Arbitrum

Ethereum 的第 2 层汇总解决方案,费用更低。

Cronos

Cronos

来自 Crypto.com 的 EVM 兼容链。

Scimatic

Scimatic

专为无缝支付而设的专用网络。

注意: 要查找这些网络的 RPC URL 和代币地址,请访问 chainlist.org

安全

Eppay 实施多层安全措施来保护您的资金和数据:

私钥管理

所有私钥都安全存储在用户的设备上,绝不会传输到 Eppay 服务器。密钥使用行业标准算法加密。

生物识别认证

Eppay 移动应用支持生物识别认证(指纹/Face ID)以访问应用和确认交易,增加了额外的安全层。

区块链安全

所有交易都由各自的区块链网络保护。Eppay 利用区块链技术固有的安全功能来确保交易完整性。

API 安全

对于开发人员,Eppay API 使用 API 密钥进行身份验证,所有通信都使用安全的 HTTPS 连接。敏感数据绝不会在 API 响应中公开。

安全最佳实践:

  • 永远不要与任何人分享您的恢复短语或私钥
  • 保持应用程序更新到最新版本
  • 在确认之前始终验证交易详情
  • 进行交易时使用安全的互联网连接
  • 启用应用中所有可用的安全功能

常见问题

目前,Eppay 支持跨多个区块链网络的 USDT(Tether)支付。我们计划在未来添加对更多加密货币的支持。

Eppay 对交易收取最低费用。确切的费用取决于您选择使用的区块链网络。我们在您确认任何交易之前显示网络费用,因此不会有意外。

交易时间因使用的区块链网络而异。大多数交易在几秒到几分钟内确认,BSC、Polygon 和 Avalanche 等网络通常比 Ethereum 处理交易更快。

绝对适合!Eppay 专为个人和商业用途而设计。它非常适合想要接受加密货币支付的商家、自由职业者和各种规模的企业。API 使其易于与您现有的系统集成。

Eppay 采用行业领先的安全措施,包括对所有交易和个人数据的加密。您的私钥保留在您的设备上,绝不会传输到我们的服务器。此外,您可以启用生物识别认证以增加额外的安全层。

如果您保存了 12 个单词的恢复短语,您可以在新设备上恢复您的钱包。没有这个短语,您的资金无法恢复,这就是为什么在您第一次创建钱包时安全存储它至关重要。

集成很简单。首先,在 eppay.io 注册账户并获取您的 API 密钥。然后,使用我们的 API 生成付款 ID、创建二维码并验证付款状态。我们提供详细的文档和多种编程语言的代码示例,帮助您快速入门。

有两种方法可以确认付款完成:(1) 您可以使用我们的 API 端点定期检查付款状态,当付款完成时它将返回 true,以及 (2) 当付款在区块链上确认时,我们将向您指定的回调 URL 发送通知,其中包含交易详情。

开始使用 Eppay

准备好集成加密货币支付了吗?

加入成千上万信任 Eppay 满足其加密货币支付需求的企业和个人。