货币支持
本文档提供了 Onerway 支付处理中支持的货币、格式要求和金额限制的综合信息。
货币类型
零小数位货币
以下货币不支持小数位,必须格式化为整数:
Currency | Code | Minimum Amount | Format Example | Notes |
---|---|---|---|---|
Japanese Yen | JPY | 1 |
| No decimal places allowed |
Korean Won | KRW | 100 |
| Typically 100+ for practical transactions |
Indonesian Rupiah | IDR | 10,000 |
| Minimum 5 digits (10,000 IDR) |
Vietnamese Dong | VND | 1,000 |
| Typically thousands for practical use |
Lao Kip | LAK | 1 |
| No decimal places allowed |
Cambodian Riel | KHR | 1 |
| No decimal places allowed |
Myanmar Kyat | MMK | 1 |
| No decimal places allowed |
Paraguayan Guarani | PYG | 1 |
| No decimal places allowed |
Hungarian Forint | HUF | 1 |
| No decimal places allowed |
Icelandic Krona | ISK | 1 |
| No decimal places allowed |
标准小数货币
大多数货币支持最多2位小数:
Currency | Code | Decimal Places | Format Example | Notes |
---|---|---|---|---|
US Dollar | USD | 2 |
| Standard international currency |
Euro | EUR | 2 |
| European Union currency |
British Pound | GBP | 2 |
| United Kingdom currency |
Canadian Dollar | CAD | 2 |
| Canadian currency |
Australian Dollar | AUD | 2 |
| Australian currency |
Singapore Dollar | SGD | 2 |
| Singapore currency |
Hong Kong Dollar | HKD | 2 |
| Hong Kong currency |
Chinese Yuan | CNY | 2 |
| Chinese currency |
金额格式指南
零小数位货币
零小数位货币规则
- 仅使用整数
- 不包含小数分隔符
- 不添加
.00
后缀 - 示例:
1000
、50000
、100
正确示例:
{
"orderAmount": "1000",
"orderCurrency": "JPY"
}
2
3
4
错误示例:
{
"orderAmount": "1000.00", // ❌ 不允许小数
"orderCurrency": "JPY"
}
2
3
4
标准小数货币
小数货币规则
- 使用最多2位小数
- 使用点(.)作为小数分隔符
- 即使是整数金额也要包含小数
- 示例:
99.99
、100.00
、0.01
正确示例:
{
"orderAmount": "99.99",
"orderCurrency": "USD"
}
2
3
4
最小金额要求
特殊最小金额规则
- IDR(印尼盾):最少10,000 IDR(需要5位数)
- VND(越南盾):实际使用中通常以千为单位处理
- KRW(韩元):实际交易通常最少100 KRW
- JPY(日元):最少1 JPY,但实际使用通常为100+
一般指南
- 大多数支付方式都有自己的最小金额要求
- 本地支付方式可能根据支付提供商有特定限制
- 查看各个支付方式文档了解具体限制
支付方式注意事项
信用卡支付
所有支持的货币都可以用于信用卡支付,遵循上述格式规则。
本地支付方式
本地支付方式有额外限制:
- 货币支持:每种本地支付方式支持特定货币
- 金额限制:可能与信用卡有不同的最小/最大金额
- 地区限制:某些方式仅在特定国家可用
参考本地支付文档
有关本地支付方式货币支持和限制的详细信息,请参见本地支付方式文档和支付方式表格中的单笔限额列。
API 实现
请求格式
在进行 API 请求时,确保货币格式遵循以下规则:
{
"orderAmount": "99.99", // 小数货币
"orderCurrency": "USD"
}
2
3
4
{
"orderAmount": "1000", // 零小数货币
"orderCurrency": "JPY"
}
2
3
4
验证
Onerway 系统将验证:
- 货币格式:必须是3位字母的 ISO 4217 代码
- 金额格式:必须遵循货币的小数规则
- 最小金额:必须满足特定货币的最小值
- 支付方式兼容性:所选支付方式必须支持该货币
错误处理
常见货币相关错误
Error Scenario | Description | Solution |
---|---|---|
Invalid decimal format | Using decimals with zero-decimal currency | Remove decimal places |
Amount too small | Below minimum amount for currency | Increase amount |
Currency not supported | Currency not available for payment method | Use supported currency |
Format mismatch | Incorrect number format | Follow formatting guidelines |
最佳实践
- API调用前验证:在请求前检查货币格式和金额
- 优雅处理错误:为用户提供清晰的错误信息
- 货币选择:仅显示所选支付方式支持的货币
- 金额输入:根据货币类型实现适当的输入验证
示例
多货币实现
// 货币验证函数
function validateCurrencyAmount(amount, currency) {
const zeroDecimalCurrencies = ['JPY', 'KRW', 'IDR', 'VND', 'LAK', 'KHR', 'MMK', 'PYG', 'HUF', 'ISK'];
if (zeroDecimalCurrencies.includes(currency)) {
// 零小数货币 - 必须是整数
return /^\d+$/.test(amount);
} else {
// 标准货币 - 最多2位小数
return /^\d+(\.\d{1,2})?$/.test(amount);
}
}
// 为API格式化金额
function formatAmount(amount, currency) {
const zeroDecimalCurrencies = ['JPY', 'KRW', 'IDR', 'VND', 'LAK', 'KHR', 'MMK', 'PYG', 'HUF', 'ISK'];
if (zeroDecimalCurrencies.includes(currency)) {
return Math.round(amount).toString();
} else {
return amount.toFixed(2);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
集成示例
// 标准小数货币交易
{
"merchantNo": "800000",
"orderAmount": "99.99",
"orderCurrency": "USD",
"productType": "CARD"
}
2
3
4
5
6
7
// 零小数货币交易
{
"merchantNo": "800000",
"orderAmount": "1000",
"orderCurrency": "JPY",
"productType": "CARD"
}
2
3
4
5
6
7