Field | Type | Description | Details |
---|---|---|---|
order_id | String | Order ID | The order ID assigned by YiSiHui. |
pay_result | Int | Payment Result | 1 for success, 0 for failure. |
pay_amount | Float | Payment Amount | A floating-point value, e.g., 10000.00 . |
pay_datetime | String | Payment Time | A string, e.g., 2017-10-12 10:00:00 . |
extend_info | String | Extended Info | Reserved for future use. |
sign | String | Signature | Generated using MD5. See the detailed process below. |
sign
field from the parameters. Sort the remaining parameters alphabetically by their key names. If the first letters are the same, compare the second letters, and so on.&
symbol to separate each key-value pair in the format key=value
.sign
field in the notification.{
"order_id": "ETxxxxxxxxxxxx01",
"pay_result": 1,
"pay_amount": 10000.00,
"pay_datetime": "2024-12-01 10:00:00",
"extend_info": ""
}
extend_info=&order_id=ETxxxxxxxxxxxx01&pay_amount=10000.00&pay_datetime=2024-12-01 10:00:00&pay_result=1
abc123
) (optional):abc123extend_info=&order_id=ETxxxxxxxxxxxx01&pay_amount=10000.00&pay_datetime=2024-12-01 10:00:00&pay_result=1
MD5("abc123extend_info=&order_id=ETxxxxxxxxxxxx01&pay_amount=10000.00&pay_datetime=2024-12-01 10:00:00&pay_result=1")
sign
field.{
"order_id": "ETxxxxxxxxxxxx01",
"pay_result": 1,
"pay_amount": 10000.00,
"pay_datetime": "2024-12-01 10:00:00",
"extend_info": "",
"sign": "652614570bcc49940d7dcc7a3c3dc7e5"
}
# Python3
import hashlib
def generate_sign(sign_params: dict, salt=None) -> str:
if not salt:
salt = ""
md5_text = str(salt) + "&".join(
[f"{k}={v}" for k, v in sorted(sign_params.items())]
)
return hashlib.md5(bytes(md5_text, encoding="utf-8")).hexdigest()