获取RSA加密公钥
调用获取RSA公钥API获取RSA公钥,用于加密付款到银行业务接口中的用户敏感信息。
请求参数 | 类型 | 描述 |
---|---|---|
base_uri | string | 声明接入点 固定值 https://fraud.mch.weixin.qq.com/ |
security | true | 声明加载商户API证书 |
xml | object | 声明请求的XML 数据结构 |
mch_id | string | 商户号 |
sign_type | string | 签名类型MD5 | HMAC-SHA256 枚举值之一 |
php
$instance->v2->risk->getpublickey->postAsync([
'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
'security' => true,
'xml' => [
'mch_id' => '1900000109',
'sign_type' => 'MD5',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/risk/getpublickey')->postAsync([
'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
'security' => true,
'xml' => [
'mch_id' => '1900000109',
'sign_type' => 'MD5',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/risk/getpublickey']->postAsync([
'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
'security' => true,
'xml' => [
'mch_id' => '1900000109',
'sign_type' => 'MD5',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->risk->getpublickey->post([
'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
'security' => true,
'xml' => [
'mch_id' => '1900000109',
'sign_type' => 'MD5',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/risk/getpublickey')->post([
'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
'security' => true,
'xml' => [
'mch_id' => '1900000109',
'sign_type' => 'MD5',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/risk/getpublickey']->post([
'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
'security' => true,
'xml' => [
'mch_id' => '1900000109',
'sign_type' => 'MD5',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典 | 类型 | 描述 |
---|---|---|
return_code | string | 返回状态码SUCCESS | FAIL 枚举值之一 |
return_msg | string | 错误码描述 |
error_code | string | 错误码 |
error_code_des | string | 错误代码描述 |
result_code | string | 返回状态码SUCCESS | FAIL 枚举值之一 |
mch_id | string | 商户号 |
pub_key | string | RSA公钥 |
参阅 官方文档