Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

forex_rate_file

Call this interface to obtain the exchange rate from Alipay.

The exchange rate changes once a day between 9:00 and 11:00 GMT+8. In addition, you can call this interface for a maximum of 100 times each day.

Request

Service address

Environment

HTTPS request URL

Production environment

https://intlmapi.alipay.com/gateway.do

Test environment

https://mapi.alipaydev.com/gateway.do

Request parameters

ParameterDescription
Basic parameter

service

String Required

Interface name

Example:forex_rate_file

partner

String(16) Required

The partner ID that is assigned by Alipay to identify an Alipay account. The partner ID is composed of 16 digits and begins with 2088.

Example:2088*********662

_input_charset

String Required

The charset with which the request data are encoded. GBK and UTF-8 are supported. 

Example:UTF-8

sign_type

String Required

Sign type. RSA, RSA2 and MD5 are supported. Use uppercase.

Example:RSA

sign

String Required

Sign value.

Example:e5815a4556db338ed237f7d3fd222184

Notes:

  • The interface only supports .txt file to be downloaded.

  • The file contains no headings for data fields, and each data field is separated by "|".

  • The data are just for current day's exchange rate.

Response

Synchronous response

File format for the transaction file

ParameterDescription

Date

String(8)

The releasing date of the rate, which is in a format of YYYYMMDD

Time

String(6)

The releasing time of the rate, which is in a format of HHMMSS

Currency

String(3)

Abbreviated currency names

Rate

String(10)

Rate

Error codes

Business errors

Returned result

Description

System exception

Alipay system error

Merchant ID incorrect

Invalid partner ID

File empty

Null content of the file

Access errors

Returned result

Description

ILLEGAL_ARGUMENT

Incorrect parameter

ILLEGAL_SIGN

Illegal signature

ILLEGAL_SERVICE

Service parameter is incorrect

ILLEGAL_PARTNER

Incorrect partner ID

ILLEGAL_SIGN_TYPE

Signature is of wrong type.

ILLEGAL_PARTNER_EXTERFACE

Service is not activated for this account.

ILLEGAL_DYN_MD5_KEY

Dynamic key information is incorrect.

ILLEGAL_ENCRYPT

Encryption is incorrect.

ILLEGAL_USER

User ID is incorrect.

ILLEGAL_EXTERFACE

Interface configuration is incorrect.

ILLEGAL_AGENT

Agency ID is incorrect.

HAS_NO_PRIVILEGE

No right to visit

INVALID_CHARACTER_SET

The character set is invalid.

System errors

Returned result

Description

SYSTEM_ERROR

Alipay system error

SESSION_TIMEOUT

Session timeout

ILLEGAL_TARGET_SERVICE

Wrong target service

ILLEGAL_ACCESS_SWITCH_SYSTEM

Merchant is not allowed to visit system of this type.

EXTERFACE_IS_CLOSED

The interface has been closed.

Samples

Request

https://intlmapi.alipay.com/gateway.do?_input_charset=UTF-8&service=forex_rate_file&partner=208xxxxxxxxx6931&sign_type=MD5&sign=07b301b14738c06c9465f83718c0177c

Response

Success response

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

image

Business error response

copy
File download failed: Over 10 days to Date period

Access error response

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

Rate file

copy
20160504|100030|CHF|6.829600|
20160504|100030|EUR|7.491500|
20160504|100030|THB|0.185877|
20160504|100030|DKK|1.007800|
20160504|100030|SGD|4.815600|
20160504|100030|GBP|9.476100|
20160504|100030|HKD|0.838800|
20160504|100030|NOK|0.803000|
20160504|100030|CAD|5.124900|
20160504|100030|KRW|0.005814|
20160504|100030|NZD|4.496100|
20160504|100030|JPY|0.060934|
20160504|100030|AUD|4.877600|
20160504|100030|SEK|0.809800|
20160504|090530|USD|6.534600|