Skip to content

商户签名验签/加解密测试

为商户提供签名、验签、加密、解密的测试能力。商户可以选择用平台证书签名,加密,也可以选择微信支付公钥签名,加密。

请求参数类型描述
jsonobject声明请求的JSON数据结构
notify_urlstring商户回调地址
echo_messagestring回显信息
encrypted_echo_messagestring平台证书或微信支付公钥加密测试字段
headersobject声明请求的头参数
Wechatpay-Serialstring微信支付公钥ID/平台证书序列号
php
$instance->v3->security->echo->postAsync([
  'json' => [
    'notify_url'             => 'https://www.weixin.qq.com/v3/test',
    'echo_message'           => 'hello',
    'encrypted_echo_message' => 'Fx9mh7K5sjqHxxQcgDVhnJ9QdS4nKfcUbuAOj',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/security/echo')->postAsync([
  'json' => [
    'notify_url'             => 'https://www.weixin.qq.com/v3/test',
    'echo_message'           => 'hello',
    'encrypted_echo_message' => 'Fx9mh7K5sjqHxxQcgDVhnJ9QdS4nKfcUbuAOj',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/security/echo']->postAsync([
  'json' => [
    'notify_url'             => 'https://www.weixin.qq.com/v3/test',
    'echo_message'           => 'hello',
    'encrypted_echo_message' => 'Fx9mh7K5sjqHxxQcgDVhnJ9QdS4nKfcUbuAOj',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->security->echo->post([
  'json' => [
    'notify_url'             => 'https://www.weixin.qq.com/v3/test',
    'echo_message'           => 'hello',
    'encrypted_echo_message' => 'Fx9mh7K5sjqHxxQcgDVhnJ9QdS4nKfcUbuAOj',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/security/echo')->post([
  'json' => [
    'notify_url'             => 'https://www.weixin.qq.com/v3/test',
    'echo_message'           => 'hello',
    'encrypted_echo_message' => 'Fx9mh7K5sjqHxxQcgDVhnJ9QdS4nKfcUbuAOj',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/security/echo']->post([
  'json' => [
    'notify_url'             => 'https://www.weixin.qq.com/v3/test',
    'echo_message'           => 'hello',
    'encrypted_echo_message' => 'Fx9mh7K5sjqHxxQcgDVhnJ9QdS4nKfcUbuAOj',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
echo_messagestring回显信息
encrypted_echo_messagestring平台证书或微信支付公钥加密测试字段

参阅 官方文档 官方文档

Published on the GitHub by TheNorthMemory