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

notify_verify

Call this API to validate whether a notification is from the Alipay server, and to ensure the authenticity of the response data.

Mechanism

Assemble the parameter notify ID (notify_id) into a URL according to Alipay requirement. For example:

https://intlmapi.alipay.com/gateway.do?service=notify_verify&partner=2088002396712354&notify_id=RqPnCoPT3K9%2Fvwbh3I%2BFioE227%2BPfNMl8jwyZqMIiXQWxhOCmQ5MQO%2FWd93rvCB%2BaiGg

With this request URL, result data from the Alipay server can be obtained by simulating the HTTP request interaction with the Alipay server. If the returned data is true, the verification succeeds. Otherwise, the verification is failed.

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:notify_verify

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

sign_type

String Required

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

Example:RSA

sign

String Required

Sign value

Example:ciSBXc7gjCfXW8KMBxFiFH2cbMZtFelfTOGKqY2NF7q98RnH3E%2BiF5Cj%2Fu%2Bl8py1D%2FOsE%2FAva1ls8A6Tw1MzhG6ideJSgh4FxWmAjEnlczdfLj%2FqzA6qGzxdKGEXaSDFmTGglOembXUqK8g8ajICD%2BBH7xoxBRY7vtfylEXtojs%3D

Business parameter

notify_id

String(34) Required

Notification ID, used by the partner system to verify the notification

Response

Synchronous response

The response is a string with the status.

Error codes

Business errors

Returned result

Description

SYSTEM_EXCEPTION

Alipay system error

ILLEGAL_ARGUMENT

Incorrect parameter

ILLEGAL_SIGN

Illegal signature

ILLEGAL_SERVICE

The service parameter is incorrect.

ILLEGAL_PARTNER

Incorrect partner ID

ILLEGAL_SIGN_TYPE

Signature is of wrong type.

Access errors

Returned result

Description

SYSTEM_EXCEPTION

Alipay system error

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?service=notify_verify&partner=208xxxxxxxxx6931&sign_type=MD5&notify_id=201xxxxxxxxxxxxxxxxxxxxxxxxxxx9837&sign=15e82ada70910dbaa251f69de45d662a

Response

If the input parameter is invalid, return,

copy
Invalid

If the notification is from Alipay, and inquires in the valid time frame, (1 min)

copy
True

If the notification is not from Alipay, or passes 1 min time frame,

copy
False