- 홈
- 개발자
몇 분 만에 암호화폐 결제 연동하기
같은 판매자 콘솔에서 가상 거래로 연동을 테스트합니다. 온체인 자금은 보내지 않습니다. 한 계정에서 운영 및 개발 모드를 전환합니다. API 키와 IPN 비밀 키는 모드별로 구분됩니다
https://omniwallet.ewin888.com/api/v1/https://omniwallet.ewin888.com/api/v1/WebMCP
AI 도우미가 가맹점 콘솔에서 잔액, 결제 및 출금 견적을 조회할 수 있습니다. 실제 출금은 콘솔에서 직접 확인합니다.
빠른 시작
- 01
API 키 발급
가입 후 콘솔에 로그인해 ‘개발자 → API 키’에서 키를 생성하고, ‘IPN’ 메뉴에서 IPN 시크릿을 설정합니다. 먼저 테스트 환경에서 연동을 완료하는 것을 권장합니다.
- 02
결제 생성
POST /v1/payment엔드포인트를 호출하면서 금액, 가격 기준 통화, 결제받을 코인을 전달합니다. 응답의pay_address에는 해당 결제의 전용 주소가,pay_amount에는 결제해야 할 금액이 담겨 있습니다.POST /v1/paymentcurlcurl -X POST "https://omniwallet.ewin888.com/api/v1/payment" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: order-A-1024" \ -d '{ "price_amount": 120, "price_currency": "usd", "pay_currency": "usdttrc20", "order_id": "A-1024", "order_description": "Pro plan, 12 months", "ipn_callback_url": "https://example.com/ipn" }'응답JSON{ "payment_id": 355446374401130, "payment_status": "waiting", "pay_address": "TJ8nq3M5yVfQ9C2dWkPz7aH4sLrE6uXbGt", "price_amount": 120, "price_currency": "usd", "pay_amount": 120.02, "pay_currency": "usdttrc20", "order_id": "A-1024", "network": "TRC20", "expiration_estimate_date": "2026-10-02T09:15:00.000Z", "omni_payment_url": "https://omniwallet.ewin888.com/payment/4fKq9ZtR2mXcL8vBnW1pYs" } - 03
고객 결제 안내
주소와 금액(또는 QR 코드)을 고객에게 보여 주세요.
POST /v1/invoice로 호스팅 주문 페이지를 만든 뒤, 응답의invoice_url로 고객을 안내할 수도 있습니다.POST /v1/invoicecurlcurl -X POST "https://omniwallet.ewin888.com/api/v1/invoice" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "price_amount": 49.9, "price_currency": "usd", "order_id": "A-1025", "order_description": "Starter plan", "ipn_callback_url": "https://example.com/ipn", "success_url": "https://example.com/thanks", "cancel_url": "https://example.com/cart" }'응답JSON{ "id": "355447603200201", "order_id": "A-1025", "price_amount": "49.9", "price_currency": "usd", "pay_currency": null, "invoice_url": "https://omniwallet.ewin888.com/invoice/8hTz2QpLm4XwN7cVb1RkYe", "success_url": "https://example.com/thanks", "cancel_url": "https://example.com/cart", "created_at": "2026-10-01T09:20:00.000Z" } - 04
IPN 수신
결제 상태가 바뀔 때마다
IPN 검증ipn_callback_url로 POST 요청을 보내 드립니다. 먼저 서명을 검증한 뒤payment_status에 따라 주문 상태를 업데이트하세요. - 05
운영 환경으로 전환
이메일 인증 후 운영 모드로 전환하여 운영 API 및 IPN 인증 정보를 만드세요. API URL은 동일하며 일반 서비스의 KYB는 선택 사항입니다.
IPN 서명 검증
IPN 시크릿으로 ‘키를 알파벳순으로 정렬한 JSON’에 대해 HMAC-SHA512를 계산하고, 그 결과를 16진수 문자열로 x-omni-sig 헤더에 담아 보냅니다. 전송되는 요청 본문이 바로 이 정렬된 JSON이므로, 수신한 원본 본문을 그대로 검증하면 됩니다.
- 서명은 상수 시간 비교로 검증하세요
- IPN은 중복되거나 순서가 뒤바뀌어 도착할 수 있습니다.
payment_id와 상태를 기준으로 중복을 제거하고, 필요하면GET /v1/payment/{id}를 호출해 최신 상태를 확인하세요 - 2xx 응답은 수신 완료로 간주되며, 그 외의 응답이나 타임아웃은 자동으로 재시도됩니다
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const IPN_SECRET = process.env.OMNI_IPN_SECRET;
// Keep the raw body: the signature covers the exact bytes we send.
app.post('/ipn', express.raw({ type: 'application/json' }), (req, res) => {
const received = String(req.get('x-omni-sig') || '');
const expected = crypto
.createHmac('sha512', IPN_SECRET)
.update(req.body)
.digest('hex');
const valid = received.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
if (!valid) return res.status(401).send('invalid signature');
const payment = JSON.parse(req.body.toString('utf8'));
// Idempotent update: the same status can be delivered more than once.
// await orders.applyStatus(payment.order_id, payment.payment_status);
res.sendStatus(200);
});
app.listen(3000);<?php
$secret = getenv('OMNI_IPN_SECRET');
$raw = file_get_contents('php://input');
$received = $_SERVER['HTTP_X_OMNI_SIG'] ?? '';
// The signature covers the exact bytes we send.
$expected = hash_hmac('sha512', $raw, $secret);
if (!hash_equals($expected, $received)) {
http_response_code(401);
exit('invalid signature');
}
$payment = json_decode($raw, true);
// Idempotent update: the same status can be delivered more than once.
// apply_status($payment['order_id'], $payment['payment_status']);
http_response_code(200);import hashlib
import hmac
import json
import os
from flask import Flask, abort, request
app = Flask(__name__)
IPN_SECRET = os.environ["OMNI_IPN_SECRET"].encode()
@app.post("/ipn")
def ipn():
raw = request.get_data() # the exact bytes we signed
expected = hmac.new(IPN_SECRET, raw, hashlib.sha512).hexdigest()
received = request.headers.get("x-omni-sig", "")
if not hmac.compare_digest(expected, received):
abort(401)
payment = json.loads(raw)
# Idempotent update: the same status can be delivered more than once.
# apply_status(payment["order_id"], payment["payment_status"])
return "", 200{
"actually_paid": 120.02,
"actually_paid_at_fiat": 120,
"invoice_id": null,
"order_description": "Pro plan, 12 months",
"order_id": "A-1024",
"outcome_amount": 119.42,
"outcome_currency": "usdttrc20",
"parent_payment_id": null,
"pay_address": "TJ8nq3M5yVfQ9C2dWkPz7aH4sLrE6uXbGt",
"pay_amount": 120.02,
"pay_currency": "usdttrc20",
"payment_id": 355446374401130,
"payment_status": "finished",
"price_amount": 120,
"price_currency": "usd",
"purchase_id": null,
"updated_at": "2026-10-01T09:17:42.000Z"
}결제 상태
결제 상태 값은 다음과 같습니다. 상태가 바뀔 때마다 IPN을 보냅니다.
| 상태 | 설명 |
|---|---|
waiting결제 대기 | 고객의 결제 대기 중 |
confirming확인 중 | 트랜잭션 감지됨, 블록 컨펌 대기 중 |
confirmed확인 완료 | 입금 확정됨 |
sending정산 중 | 지갑으로 정산 진행 중 |
partially_paid부분 결제 | 결제 금액 부족(고객이 만료 전까지 부족분 추가 결제 가능) |
finished완료 | 결제 완료 |
failed실패 | 결제 실패(예: 제재 목록 해당) |
refunded환불 완료 | 결제자에게 환불 완료 |
expired만료 | 기한 내 미결제 |
개발 모드
같은 판매자 콘솔에서 가상 거래로 연동을 테스트합니다. 온체인 자금은 보내지 않습니다.
- 한 계정에서 운영 및 개발 모드를 전환합니다. API 키와 IPN 비밀 키는 모드별로 구분됩니다
- 모의 거래로 처리와 IPN을 확인하고 실제 결제에는 운영 모드 인증 정보를 사용하세요
- 개발 모드는 실제 입금 주소를 제공하지 않습니다. 실제 자금을 보내지 마세요
멱등성과 재시도
리소스를 생성하는 모든 POST 요청에 Idempotency-Key 헤더를 포함할 수 있습니다. 네트워크 타임아웃이 발생하면 같은 키로 다시 요청하세요. 결제나 출금이 중복 생성되지 않습니다.
- 같은 키, 같은 내용: 첫 요청의 결과를 반환
- 같은 키, 다른 내용: 422
IDEMPOTENCY_KEY_REUSED응답 - 첫 요청이 아직 처리 중: 409
IDEMPOTENCY_IN_FLIGHT응답(잠시 후 다시 시도하세요)
POST /api/v1/payout HTTP/1.1
Host: omniwallet.ewin888.com
x-api-key: YOUR_API_KEY
Authorization: Bearer YOUR_JWT
Idempotency-Key: 6c0a8e6e-3f5b-4f7a-9a52-1f0c2d9b7e41
Content-Type: application/json