Call Payment
the 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.
the 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.
Applicable object: Common mode Institutional mode
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 Example: wx8888888888888888 |
Merchant ID | partnerid | string[1,32] | Yes | Merchant ID assigned by WeChat Pay. Example: 1900000109 |
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. Example: WX1217752501201407033233368018 |
An extension string for order details | package | string[1,128] | Yes | Specify as the static value “Sign=WXPay” Example: 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. Example: 5K8264ILTKCH16CQ2502SI8ZNMTM67VS |
Timestamp | timestamp | string[1,10] | Yes | The current time. For details, see timestamp rules. Example: 1412000000 |
Signature | paySign | string[1,64] | Yes | Signature. For more information, see the paySign generation rules. Example: C380BEC2BFD727A4B6845133519F3AD6 |
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
Account ID
Timestamp
Random string
Prepayment transaction session
wx8888888888888888
1414561699
5K8264ILTKch16CQ2502SI8ZNMTM67VS
123456789
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.
$ echo -n -e \
"wx8888888888888888\n1414561699\n5K8264ILTKCH16CQ2502SI8ZNMTM67VS\nprepay_id=wx201410272009395522657a690389285100\n" \
| openssl dgst -sha256 -sign apiclient_key.pem \
| openssl base64 -A
uOVRnA4qG/MNnYzdQxJanN+zU+lTgIcnU9BxGw5dKjK+VdEUz2FeIoC+D5sB/LN+nGzX3hfZg6r5wT1pl2ZobmIc6p0ldN7J6yDgUzbX8Uk3sD4a4eZVPTBvqNDoUqcYMlZ9uuDdCvNv4TM3c1WzsXUrExwVkI1XO5jCNbgDJ25nkT/c1gIFvqoogl7MdSFGc4W4xZsqCItnqbypR3RuGIlR9h9vlRsy7zJR9PBI83X8alLDIfR1ukt1P7tMnmogZ0cuDY8cZsd8ZlCgLadmvej58SLsIkVxFJ8XyUgx9FmutKSYTmYtWBZ0+tNvfGmbXU7cob8H/4nLBiCwIUFluw==
PayReq *request = [[[PayReq alloc] init] autorelease];
request.partnerId = @"10000100";
request.prepayId= @"1101000000140415649af9fc314aa427";
request.package = @"Sign=WXPay";
request.nonceStr= @"a462b76e7436e98e0ed6e13c64b4fd1c";
request.timeStamp= @"1397527777";
request.sign= @"oR9d8PuhnIc+YZ8cBHFCwfgpaK9gd7vaRvkYD7rthRAZ\/X+QBhcCYL21N7cHCTUxbQ+EAt6Uy+lwSN22f5YZvI45MLko8Pfso0jm46v5hqcVwrk6uddkGuT+Cdvu4WBqDzaDjnNa5UK3GfE1Wfl2gHxIIY5lLdUgWFts17D4WuolLLkiFZV+JSHMvH7eaLdT9N5GBovBwu5yYKUR7skR8Fu+LozcSqQixnlEZUfyE55feLOQTUYzLmR9pNtPbPsu6WVhbNHMS3Ss2+AehHvz+n64GDmXxbX++IOBvm2olHu3PsOUGRwhudhVf7UcGcunXt8cqNjKNqZLhLw4jq\/xDg==";
[WXApi sendReq:request];
Customer Service Tel
Business Development
9:00-18:00
Monday-Friday GMT+8
Technical Support
WeChat Pay Global
ICP证