视频一区二区三区自拍_千金肉奴隷1985未删减版在线观看_国产成人黄色视频在线播放_少女免费播放片高清在线观看_国产精品v欧美精品v

Login expired. Please log in again.

Feedback

0/300

Feedback

Submitted successfully

ok

Feedback

Network exception, please try again later

ok

Development Guidelines

1. API Rules

In order to provide a simple, consistent and easy-to-use development experience to merchants while ensuring payment security, we have launched the latest WeChat Pay APIv3 interface. Please refer to “APIv3 Interface Rules” for the specific rules of this API version.

2. Development Environment Setup

To help developers call the open interface, the development libraries of JavaPHPGO are provided, encapsulating the basic functions such as signature generation, signature verification, encryption/decryption of sensitive information, and media document upload

3、Fast Access

3.1、Business Sequence Chart

3.2. Example of API access

The document shows how to use the WeChat Pay server SDK to In-App Payment by scanning code and interface with WeChat Pay.

Notice

? The code examples in the document illustrate the basic usage of API. Before running the code, the example parameters in the code need to be replaced with the merchant's own account and request parameters.

? The access steps below are for your information, and should be evaluated and modified according to the merchant’s own business demands.

3.2.1 Mini Program Pre-signing

Procedure: As described in the Step 2.2 of the Sequence Diagram, when the user agrees to the withholding services in the merchant’s mini program, the merchant should request the Mini Program - Pre-signing API to obtain the pre-signing ID (session_id) for futher pulling up the signing of mini program.


//Obtaining Signing Session ID API for mini-program signing
public void miniProgramSignTest() throws IOException {
	String miniprogramSignBody = ""
	"{
	"expired_time": "2021-11-20T13:29:35+08:00",
	"openid": "of8YZ6A_ySrPYzjX7joXo_0000",
	"out_contract_code": "20220614out_contract_code",
	"plan_id": 10001,
	"sp_appid": "wx7bc9000000000000",
	"sub_mchid": "90325355",
	"success_notify_url": "https://yoursite.com",
	"user_display_name": "mike"
}
""
";
HttpPost httpPost = new HttpPost("https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/miniprogram-pre-entrust-sign");
httpPost.addHeader("Accept", "application/json");
httpPost.addHeader("Content-type", "application/json; charset=utf-8");
httpPost.setEntity(new StringEntity(miniprogramSignBody));
CloseableHttpResponse response = httpClient.execute(httpPost);
//Process the response
}

//Mini program signing API
func miniProgramSigning() {
	signBody := `{
"expired_time": "2021-11-20T13:29:35+08:00",
"openid": "of8YZ6A_ySrPYzjX7joXo_0000",
"out_contract_code": "20220614out_contract_code",
"plan_id": 10001,
"sp_appid": "wx7bc9000000000000",
"sub_mchid": "90325355",
"success_notify_url": "https://yoursite.com",
"user_display_name": "mike"
}`
	
	result, err := client.Post(ctx, "https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/miniprogram-pre-entrust-sign", signBody)
	if err != nil {
		// Process error
	}
	log.Printf("%s", result.Response.Body)                

//Mini Program Signing API
  public function miniProgramSigning($instance)
  {
    try {
      $resp = $instance
        ->chain('v3/global/papay/contracts/miniprogram-pre-entrust-sign')
        ->post([
          'json' => [
            "sp_appid" => "wx7bc9000000000000",
			"sub_mchid" => "90325355",
            "openid" => "of8YZ6A_ySrPYzjX7joXo_0000",
            "out_contract_code" => "20220614out_contract_code",
            "plan_id" => 10001,
            "success_notify_url" => "https://www.yoursite.com",
            "user_display_name" => "mike",
			"expired_time" => "2021-11-20T13:29:35+08:00",
          ]
        ]);

      echo $resp->getStatusCode(), PHP_EOL;
      echo $resp->getBody(), PHP_EOL;
    } catch (\Exception $e) {
      // Exception handling
    }
  }

									{
										"stock_id": "Python",
										"stock_creator_mchid": "123456",
										"limit": 10,
									}

3.2.2 Mini Program Pull-up Signing

Procedure:

1. Parse the Body json string returned by the 3.1 Mini Program Pre-signing interface, get the session_id therein. The return example is as follows: Pull up the signing mini program with the session_id obtained in the previous step

2. Pull up the signing mini program with the session_id obtained in the previous step

Code example:

				
 var session_id = "201710180325670965"; // obtained from miniprogram-pre-entrust-sign
// start signing process
wx.navigateToMiniProgram({
	appId: wxbd687630cd02ce1d,
	path: 'pages/Oversea/walletSelect?sessionId=' + session_id,
	extraData: {},
	success(res) {
		// Jumped to the signing mini program successfully
	},
	fail(res) {
		// Failed to jump to the signing mini program 
	}
})

// After signing process, user will return back to merchant's miniprogram
App({
	onShow(res)  {
		if  (res.scene  ===  1038)  {  //Scenario value 1038: return from the opened min program
			const { appId, extraData } = res.referrerInfo
			if  (appId  ==  'wxbd687630cd02ce1d')  {  // appId is wxbd687630cd02ce1d: jump back from the signing min program
				if  (typeof  extraData  ==  'undefined') {
					// TODO
					// The client min program is not sure of the signing result and needs to request the merchant-side background to confirm the signing result
					return;
				}
				if (extraData.return_code  ==  'SUCCESS') {
					// TODO
					// The client min program signs successfully and needs to request the merchant-side background to confirm the signing result
					var  contract_id  =  extraData.contract_id
					return;
				} 
				else  {
					// TODO
					// Signing failed
					return;
				}
			}
		}
	}
})
    			

3.2.3 Notification of Signing Results

Procedure: After the user has signed the contract, WeChat Pay will push the notification of signing results to the success_notify_url introduced while signing the contract, and the merchant needs to feed back accordingly after receiving the notification.

Example of signing notification


 // 簽約成功回調(diào) http body 數(shù)據(jù)示例
{
    "id":"EV-2018022511223320873",
    "create_time":"2022-06-14T14:01:35+08:00",
    "resource_type":"encrypt-resource",
    "event_type":"PAPAY.SIGN",
	"summary": "簽約成功",
    "resource" : {
        "algorithm":"AEAD_AES_256_GCM",
        "ciphertext": "...",
        "nonce": "dAvnRJWFOfdL",
        "associated_data": "papay"
    }
}
// 對 resource.ciphertext 解密后得到的數(shù)據(jù)示例如下:
{
   "sp_mchid":"10000091",
   "sub_mchid":"10000097",
   "out_contract_code":"100001256",
   "plan_id":123,
   "contract_id":"Wx15463511252015071056489715",
   "sp_appid":"wxcbda96de0b165486",
   "openid":"ouFhd5X9s9WteC3eWRjXV3lea123",
   "operate_time":"2015-09-01T10:00:00+08:00"
}

// 解約成功回調(diào) http body 數(shù)據(jù)示例
{
   "id":"2646bee0-aef8-5804-9752-ef1a56170fdf",
   "create_time":"2022-06-14T16:31:53+08:00",
   "resource_type":"encrypt-resource",
   "event_type":"PAPAY.TERMINATE",
   "summary":"解約成功",
   "resource":{
      "original_type":"papay",
      "algorithm":"AEAD_AES_256_GCM",
      "ciphertext": "...",
      "associated_data":"papay",
      "nonce":"SExJ2Xxx7sr1"
   }
}
// 對 resource.ciphertext 解密后得到的數(shù)據(jù)示例如下:
{
	"sp_mchid": "10000091",
	"sub_mchid": "10000097",
	"out_contract_code": "100001256",
	"plan_id": 123,
	"contract_id": "Wx15463511252015071056489715",
	"sp_appid": "wxcbda96de0b165486",
	"openid": "ouFhd5X9s9WteC3eWRjXV3lea123",
	"contract_termination_mode": "USER",
	"operate_time": "2015-10-01T10:00:00+08:00"
}

When the merchant receives the callback notification from WeChat Pay, it should update the locally stored user signing status and return the following http body to WeChat Pay after the update is completed, and the http status should be set to 200.


{
	"code": "SUCCESS",
	"message": "OK"
}
    			
Notice

? The payment result notification accesses the notification URL set by the merchant using the POST method, and the notification data is transmitted through the request body (BODY) in the JSON format. The data in the notification includes the details about the encrypted payment result.

? Encryption does not guarantee that the notification requests come from WeChat. WeChat will sign the notification sent to the merchant and put the signature value in the HTTP header Wechatpay-Signature of the notification. Merchants should verify the signature to confirm that the request comes from WeChat, and not any other third parties. For the signature verification algorithm, please refer to the WeChat Pay API V3 Signature Verification.

? The http response code of the payment notification should be either 200 or 204 for normal receipt. In case of any callback processing error, the HTTP status code of the response should be 500 or 4xx

? The merchant should return a successful http response code of 200 or 204 after successfully receiving the callback notification

? The same notification may be sent to the merchant system multiple times. The merchant system must be able to process duplicate notifications properly. It is recommended to first check the status of the corresponding business data when receiving a notification for processing, and determine whether the notification has been processed. If not, the notification should be processed; if it has been processed, the success result should be returned. Before status checking and processing of the business data, a data lock should be used to implement concurrency control and avoid data confusion caused by function reentry.

? When interacting with the background notification, if the response received by WeChat from the merchant is nonconforming or timed out, WeChat thinks the notification fails. WeChat will periodically resend the notification according to the specified policy to maximize the success rate of the notification, but WeChat does not guarantee final success of the notification. ((Notification frequency is 15s/15s/30s/3m/10m/20m/30m/30m/30m/60m/3h/3h/3h/6h/6h - total 24h and 4m))

3.2.4 Query Signing Results

Procedure: An exception is found with the merchant background, network, or server, and the merchant system does not receive the notification of signing results, the merchant may verify the signing status through the Query Signing Results API. WeChat Pay allows query the signing status by the merchant contract number (out_contract_code) or by the WeChat contract number (contract_id) returned by WeChat Pay.

Query the signing status by contract_id


//Querying Signing Status (By contract_id) API
    public void querySignStatusTest() throws IOException {
        HttpGet httpGet = new HttpGet("https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/202203242337333903387184301572?sub_mchid=10000097&sp_appid=wxcbda96de0b165486&sub_appid=wxcbda96de0b165484");
        httpGet.addHeader("Accept", "application/json");
        httpGet.addHeader("Content-type", "application/json; charset=utf-8");
        CloseableHttpResponse response = httpClient.execute(httpGet);
        //Process the response
    }

//Querying signing status API
func querySigningStatus() {
	result, err := client.Get(ctx, "https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/202203242337333903387184301572?sub_mchid=10000097&sp_appid=wxcbda96de0b165486&sub_appid=wxcbda96de0b165484")
	if err != nil {
		// Process error
	}
	log.Printf("status=%d resp=%s", result.Response.StatusCode, result.Response.Body)
}                

//Querying Signing Status (By contract_id) API
  public function querySignStatus($instance)
  {
    try {
      $resp = $instance
        ->v3->global->papay->contracts->_contract_id_
        ->get([
          'query' => [
            'sp_appid' => 'wxcbda96de0000006',
            'sub_appid' => 'wxcbda96de0000004',
            'sub_mchid' => '110000000'
          ],
          'contract_id' => '202203242337333903387184301572'
        ]);

      echo $resp->getStatusCode(), PHP_EOL;
      echo $resp->getBody(), PHP_EOL;
    } catch (\Exception $e) {
      // Exception handling
    }
  }

									{
										"stock_id": "Python",
										"stock_creator_mchid": "123456",
										"limit": 10,
									}

Query the signing status by out_contract_code


    //Querying Signing Status (By out_contract_code)
    public void querySignStatusByContractCodeTest() throws IOException {
        HttpGet httpGet = new HttpGet("https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/out-contract-code/100001261?sp_appid=wxcbda96de0b165486&sub_appid=wxcbda96de0b165484&plan_id=123");
        httpGet.addHeader("Accept", "application/json");
        httpGet.addHeader("Content-type", "application/json; charset=utf-8");
        CloseableHttpResponse response = httpClient.execute(httpGet);
        //Process the response
    }

//Querying signing status by out_contract_code API
func querySigningStatusByContractCode() {
	result, err := client.Get(ctx, "https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/out-contract-code/100001261?sp_appid=wxcbda96de0b165486&sub_appid=wxcbda96de0b165484&plan_id=123")
	if err != nil {
		// Process error
	}
	log.Printf("status=%d resp=%s", result.Response.StatusCode, result.Response.Body)
}                

  //Querying Signing Status (By out_contract_code) API
  public function querySignStatusByContractCode($instance)
  {
    try {
      $resp = $instance
        ->v3->global->papay->contracts->outContractCode->_out_contract_code_
        ->get([
          'query' => [
            'sp_appid' => 'wxcbda96de0000006',
            'sub_appid' => 'wxcbda96de0000004',
            'sub_mchid' => '110000000'
          ],
          '_out_contract_code_' => '100005698'
        ]);

      echo $resp->getStatusCode(), PHP_EOL;
      echo $resp->getBody(), PHP_EOL;
    } catch (\Exception $e) {
      // Exception handling
    }
  }

									{
										"stock_id": "Python",
										"stock_creator_mchid": "123456",
										"limit": 10,
									}

Critical parameters:

contract_id: the unique contract number returned fro the WeChat side, such as: 202203242337333903387184301572

Out_contract_code: the contract number generated by the merchant side, such as: 100001261

sp_appid: appid bound to the service provider’s Official Account

sub_appid: mini program appid of the sub-merchant who initiates the signing

Please refer to the API document for ordering by scanning code for other critical parameters.

3.2.5 Deduction

Procedure: After signing the contract, the merchant can initiate a deduction using the corresponding contract ID


//Applying for Termination API
public void deductionTest() throws IOException {
		String deductionBody = """
{
	"sp_appid": "wxcbda96de0b165486",
	"sub_mchid": "10000097",
	"sub_appid": "wxcbda96de0b165484",
	"description": "PAPAuto-debit支付測試",
	"attach": "支付測試",
	"notify_url": "https://wxpay.wxutil.com/pub_v2/pay/notify.v2.php",
	"out_trade_no": "1217752501201407033233368018",
	"goods_tag": "WXG",
	"merchant_category_code": "1011",
	"contract_id": "Wx15463511252015071056489715",
	"amount": {
		"total": 10000,
		"currency": "HKD"
	},
	"scene_info": {
		"device_ip": "59.37.125.32",
		"device_id": "013467007045764"
	}
}
""";
        HttpPost httpPost = new HttpPost("https://apihk.mch.weixin.qq.com/v3/global/papay/transactions");
        httpPost.addHeader("Accept", "application/json");
        httpPost.addHeader("Content-type", "application/json; charset=utf-8");
        httpPost.setEntity(new StringEntity(deductionBody));
        CloseableHttpResponse response = httpClient.execute(httpPost);
        //Process the response
}

//Deduction API
func deduction() {
	body := `
{
	"sp_appid": "wxcbda96de0b165486",
	"sub_mchid": "10000097",
	"sub_appid": "wxcbda96de0b165484",
	"description": "PAPAuto-debit支付測試",
	"attach": "支付測試",
	"notify_url": "https://wxpay.wxutil.com/pub_v2/pay/notify.v2.php",
	"out_trade_no": "1217752501201407033233368018",
	"goods_tag": "WXG",
	"merchant_category_code": "1011",
	"contract_id": "Wx15463511252015071056489715",
	"amount": {
		"total": 10000,
		"currency": "HKD"
	},
	"scene_info": {
		"device_ip": "59.37.125.32",
		"device_id": "013467007045764"
	}
}
`
	result, err := client.Post(ctx, "https://apihk.mch.weixin.qq.com/v3/global/papay/transactions", body)
	if err != nil {
		// Process error
	}
	log.Printf("%s", result.Response.Body)
}               

//Deduction API
  public function deduction($instance)
  {
    try {
      $resp = $instance
        ->v3->global->papay->transactions
        ->post([
          'json' => [
            "sp_appid" => "wxcbda96de0b165486",
            "sub_mchid" => "10000097",
            "sub_appid" => "wxcbda96de0b165484",
            "description" => "PAPAuto-debit支付測試",
            "attach" => "支付測試",
            "notify_url" => "https://wxpay.wxutil.com/pub_v2/pay/notify.v2.php",
            "out_trade_no" => "1217752501201407033233368018",
            "goods_tag" => "WXG",
            "merchant_category_code" => "1011",
            "contract_id" => "Wx15463511252015071056489715",
            "amount" => array(
              "total" => 10000,
              "currency" => "HKD"
            ),
            "scene_info" => array(
              "device_ip" => "59.37.125.32",
              "device_id" => "013467007045764"
            )
          ]
        ]);
      echo $resp->getStatusCode(), PHP_EOL;
      echo $resp->getBody(), PHP_EOL;
    } catch (\Exception $e) {
      // Exception handling
    }
  }

									{
										"stock_id": "Python",
										"stock_creator_mchid": "123456",
										"limit": 10,
									}

Critical parameters:

contract_id: the user’s contract number, WeChat Pay verifies the contract relationship between the user and the merchant according to this field. NO_AUTH indicating that the contract does not exist will be returned if no contract has been signed or the user has terminated the contract.

3.2.6 Notification of Deduction Results

Procedure: WeChat Pay will send a asynchronous notification to the merchant, indicating the successful deduction, if any, through the notify_url parameter in the deduction request.

Notice

? The payment result notification accesses the notification URL set by the merchant using the POST method, and the notification data is transmitted through the request body (BODY) in the JSON format. The data in the notification includes the details about the encrypted payment result.

? Encryption does not guarantee that the notification requests come from WeChat. WeChat will sign the notification sent to the merchant and put the signature value in the HTTP header Wechatpay-Signature of the notification. Merchants should verify the signature to confirm that the request comes from WeChat, and not any other third parties. For the signature verification algorithm, please refer to the WeChat Pay API V3 Signature Verification.

? The http response code of the payment notification should be either 200 or 204 for normal receipt. In case of any callback processing error, the HTTP status code of the response should be 500 or 4xx

? The merchant should return a successful http response code of 200 or 204 after successfully receiving the callback notification

? The same notification may be sent to the merchant system multiple times. The merchant system must be able to process duplicate notifications properly. It is recommended to first check the status of the corresponding business data when receiving a notification for processing, and determine whether the notification has been processed. If not, the notification should be processed; if it has been processed, the success result should be returned. Before status checking and processing of the business data, a data lock should be used to implement concurrency control and avoid data confusion caused by function reentry.

? When interacting with the background notification, if the response received by WeChat from the merchant is nonconforming or timed out, WeChat thinks the notification fails. WeChat will periodically resend the notification according to the specified policy to maximize the success rate of the notification, but WeChat does not guarantee final success of the notification. ((Notification frequency is 15s/15s/30s/3m/10m/20m/30m/30m/30m/60m/3h/3h/3h/6h/6h - total 24h and 4m))


// 扣款結果通知 http body 數(shù)據(jù)示例
{
    "id":"EV-2018022511223320873",
    "create_time":"20180225112233",
    "resource_type":"encrypt-resource",
    "event_type":"TRANSACTION.SUCCESS",
    "resource" : {
        "algorithm":"AEAD_AES_256_GCM",
        "ciphertext": "...",
        "nonce": "...",
        "associated_data": ""
    }
}
// 對 resource.ciphertext 解密后得到的數(shù)據(jù)示例如下:
{
	"sp_mchid": "10000100",
	"sp_appid": "wx2421b1c4370ec43b",
	"sub_mchid": "20000100",
	"out_trade_no": "20150806125346",
	"transaction_id": "1008450740201411110005820873",
	"attach": "支付測試",
	"trade_type": "AUTH",
	"bank_type": "CCB_DEBIT",
	"success_time": "2018-06-08T10:34:56+08:00",
	"trade_state": "SUCCESS",
	"trade_state_desc": "支付成功",
	"merchant_category_code": "1011",
	"contract_id": "Wx15463511252015071056489715",
	"payer": {
		"sp_openid": "oUpF8uN95-Ptaags6E_roPHg7AG0"
	},
	"amount": {
		"total": 528800,
		"currency": "HKD",
		"payer_total": 518799,
		"payer_currency": "CNY",
		"exchange_rate": {
			"type": "SETTLEMENT_RATE",
			"rate": 8000000
		}
	},
	"promotion_detail": [{
		"promotion_id": "109519",
		"name": "單品惠-6",
		"scope": "SINGLE",
		"type": "DISCOUNT",
		"amount": 1,
		"currency": "HKD",
		"activity_id": "931386",
		"wechatpay_contribute_amount": 1,
		"merchant_contribute_amount": 0,
		"other_contribute_amount": 0,
		"goods_detail": [{
			"goods_id": "iphone6s_16G",
			"goods_remark": "商品備注",
			"quantity": 1,
			"price": 528800
		}]
	}]
}
    			

3.2.7 Order Query API

Procedure: An exception is found with the merchant background, network, or server, and the merchant system does not receive the payment notification, the merchant may verify the order payment status through the Query Order interface.


	//Query transaction details by transaction_id   
	public void queryOrderByIdTest() throws IOException {
        HttpGet httpGet = new HttpGet("https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/4015463511252015071056489715?sub_mchid=10000097");
        httpGet.addHeader("Accept", "application/json");
        httpGet.addHeader("Content-type", "application/json; charset=utf-8");
        CloseableHttpResponse response = httpClient.execute(httpGet);
        //Process the response
    }

	//Query transaction details by out_trade_no
	public void queryOrderByNoTest() throws IOException {
        HttpGet httpGet = new HttpGet("https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/out_trade_no/1217752501201407033233368018?sub_mchid=10000097");
        httpGet.addHeader("Accept", "application/json");
        httpGet.addHeader("Content-type", "application/json; charset=utf-8");
        CloseableHttpResponse response = httpClient.execute(httpGet);
        //Process the response
    }

//Query transaction details by transaction_id 
func queryOrderById() {
	result, err := client.Get(ctx, "https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/4015463511252015071056489715?sub_mchid=10000097")
	if err != nil {
		// Process error
	}
	log.Printf("%s", result.Response.Body)
}


//Query transaction details by out_trade_no
func queryOrderByNo() {
	result, err := client.Get(ctx, "https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/out_trade_no/1217752501201407033233368018?sub_mchid=10000097")
	if err != nil {
		// Process error
	}
	log.Printf("%s", result.Response.Body)
}

// Query transaction details by transaction_id 
public function queryOrderById($instance)
{
    try {
        $resp = $instance
            ->v3->global->papay->transactions->_transaction_id_
            ->get([
                    'query' => [
                		'sub_mchid'    => '10000097',
                    ],
                    'transaction_id' => '4015463511252015071056489715'
                ]
            );
        echo $resp->getStatusCode(), PHP_EOL;
        echo $resp->getBody(), PHP_EOL;
    } catch (Exception $e) {
        // Exception handling
	}
}

// Query transaction details by out_trade_no
public function queryOrderByNo($instance)
{
    try {
        $resp = $instance
            ->v3->global->papay->transactions->outTradeNo->_out_trade_no_
            ->get([
                    'query' => [
                		'sub_mchid'    => '10000097',
                    ],
                    'out_trade_no' => '1217752501201407033233368018'
                ]
            );

        echo $resp->getStatusCode(), PHP_EOL;
        echo $resp->getBody(), PHP_EOL;
    } catch (Exception $e) {
        // Exception handling
	}
}

									{
										"stock_id": "Python",
										"stock_creator_mchid": "123456",
										"limit": 10,
									}

Critical parameters:

out_trade_no: order deduction ID at the merchant side

transaction_id:WeChat order ID

3.2.8 [Server] Close Order

Procedure: If payment for the merchant’s order fails and a new order ID needs to be generated to initiate payment again, the order closing interface needs to be called for the original order ID to avoid repeated payment; after an order is placed in the system, the user's payment times out and the system will exit without accepting the order, the order closing interface needs to be called to prevent the user from continuing operation.


//Applying for close order
public void closeOrderTest() throws IOException {
		String closeOrderBody = """
{
  "sub_mchid": "20000100"
}
""";
        HttpPost httpPost = new HttpPost("https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/out-trade-no/1217752501201407033233368018/reverse");
        httpPost.addHeader("Accept", "application/json");
        httpPost.addHeader("Content-type", "application/json; charset=utf-8");
        httpPost.setEntity(new StringEntity(closeOrderBody ));
        CloseableHttpResponse response = httpClient.execute(httpPost);
        //Process the response
}

//Deduction API
func closeOrder() {
	body := `
{
  "sub_mchid": "20000100"
}
`
	result, err := client.Post(ctx, "https://apihk.mch.weixin.qq.com/v3/global/papay/transactions/out-trade-no/1217752501201407033233368018/reverse", body)
	if err != nil {
		// Process error
	}
	log.Printf("%s", result.Response.Body)
}

  // Call close order API
  public function closeOrder($instance)
  {
    try {
      $resp = $instance
		->v3->global->papay->transactions->outTradeNo->_out_trade_no_->reverse
        ->post([
          'json' => [
            'sub_mchid'    => '20000100'
          ],
          'out_trade_no' => '1217752501201407033233368018'
        ]);
      echo $resp->getStatusCode(), PHP_EOL;
      echo $resp->getBody(), PHP_EOL;
    } catch (Exception $e) {
      // Exception handling
    }
  }

									{
										"stock_id": "Python",
										"stock_creator_mchid": "123456",
										"limit": 10,
									}

Critical parameters:

out_trade_no: order deduction ID at the merchant side

3.2.9 [Server] Termination

Procedure: If the user intends to terminate the contract at the merchant side, the merchant needs to call the Termination API to terminate the contact.


//Applying for Termination API    
public void deductionTest() throws IOException {
		String terminateBody = """
{
"sp_appid": "wxcbda96de0b165486",
"sub_mchid": "10000097",
"sub_appid": "wxcbda96de0b165484", 
"termination_note": "Cause of termination" 
}
""";
        HttpPost httpPost = new HttpPost("https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/100005698/terminate");
        httpPost.addHeader("Accept", "application/json");
        httpPost.addHeader("Content-type", "application/json; charset=utf-8");
        httpPost.setEntity(new StringEntity(terminateBody));
        CloseableHttpResponse response = httpClient.execute(httpPost);
        //Process the response
    }

//Applying for Termination API
func terminate() {
	body := `
{
"sp_appid": "wxcbda96de0b165486",
"sub_mchid": "10000097",
"sub_appid": "wxcbda96de0b165484", 
"termination_note": "Cause of termination" 
}
`
	result, err := client.Post(ctx, "https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/100005698/terminate", body)
	if err != nil {
		// Process error
	}
	log.Printf("%s", result.Response.Body)
}

  //Applying for Termination API
  public function termination($instance)
  {
    try {
      $resp = $instance
        ->v3->global->papay->contracts->_contract_id_->terminate
        ->post([
          'json' => [
            'sp_appid' => 'wxcbda96de0b165486',
			'sub_mchid' => '10000097',
			'sub_appid' => 'wxcbda96de0b165484',
			'termination_note' => 'Cause of termination'
          ],
          '_contract_id_' => '100005698'
        ]);
      echo $resp->getStatusCode(), PHP_EOL;
      echo $resp->getBody(), PHP_EOL;
    } catch (\Exception $e) {
      // Exception handling
    }
  }

									{
										"stock_id": "Python",
										"stock_creator_mchid": "123456",
										"limit": 10,
									}

Critical parameters:

contract_id: Deduction agreement ID at the WeChat side

    Page navigation

About  WeChat  Pay

Powered By Tencent & Tenpay Copyright©

2005-2024 Tenpay All Rights Reserved.

Contact Us
Wechat Pay Global

WeChat Pay Global

置頂