Call Payment
Update Time:2025.01.07the merchant server first calls the [Order Placement API] to generate a prepayment order, and signs the obtained parameter prepay_id again before transferring it to the app to initiate payment.
1. API intro
Applicable object: Common mode Institutional mode
2. Request Parameters
This API signature has no background interface interaction, and the data in the list shall be signed
the client request field (Note: The following field names are case sensitive):
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
APPID | appId | string[1,16] | Yes | APPID corresponding to the mobile app applied by the merchant on the WeChat Open Platform |
Merchant ID | partnerid | string[1,32] | Yes | Merchant ID assigned by WeChat Pay. |
Prepayment transaction session | prepayid | string[1,64] | Yes | Prepayment session ID generated by WeChat, which is used in subsequent API calls. The value is valid for 2 hours. |
An extension string for order details | package | string[1,128] | Yes | Specify as the static value “Sign=WXPay” |
Random string | noncestr | string[1,32] | Yes | Random string, not longer than 32 digits. It is recommended to use the random number generation algorithm. |
Timestamp | timestamp | string[1,10] | Yes | The current time. For details, see timestamp rules. |
Signature | paySign | string[1,64] | Yes | Signature. For more information, see the paySign generation rules. |
3. paySign Generating Rules
3.1.Construct a signature string
There are four lines in the signature string, and each line is a parameter. Each line ends with \n (Newline character; the ASCII code value is 0x0A), and even the last line shall ends with \n. If the parameter itself ends with \n, an additional \n is also required
Signature fields and formats:
Example of a string to be signed:
3.2. Calculating signature value:
The signature method is the same as the signature for request data. Use the merchant private key to sign the string using the SHA256-with-RSA signature algorithm, and obtain the signature value through Base64 encoding.
The sample code is as follows:
IOS
Android