Onerway
POST

新增收款人

创建并保存一个收款人,返回保存后的收款人信息与编号。

请求

ApiKey
Onerway 分配的账户服务 API key 请求 Header;必须使用与请求域名相同环境的值。
示例:
Content-Type
请求体媒体类型。
示例:
entityType
收款人的主体类型,取值见枚举说明。
可选值
INDIVIDUAL
个人
BUSINESS
企业
merchantRefId
商户为收款人设置的外部标识。
条件:entityType=INDIVIDUAL 时必填;其他主体类型不传。
个人主体信息,仅适用于 entityType=INDIVIDUAL。
条件:entityType=BUSINESS 时必填;其他主体类型不传。
企业主体信息,仅适用于 entityType=BUSINESS。
联系方式
收款人的地址信息。
收款账户信息
onBehalfOf
请求实际对应的商户号,仅在代其他商户发起请求时填写。
paymentMethod
付款方式,参见枚举说明。
可选值
BANK_TRANSFER
银行转账
SWIFT
SWIFT 汇款
E_WALLET
电子钱包

请求示例

curl -X POST 'https://sandbox-transfer-api.onerway.com/api/v3/beneficiary/add' \
  -H 'ApiKey: replace_with_account_service_apikey' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "entityType": "BUSINESS",
  "paymentMethod": "BANK_TRANSFER",
  "business": {
    "companyName": "Example Demo Company",
    "registrationNumber": "demo_registration_001",
    "registrationDate": "2020-01-01",
    "tin": "demo_tax_id"
  },
  "contact": {
    "email": "demo@example.com"
  },
  "address": {
    "countryCode": "US",
    "state": "Example State",
    "city": "Example City",
    "addressLine1": "Example Address",
    "postalCode": "00000"
  },
  "account": {
    "countryCode": "US",
    "currency": "USD",
    "bankAccount": {
      "accountHolderName": "Example Demo Company",
      "bankName": "Example Bank",
      "accountType": "CHECKING",
      "accountIdentifier": {
        "type": "LOCAL_ACCOUNT",
        "value": "demo_account_001"
      },
      "routingNumber": "000000000"
    }
  }
}'

响应

respCode
响应码;20000 表示请求处理成功,其余为错误码。
respMsg
响应码对应的可读说明。
成功业务数据;失败不作为有效业务数据读取
结构化失败信息;并非每个失败分支都有该字段

响应示例

{
  "respCode": "20000",
  "respMsg": "Success",
  "data": {
    "beneficiaryId": "10001",
    "merchantNo": "10000",
    "status": "unnecessary",
    "entityType": "BUSINESS",
    "paymentMethod": "BANK_TRANSFER",
    "business": {
      "companyName": "Example Demo Company",
      "registrationNumber": "demo_registration_001",
      "registrationDate": "2020-01-01",
      "tin": "demo_tax_id"
    },
    "contact": {
      "email": "demo@example.com"
    },
    "address": {
      "countryCode": "US",
      "state": "Example State",
      "city": "Example City",
      "addressLine1": "Example Address",
      "postalCode": "00000"
    },
    "account": {
      "countryCode": "US",
      "currency": "USD",
      "bankAccount": {
        "accountHolderName": "Example Demo Company",
        "bankName": "Example Bank",
        "accountType": "CHECKING",
        "accountIdentifier": {
          "type": "LOCAL_ACCOUNT",
          "value": "demo_account_001"
        },
        "routingNumber": "000000000"
      }
    }
  }
}
20040004

account 对象存在,但未提供 countryCode。

触发条件: account 对象存在,但未提供 countryCode。

示例

{
  "respCode": "40004",
  "respMsg": "Validation Failed",
  "error": {
    "type": "validation_error",
    "code": "beneficiary_create_failed",
    "message": "Beneficiary create request validation failed",
    "requestId": "req_00000000000000000000000000000001",
    "errorDetails": [
      {
        "fieldPath": "account.countryCode",
        "errorCode": "INVALID_PARAMETER",
        "message": "account.countryCode is required",
        "ruleType": "REQUIRED",
        "params": {
          "required": true
        }
      }
    ],
    "param": "account.countryCode"
  }
}