whalet
首页
开放API
  • 收款
  • 鲸卡
  • 收单
首页
开放API
  • 收款
  • 鲸卡
  • 收单
  1. 收款
  • 接入指南
  • Integration Guidelines
  • 附录
  • Appendix
  • 用户入网(User Onboarding)
    • 用户入网申请(User Onboarding Apply)
      POST
    • 入网结果通知(User Onboarding Result Notification)
      POST
  • 持有人(Card Holder)
    • 持有人申请(Card Holder Apply)
      POST
    • 持有人结果通知(Card Holder Result Notification)
      POST
    • 持有人查询(Card Holder Query)
      POST
    • 持有人银行账户申请(Card Holder Beneficary Apply)
      POST
    • 持有人银行账户结果通知(Card Holder Beneficary Result Notify)
      POST
    • 持有人银行账户查询(Card Holder Beneficary Query)
      POST
  • 开卡(Virtual Account)
    • 外贸收款(B2B)
      • 申请收款卡(Virtual Account Apply for B2B)
      • 获取外贸收款渠道(Channel Banks Query for B2B)
    • 电商收款(B2C)
      • 申请收款卡(Virtual Account Apply for B2C)
      • 获取收款卡平台配置(Platform Query for B2C)
      • 获取开通收款卡持有人(Card Holder Query for B2C)
      • 查询开卡数(Card number Query for B2C)
      • 绑定/添加店铺(Bind/Unbind Shop for B2C)
      • 注销收款卡((Card Cancel for B2C))
      • 查询收款卡详情(Card Detail Query for B2C)
      • 注销收款卡结果通知(Card Cancel Result Notify for B2C)
      • 查询店铺(Shop Query for B2C)
      • 查询收款卡(Card Query for B2C)
      • 绑定/添加店铺结果通知(Shop Bind/Unbind/Add Result Notify for B2C)
      • 申请银行证明信(Bank Letter Apply For B2C)
    • 申请收款卡结果通知(Virtual Account Notify for B2C)
      POST
  • 收款(Collections)
    • 收款到账通知(Collection Received Notify)
      POST
    • 关联外贸订单(Trade Order Bind Apply for B2B)
      POST
    • 关联外贸订单结果通知(Trade Order Bind Notify for B2B)
      POST
  • 订单(Order)
    • 外贸收款(Trade Order)
      • 订单申请(Trade Order Apply for B2B)
      • 订单详情(Trade Order Query Detail for B2B)
      • 分页查询(Trade Order Query List for B2B)
    • 电商收款(Shop Order)
      • 上传订单(Shop Order Upload for B2C)
  • 提现(Payout)
    • 申请提现/付款(Payout Apply)
      POST
    • 确认提现/付款(Payout Confirm)
      POST
    • 申请提现/付款结果通知(Payout Result Notify)
      POST
    • 查询汇率(Rate Inquiry)
      POST
    • 查询受益人银行账户字段信息(Beneficiary Account Fields Query)
      POST
    • 绑定受益人银行账户(Benificiary Account Apply)
      POST
    • 绑定受益人银行账户结果通知(Benificiary Account Result Notify)
      POST
    • 删除受益人银行账户(Benificiary Account Delete)
      POST
    • 查询支持的受益人银行账户国家/地区(Beneficiary Account Country Query)
      POST
  • 支付(Pay)
    • 申请支付(Pay Apply)
    • 确认支付(Pay Confirm)
    • 申请支付结果通知(Pay Result Notify)
  • 钱包(Wallet)
    • 币种余额(Currency Balance)
    • 平台余额(Platform Balance)
  • 交易查询(Trade Query)
    • 收款记录(Collection Query)
    • 提现记录(Withdraw Query)
    • 付款记录(Payment Query)
    • 支付记录(Pay Query)
  • 补充资料(ReMaterials)
    • EDD补充资料通知(Edd Replenish Notify)
    • EDD补充资料查询(Edd Replenish Query)
    • EDD补充资料提交(Edd Replenish Submit)
    • EDD补充资料结果通知(Edd Replenish Result Notify)
    • 交易补充资料通知(Trade Replenish Notify)
    • 交易补充资料提交(Trade Replenish Submit)
    • 交易补充资料结果通知(Trade Replenish Result Notify)
  • Connectivity
    • 连通性验证(connectivity)
    • 连通性验证通知(connectivityNotify)
  • Mock
    • 入账通知Mock(mockPayeeNotify)
  1. 收款

Integration Guidelines

1. Introduction#

The following content of this guide includes instructions on how to implement foreign exchange collection and settlement technology through the Whalet platform, divided into Public Message , Business API and Webhook Notification.

1.1 Purpose#

The main purpose of this guide is to assist technology developers in mastering the cross-border foreign exchange collection and settlement methods and the use of payment platforms, and integrating them into existing systems.

1.2 Target#

The target audience of this guide is product managers, system designers, technical developers, and testers of partners.

1.3 Copyright#

The copyright of this document belongs to Xiamen Yijing Information Technology Co., Ltd. (hereinafter referred to as "Whalet"). As the end user of this system (hereinafter referred to as "Partner"), you may have the right to use this document, but without the written permission of Whalet, you shall not lend, assign or publish this document to any third party.

1.4 Technical support#

If you have any questions about the connectivity and debugging of the APIs, please contact the relevant technical support staff according to the following methods during working hours.
product@whalet.com
Please alse browse this document with Demo. Demo will be synchronized with the changes of the document. Please ask the technical staff for the latest Demo and document if necessary.

2. Public Message#

2.1 Connection Formula#

Use HTTPS communication protocol, and all use POST submission method.
environmenturl
testhttps://test-open.whalet.com/api
prodhttps://open.whalet.com/api

2.2 Data Format#

Use JSON as the common format for request and response messages, and use UTF-8 encoding format uniformly.
Message Mandatory Flag: M (Mandatory Option) O (Optional Option) C (Conditional Mandatory, specific conditions must be filled first).

Request Message#

1.
The request message consists of two parts: the request message header and the request message body. The request message header information is within the header (head) node, and the request message body information is within the body (body) node.
2.
The message header is the same for every transaction. Please refer to the Public Request Message Header section for the filling standard of the request message header information.
3.
The message body of the request varies according to the interface definition of each transaction. Please refer to the Business API chapter for the definition of the request message body. The request message body needs to be assembled and parsed according to the interface definition of each transaction.

Response Message#

1.
The transaction response message consists of two parts: the response message header and the response message body. The response message header information is within the header (head) node, and the response message body information is within the body (body) node.
2.
The header of the message is the same for every transaction. Please refer to the Public Response Message Header section for the filling standard of the response message header information.
3.
The message format varies depending on the interface definition of each transaction. Please refer to the Business API chapter for the definition of the response message format. The response message format needs to be assembled and parsed according to the interface definition of each transaction.
4.
When the response message of the transaction is successful, the code in the header of the message is "SUCCESS", and the detail is "Successful". At this time, the node of the message body (body) can be empty or not empty according to the actual business needs.
5.
When the response message of the transaction is filded, error codes and error messages are filled in the code (return code) and detail (return description) fields of the message header, with the body node (body) being empty.

2.3 Encryption and Signature Methods#

To ensure the security of data, all transaction message transmissions need to be encrypted, signed, and verified.
1.
Message encryption algorithms: AES/ECB/PKCS5Padding
2.
Session key generation: KeyGenerator
3.
Session Key Encryption Algorithm: RSA/ECB/PKCS1Padding
4.
Signature Algorithm:SHA1withRSA

Generating RSA key pairs#

For the partner, it is necessary to generate its own RSA key pair (including public and private keys), where the private key is kept by the partner and the public key is provided to WHALET.
For WHALET, it is necessary to generate a corresponding key pair for partner. Where the private key is kept by WHALET and the public key needs to be provided to the partner.

Message Encryption and Signature#

1.
Use the KeyGenerator generator to generate an AES encryption session key SK.
2.
Use SK to encrypt the JSON plaintext (AES/ECB/PKCS5Padding), and convert the encrypted result to a HEX string to obtain the encrypt field.
3.
Base64 encoded the SK and Encrypt using the recipient's public key (RSA/ECB/PKCS1Padding), and converted the result to a HEX string to obtain the keyEnc field. Sign the requested "string to be signed" (UTF-8 encoded) using the sender's private key (SHA1withRSA), and convert the signature result to a HEX string to obtain the sign field.

Message Decryption and Verification#

1.
Convert the keyEnc field to a binary byte array, and use the private key of the recipient to decrypt the session key to obtain the plaintext SK;
2.
Base64 decoded the SK, Convert encrypt to a binary byte array, decrypt it using the session key SK obtained in the previous step, and obtain the plaintext json;
3.
Use the obtained "unsigned string", the sender's public key, and the sign field data to verify the signature's validity.

Request for Signature String#

All fields are concatenated in the following order using "|" symbol.
partnerId,apiCode,version,requestNo from the corresponding field in the request header.
encrypt comes from request body encrypt field.

Response to be Signed String#

All fields are concatenated in the following order using "|" symbol.
partnerId,apiCode,version,requestNo,code and detail from the corresponding field in the response header.
encrypt from finally response encrypt field,where message(body) is empty,encrypt will be empty and not participate in the connection of the string to be signed.

2.4 Public Request Message Header#

fieldtypelengthrequireddescription
partnerIdString30MPartner id provided by Whalet
apiCodeString30MAPI code
requestNoString30MRequest serial number, unique
versionString3MAPI version, fixed as 1.0
signStringMRequest message signature
keyEncStringMSession key

2.5 Public Response Message Header#

fieldtypelengthrequireddescription
partnerIdString30MResponse as Request header Partner id provided by Whalet
apiCodeString30MResponse as Request header API code
requestNoString30MResponse as Request header Request serial number, unique
versionString3MResponse as Request header API version, fixed as 1.0
codeString32MResponse code SUCCESS indicates successful request
detailString256MDescription
signStringOResponse message signature
keyEncStringOSession key ciphertext

2.6 Error Response Code#

codedescriptionremark
SUCCESSSuccess
PROCESSINGProcessingWaiting for notification
FAILUREFailedFind the specific failure content in the detail’s attribute
TOO_MANY_REQUESTSToo frequently
PARTNER_NOT_EXISTPartner not exists
INTERNAL_ERRORInternal error
PARAM_FORMAT_ERRORParameter format error
PARAMETER_ERRORParameter error
IDEMPOTENT_ERRORIdempotent error
REQUEST_NO_NOT_UNIQUEDuplicated request number
UNAUTHORIZEDUnauthorized
UNAUTHENTICATED_ERRORUnauthorized error
INTERFACE_UNAUTHORIZEDUnauthorized api

2.7 Webhook Notification#

For some APIs that cannot return results synchronously (the synchronization result status is PROCESSING), Whalet will send messages of different notification types (differentiated by ApiCode) to the notification URL provided by the partner through asynchronous notification after the service processing is completed, and the partner can handle its own business when receiving the notification and completing the corresponding message decryption and verification.
The partner needs to return the result within the specified time (which must meet the requirements of the public response format and requirements), and if the request times out, Whalet will retry according to the following rules:
1.
Retry up to 5 times
2.
The interval time is 1s, 2s, 4s, 8s, and 16s
3.
If it still fails after 5 attempts, Whalet will notify the partner offline
It is recommended that the partner process the internal business logic asynchronously after receiving the request and return the response result in a timely manner. At the same time, ensure the stability of the services.

2.8 Message Example#

Take the connectivity as an example.

Request Definition#

ConnectivityGuideRequestBody
notifyFlag
enum<string> 
是否通知
required
Allowed values:
YN
notifyMessage
string 
通知内容
optional
responseFlag
enum<string> 
是否响应
required
Allowed values:
YN
responseMessage
string 
响应内容
optional

Request Example#

Response Definition#

ConnectivityGuideResponseBody
messge
string 
消息内容
optional

Response Example#

3 File Upload#

3.1 Connection Formula#

Use HTTPS and POST method to submit.
environmenturl
testhttps://test-open.whalet.com/file/upload
productionhttps://open.whalet.com/file/upload

3.2 Data Format#

The request format is multipart/form-data, and the response format is JSON.

3.3 Token#

String to be signed#

Concatenate the fields with the "|" symbol in the following order.
partnerId is the ID of parter, and timestamp is the current timestamp (milliseconds, 13 digits).

Signature#

The signature string (UTF-8 encoding) is signed with the sender's private key (SHA1withRSA), and the signature result is converted to a HEX string as a token.

Expiration#

Whalet will verify the token and check the validity period of the token according to timestamp, which is valid for 30 minutes and can be reused during the validity period.

3.4 Request Example#

curl request#

postman request#

image.png
image.png

3.5 Sample Response#

Success Reponse#

{
    "code": "SUCCESS",
    "detail": "Success",
    "info": {
        "fileId": "202405011245158834940001",
        "fileName": "demo.jpg",
        "fileUrl": "https://test-file.whalet.com/2024-05-01/75ab32a9-cc98-46cb-9e8f-5c055fd9e4b5.jpg"
    }
}

Error Response#

{
    "code": "UNAUTHENTICATED_ERROR",
    "detail": "invalid token",
    "info": null
}

Notes#

1.
The supported file types: jpeg, jpg, png, gif, bmp, pdf, doc, docx, xls, xlsx, csv, txt, zip, rar
2.
The size limit for single file: 10M
Modified at 2025-04-22 06:07:09
Previous
接入指南
Next
附录
Built with