Documentation Index
Fetch the complete documentation index at: https://waffo.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Node.js(SDK使用)
import { Waffo, Environment } from '@waffo/waffo-node';
import { randomUUID } from 'crypto';
const waffo = new Waffo({
apiKey: process.env.WAFFO_API_KEY,
privateKey: process.env.WAFFO_PRIVATE_KEY,
waffoPublicKey: process.env.WAFFO_PUBLIC_KEY,
merchantId: process.env.WAFFO_MERCHANT_ID,
environment: Environment.SANDBOX,
});
const paymentRequestId = randomUUID().replace(/-/g, '');
const response = await waffo.order().create({
paymentRequestId,
merchantOrderId: `ORDER_${Date.now()}`,
orderCurrency: 'HKD',
orderAmount: '100.00',
orderDescription: 'Premium Plan',
notifyUrl: 'https://your-site.com/webhook/waffo',
userInfo: { userId: 'user_123', userTerminal: 'WEB' },
paymentInfo: { productName: 'ONE_TIME_PAYMENT' },
goodsInfo: { goodsUrl: 'https://your-site.com/product/001' },
});
Java(SDK使用)
import com.waffo.Waffo;
import com.waffo.types.config.WaffoConfig;
import com.waffo.types.config.Environment;
import com.waffo.types.ApiResponse;
import com.waffo.types.order.*;
import com.waffo.types.payment.ProductName;
import com.waffo.types.iso.CurrencyCode;
WaffoConfig config = WaffoConfig.builder()
.apiKey(System.getenv("WAFFO_API_KEY"))
.privateKey(System.getenv("WAFFO_PRIVATE_KEY"))
.waffoPublicKey(System.getenv("WAFFO_PUBLIC_KEY"))
.merchantId(System.getenv("WAFFO_MERCHANT_ID"))
.environment(Environment.SANDBOX)
.build();
Waffo waffo = new Waffo(config);
String paymentRequestId = UUID.randomUUID().toString().replace("-", "");
CreateOrderParams params = CreateOrderParams.builder()
.paymentRequestId(paymentRequestId)
.merchantOrderId("ORDER_" + System.currentTimeMillis())
.orderCurrency(CurrencyCode.HKD)
.orderAmount("100.00")
.orderDescription("Premium Plan")
.notifyUrl("https://your-site.com/webhook/waffo")
.userInfo(UserInfo.builder()
.userId("user_123").userTerminal(UserTerminalType.WEB).build())
.paymentInfo(PaymentInfo.builder()
.productName(ProductName.ONE_TIME_PAYMENT).build())
.build();
ApiResponse<CreateOrderData> response = waffo.order().create(params);
cURL(生HTTP)
curl -X POST https://api-sandbox.waffo.com/api/v1/order/create \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-SIGNATURE: YOUR_RSA_SIGNATURE" \
-d '{
"paymentRequestId": "abc123def456",
"merchantOrderId": "ORDER_001",
"orderCurrency": "HKD",
"orderAmount": "100.00",
"orderDescription": "Test Product",
"notifyUrl": "https://your-site.com/webhook/waffo",
"merchantInfo": { "merchantId": "M000001" },
"userInfo": { "userId": "user_123", "userTerminal": "WEB" },
"paymentInfo": { "productName": "ONE_TIME_PAYMENT" }
}'