Shopify 集成
在你的 Shopify 商店中通过 Pelago 接受加密货币支付。
安装
从 Shopify 应用商店安装
- 访问 Pelago Shopify 应用
- 点击 安装应用
- 授权应用
- 输入你的 Pelago API 凭证
- 配置设置
手动安装
适用于自定义 Shopify 主题:
<!-- 在 checkout.liquid 或 cart.liquid 中 -->
<script src="https://js.pelago.tech/shopify.js"></script>
<script>
Pelago.init({
publicKey: '{{ shop.metafields.pelago.public_key }}',
buttonSelector: '#pelago-checkout-button'
});
</script>
<button id="pelago-checkout-button">
加密货币支付
</button>
配置
控制台设置
在 Pelago Shopify 应用设置中:
| 设置 | 描述 |
|---|---|
| API Key | 你的 Pelago 公钥 |
| Merchant Wallet | 接收支付的加密钱包 |
| Networks | 启用的区块链网络 |
| Currencies | 接受的加密货币 |
| Checkout Mode | 重定向或嵌入模式 |
主题自定义
/* 自定义 Pelago 按钮 */
#pelago-checkout-button {
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
color: white;
padding: 12px 24px;
border-radius: 8px;
font-weight: 600;
}
支付流程
订单履行
通过 Pelago 支付的订单将自动:
- 在 Shopify 中标记为 已支付
- 添加
pelago-payment标签 - 在备注中更新交易哈希
Webhook
Shopify 应用自动处理:
payment.completed→ 标记订单已支付payment.failed→ 通知客户payment.refunded→ 处理 Shopify 退款
自定义
自定义结账按钮
{% if settings.pelago_enabled %}
<div class="pelago-payment-option">
<h4>加密货币支付</h4>
<p>通过 Pelago 快速、安全的加密支付</p>
<button
id="pelago-pay"
data-amount="{{ cart.total_price | money_without_currency }}"
data-currency="{{ cart.currency.iso_code }}"
>
<img src="https://assets.pelago.tech/icons/crypto.svg" alt="Crypto" />
支付 {{ cart.total_price | money }}
</button>
</div>
{% endif %}
多币种支持
// 自动检测客户货币
Pelago.init({
publicKey: PELAGO_PUBLIC_KEY,
currency: Shopify.currency.active,
cryptocurrency: 'USDC',
network: 'stellar'
});
测试
沙盒模式
在应用设置中启用沙盒:
- 前往 设置 → 开发
- 开启 沙盒模式
- 使用测试 API 密钥
测试订单
使用 Shopify 的测试支付网关创建测试订单,然后在结账时选择 Pelago。
故障排除
按钮未显示
- 检查主题兼容性
- 验证 API 密钥是否正确
- 检查浏览器控制台错误
订单未更新
- 验证应用设置中的 Webhook URL
- 检查 Shopify 权限
- 查看 Pelago 控制台中的 Webhook 日志