17
- [产品介绍](./1) - [支付流程和用户体验](./3) - [快速开始](./34) - [支付流程](./35) - [退款流程](./36) - [查询流程](./37) - [对账流程](./53) - [二级商户维护流程](./38) - [接入指南](./39) - [密钥准备](./40) - [示例代码下载](./45) - [接口调用](./46) - [签名请求并创建请求URL](./47) - [通知处理](./48) - [异步通知验签](./49) - [同步通知验签](./50) - [沙箱测试](./41) - [沙箱环境使用准备](./42) - [沙箱部署](./43) - [沙箱运行](./44) - [应用上线](./51) - [接口列表](./6) - [网站支付接口](./6) - [请求参数](./6) - [同步返回](./7) - [示例](./8) - [异步通知](./9) - [错误码](./10) - [退款接口](./11) - [请求参数](./11#Request) - [同步返回](./11#Response) - [示例](./11#Samples) - [异步通知](./52) - [错误码](./12#Errors) - [单笔查询接口](./13) - [请求参数](./13#QueryRequest) - [同步返回](./13#QueryResponse) - [示例](./13#QuerySamples) - [错误码](./14#Errors) - [对账文件下载接口](./15) - [请求参数](./15#Forex_compare_file_Request) - [同步返回](./15#Forex_compare_file_Response) - [示例](./15#Forex_compare_file_Samples) - [错误码](./16) - [结算文件下载接口](./17) - [请求参数](./17#Forex_liquidation_file_Request) - [同步返回](./17#Forex_liquidation_file_Response) - [示例](./17#Forex_liquidation_file_Samples) - [错误码](./18) - [汇率查询接口](./19) - [请求参数](./19#Forex_rate_file_Request) - [同步返回](./19#Forex_rate_file_Response) - [示例](./19#Forex_rate_file_Samples) - [错误码](./20) - [境外二级线上商户报备接口](./33) - [请求参数](./33#request) - [同步返回](./33#sync) - [示例](./33#samples) - [错误码](./33#error) - [数字签名](./54) - [密钥准备](./40) - [签名](./47) - [异步通知验签](./49) - [同步通知验签](./50) - [支付宝对账文件](./30) - [关于支付宝账单](./30) - [获取账单](./31) - [API](./31#API) - [支付宝国际网站](./31#Global) - [SFTP](./31#SFTP) - [账单详细内容](./32) - [交易文件](./32#TransactionFile) - [结算文件](./32#SettlementFile) - [常用链接](./25) - [国际商户服务网站](./25) - [分账明细说明](./28) - [退分账明细说明](./29)
新-境外收单 - PC

结算文件下载接口

商家可以通过这个接口来查看上次结算以来的交易结算信息。

请求参数

参数

类型 (长度是字节)

描述

可选

示例

基本参数

service

String

接口名

N

forex_liquidation_file

partner

String(16)

境外商户在支付宝的用户ID. 2088开头的16位数字

N

2088001159940003

sign_type

String

签名算法: DSA, RSA, MD5.

N

RSA

sign

String

签名值

N

e5815a4556db338ed237f7d3fd222184

业务参数

start_date

String

交易的开始日期,格式为YYYYMMDD

N

 

end_date

String

交易的结束日期,格式为YYYYMMDD

N

  • 开始日期和结束日期最长10天
  • 当天的交易不会显示在下载的文件中
  • 现在这个接口只支持txt格式的文件下载。这个文件没有列标题。文件里的每个字段以“|”分割

同步返回

返回格式

返回内容可能是以下几种格式:

  • 如果网关报错,返回是xml格式的消息
  • 如果业务逻辑有错误,返回的是带错误消息的txt文件
  • 如果调用成功,返回带交易记录的txt文件

结算文件格式

序号

域名

类型

备注

  •  

外部交易号

String(64)

境外商户交易号(确保在境外商户系统中唯一)

  •  

交易金额

Number(8,2)

商品的金额(外币)

  •  

币种

String(10)

显示币种简称,具体参考附录:货币表

  •  

付款时间

String(14)

YYYYMMDDHHMMSS 格式,状态为“失败”和“待处理”的情况,这个域为空

  •  

清算时间

String(14)

YYYYMMDDHHMMSS 格式,如果没有清算,这个域为空

  •  

交易类型

String(1)

正常交易:P
申请退款:R

  •  

手续费

Number(8,2)

收取的手续费

  •  

状态

String(1)

正常交易记录状态: 已清算:L
正常退款记录状态: 已清算:L

  •  

备注

String(50)

交易项的名称,不支持特殊符号。

  •  

分账外币金额

Number(8,2)

该笔交易或退款对应的境内分账、退分账外币金额

  •  

分账人民币金额

Number(8,2)

该笔交易或退款对应的境内分账、退分账人民币金额

示例

请求示例

https://mapi.alipay.com/gateway.do?sign_type=MD5&sendFormat=normal&sign=bb4c92c7cb7fc8a5280fe5f9f7ac309c&_input_charset=UTF-8&end_date=20150524&service=forex_liquidation_file&partner=2088002007018916&start_date=20150520

返回示例

成功返回

成功的http返回是一个带交易记录的txt文件::

This interface enables the merchant reconcile the settled transactions with the settlement of the funds in the previous settlement cycle.

Request Parameters

Parameter

Type (length in bytes)

Description

Optional

Example

Basic Parameter

service

String

Service Name

N

forex_liquidation_file

partner

String(16)

Partner ID.
Composed of 16 digits beginning with 2088.

N

2088001159940003

sign_type

String

Signature method. The following are supported. Must be uppercase.
DSA, RSA, and MD5.

N

RSA

sign

String

Signature value.

N

e5815a4556db338ed237f7d3fd222184

Business Parameter

start_date

String

The start date of the reconciliation period, formatted as YYYYMMDD

N

 

end_date

String

The end date of the reconciliation period, formatted as   YYYYMMDD

N

 

  • The starting and end dates should be provided within a 10-day interval.
  • There is a time delay such that the transactions in the current day will not be listed in the return of this API call.
  • Currently the interface only supports .TXT file to be downloaded. The file contains no headings for data fields. Each data field is separated by “|”, following the order given in the specification.

Sync Response

Response format

The responses could be in different formats for different use cases

  • It is in XML format if there is error caught by the Gateway
  • It could in plain text error message if it is the error from the biz logic
  • It is a file to download if the call is successful.

File Format for the Settlement file in the Response

Order

Field name

Type

Description

1

Partner transaction ID

String(32)

The  Unique transaction ID passed by the merchants in the payment transaction

2

Amount

Number(8,2)

The amount of fund in foreign currency.

3

Currency

String(10)

Abbreviated currency names.

4

Payment Time

String(14)

YYYYMMDDHHMMSS
Empty if the status being “failed” or “waiting”.

5

Settlement Time

String(14)

YYYYMMDDHHMMSS
Empty if unliquidated

6

Transaction type

String(1)

Normal transaction: P
Refund transaction: R

7

Service charge

Number(8,2)

The amount of service charge.

8

Status

String(1)

Normal transaction:
L: Liquidated
Refund transaction:
L: Liquidated

9

Remark

String(50)

The name of the items. It should not contain special symbols.

10

Split foreign currency amount

Number(8,2)

This trade's split foreigh currency amount or this refund's split refund foreigh currency amount.

11

Split RMB amount

Number(8,2)

This trade's split RMB amount or this refund's split refund RMB amount.

Samples

Request Sample

https://mapi.alipay.com/gateway.do?sign_type=MD5&sendFormat=normal&sign=bb4c92c7cb7fc8a5280fe5f9f7ac309c&_input_charset=UTF-8&end_date=20150524&service=forex_liquidation_file&partner=2088002007018916&start_date=20150520

Response Samples

Success response

The response is HTTP response with an attached file, which is the settlement file with the transactions included.
The sample is for illustration of the browser download.

Error response from the biz logic:

File download failed: Over 10 days to Date period

Error response from the Gateway:

<?xml version="1.0" encoding="UTF-8"?>
<alipay>
<is_success>F</is_success>
<error>ILLEGAL_SIGN</error>
</alipay>

An example of settlement report file:

23342343423|102.32|USD|20070615090001|2007622090001|P|2.04|L|Liquidated

业务逻辑错误返回:
File download failed: Over 10 days to Date period
网关错误返回:
<?xml version="1.0" encoding="UTF-8"?>
<alipay>
<is_success>F</is_success>
<error>ILLEGAL_SIGN</error>
</alipay>

示例结算文件

下面是一个示例结算文件:

23342343423|102.32|USD|20070615090001|2007622090001|P|2.04|L|Liquidated
客服小机器人

NEED HELP ?