Skip to content

服务商场景中预授权

服务商场景中预授权

请求参数类型描述
jsonobject声明请求的JSON数据结构
service_idstring服务ID
appidstring服务商的公众号ID
sub_appidstring子商户的公众号ID
sub_mchidstring子商户的商户号
authorization_codestring授权协议号
notify_urlstring通知地址
scenestring授权场景
transaction_scene_infoobject微信支付交易中授权附带的参数
mchidstring支付下单的商户号
sub_mchidstring支付下单的子商户号
php
$instance->v3->payscore->partner->permissions->applyForScene->postAsync([
  'json' => [
    'service_id'             => '500001',
    'appid'                  => 'wxd678efh567hg6787',
    'sub_appid'              => 'wxd678efh567hg6787',
    'sub_mchid'              => '1230000109',
    'authorization_code'     => '实例1234323JKHDFE1243252',
    'notify_url'             => 'http://www.qq.com',
    'scene'                  => 'TRANSACTION',
    'transaction_scene_info' => [
      'mchid'     => '1230000109',
      'sub_mchid' => '1230000109',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/payscore/partner/permissions/apply-for-scene')->postAsync([
  'json' => [
    'service_id'             => '500001',
    'appid'                  => 'wxd678efh567hg6787',
    'sub_appid'              => 'wxd678efh567hg6787',
    'sub_mchid'              => '1230000109',
    'authorization_code'     => '实例1234323JKHDFE1243252',
    'notify_url'             => 'http://www.qq.com',
    'scene'                  => 'TRANSACTION',
    'transaction_scene_info' => [
      'mchid'     => '1230000109',
      'sub_mchid' => '1230000109',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/payscore/partner/permissions/apply-for-scene']->postAsync([
  'json' => [
    'service_id'             => '500001',
    'appid'                  => 'wxd678efh567hg6787',
    'sub_appid'              => 'wxd678efh567hg6787',
    'sub_mchid'              => '1230000109',
    'authorization_code'     => '实例1234323JKHDFE1243252',
    'notify_url'             => 'http://www.qq.com',
    'scene'                  => 'TRANSACTION',
    'transaction_scene_info' => [
      'mchid'     => '1230000109',
      'sub_mchid' => '1230000109',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->payscore->partner->permissions->applyForScene->post([
  'json' => [
    'service_id'             => '500001',
    'appid'                  => 'wxd678efh567hg6787',
    'sub_appid'              => 'wxd678efh567hg6787',
    'sub_mchid'              => '1230000109',
    'authorization_code'     => '实例1234323JKHDFE1243252',
    'notify_url'             => 'http://www.qq.com',
    'scene'                  => 'TRANSACTION',
    'transaction_scene_info' => [
      'mchid'     => '1230000109',
      'sub_mchid' => '1230000109',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/payscore/partner/permissions/apply-for-scene')->post([
  'json' => [
    'service_id'             => '500001',
    'appid'                  => 'wxd678efh567hg6787',
    'sub_appid'              => 'wxd678efh567hg6787',
    'sub_mchid'              => '1230000109',
    'authorization_code'     => '实例1234323JKHDFE1243252',
    'notify_url'             => 'http://www.qq.com',
    'scene'                  => 'TRANSACTION',
    'transaction_scene_info' => [
      'mchid'     => '1230000109',
      'sub_mchid' => '1230000109',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/payscore/partner/permissions/apply-for-scene']->post([
  'json' => [
    'service_id'             => '500001',
    'appid'                  => 'wxd678efh567hg6787',
    'sub_appid'              => 'wxd678efh567hg6787',
    'sub_mchid'              => '1230000109',
    'authorization_code'     => '实例1234323JKHDFE1243252',
    'notify_url'             => 'http://www.qq.com',
    'scene'                  => 'TRANSACTION',
    'transaction_scene_info' => [
      'mchid'     => '1230000109',
      'sub_mchid' => '1230000109',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
scenestring授权场景, 与输入中一致
transaction_permissions_tokenstring微信支付交易中授权token

参阅 官方文档

Published on the GitHub by TheNorthMemory