Login expired. Please log in again.

Feedback

0/300

Feedback

Submitted successfully

ok

Feedback

Network exception, please try again later

ok

Call Payment

Latest update time:2020.01.08 Release notes


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.


API intro

Applicable object:Common mode Institutional mode

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[(32) Yes APPID corresponding to the mobile app applied by the merchant on the WeChat Open Platform
Example:wx8888888888888888
Merchant ID partnerid string(32) Yes Merchant ID assigned by WeChat Pay.
Example:1900000109
Prepayment transaction session prepayid string(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(128) Yes Specify as the static value “Sign=WXPay”
Example:Sign=WXPay
Random string noncestr string(32) Yes Random string, not longer than 32 digits. It is recommended to use the random number generation algorithm.
Example: 5K8264ILTKCH16CQ2502SI8ZNMTM67VS
Timestamp timestamp string(10) Yes The current time. For details, see timestamp rules.
Example:1412000000
Signature sign string(256) Yes Signature,Use fields appId、timeStamp、nonceStr、prepayidCalculate the signature value
Note:Signature type,Default is RSA.
Example:oR9d8PuhnIc+YZ8cBHFCwfgpaK9qZLhLw4jq\/xDg==

The APP Invoke Pay parameters shall be calculated according to the signature rules:

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

Fields and formats involved in the signature:

Official Account ID 
Timestamp
Random string
An extension string for order details

Example of a string to be signed:

wx8888888888888888
1414561699
5K8264ILTKCH16CQ2502SI8ZNMTM67VS
WX1217752501201407033233368018

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\nWX1217752501201407033233368018\n" \
  | openssl dgst -sha256 -sign apiclient_key.pem \
  | openssl base64 -A
  uOVRnA4qG/MNnYzdQxJanN+zU+lTgIcnU9Bx7cob8H/4nLBiCwIUFluw==
                

Example


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];

IWXAPI api;
PayReq request = new PayReq();
request.appId = "wxd930ea5d5a258f4f";
request.partnerId = "1900000109";
request.prepayId= "1101000000140415649af9fc314aa427",;
request.packageValue = "Sign=WXPay";
request.nonceStr= "1101000000140429eb40476f8896f4c9";
request.timeStamp= "1398746574";
request.sign= "oR9d8PuhnIc+YZ8cBHFCwfgpaK9gd7vaRvkYDSs2+AehHvz+n64GDmXxbX++IOBvm2olHu3PsOUGRwhudhVf7UcGcunXt8cqNjKNqZLhLw4jq\/xDg==";
api.sendReq(request);




版本说明

关闭
V1.0
2020年1月08日
1. APP调起支付接口上线

About  WeChat  Pay

Powered By Tencent & Tenpay Copyright©

2005-2024 Tenpay All Rights Reserved.

Contact Us
Wechat Pay Global

WeChat Pay Global