> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payallglobal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 商户注册



## OpenAPI

````yaml post /v1/merchant/open/api/registration
openapi: 3.1.0
info:
  version: '1.0'
  title: PayAllGlobal开放平台接口文档
  summary: ''
  termsOfService: ''
  contact:
    name: 技术支持
    email: support@payallglobal.com
    url: ''
  license:
    url: https://www.apache.org/licenses/LICENSE-2.0.html
    name: Apache 2.0
servers:
  - url: https://mpgwpre.payallglobal.com/mp-gateway/
    description: 开发环境
  - url: https://mpgw.payallglobal.com/mp-gateway/
    description: 正式生产环境
security:
  - signature: []
tags:
  - name: 收单
  - name: 其他交易类型
  - name: 商户管理
  - name: 文件下载
  - name: 付款
paths:
  /v1/merchant/open/api/registration:
    post:
      tags:
        - 商户管理
      summary: 商户注册
      operationId: post-v1-merchant-open-api-registration
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegistrationRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegistrationResponse'
      security:
        - signature: []
      servers:
        - url: https://mpgwpre.payallglobal.com/mp-gateway/
          description: 开发环境
        - url: https://mpgw.payallglobal.com/mp-gateway/
          description: 正式生产环境
components:
  schemas:
    RegistrationRequest:
      allOf:
        - $ref: '#/components/schemas/BaseRequest'
        - type: object
          properties:
            address:
              type: string
            agreementFile:
              type: string
            business:
              type: object
              properties:
                appDownload:
                  type: string
                businessType:
                  type: string
                mcc:
                  type: string
                miniProgram:
                  type: string
                officeAccount:
                  type: string
                storeAddress:
                  type: string
                storePhotos:
                  type: string
                website:
                  type: string
            businessAddress:
              type: string
            businessPic:
              type: string
            certNo:
              type: string
            contact:
              type: object
              properties:
                email:
                  type: integer
                name:
                  type: string
                phone:
                  type: integer
            countryCode:
              type: integer
            director:
              type: object
              properties:
                name:
                  type: string
                number:
                  type: integer
                type:
                  type: string
            merchantType:
              type: string
            phoneNo:
              type: string
            principal:
              type: object
              properties:
                name:
                  type: string
                number:
                  type: integer
                type:
                  type: string
            registrationDate:
              type: string
            registrationPic:
              type: string
            shareholder:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                  number:
                    type: integer
                  type:
                    type: string
            signType:
              type: string
            subMcc:
              type: string
            subMerchantId:
              type: integer
            subMerchantName:
              type: string
            subMerchantShort:
              type: string
            transType:
              type: string
            version:
              type: string
      x-examples:
        Example 1:
          address: ''
          agreementFile: ''
          business:
            appDownload: http://xx
            businessType: ONLINE
            mcc: '0742'
            miniProgram: wx8888888888888888
            officeAccount: wx8888888888888888
            storeAddress: >-
              10F World Finance Centre (South Office), 11 Canton Road, Tsim Sha
              Tsui, Hong Kong
            storePhotos: 1,2
            website: http://xx
          businessAddress: ''
          businessPic: ''
          certNo: ''
          charset: utf-8
          contact:
            email: 43121212121212
            name: 名称
            phone: 15012341234
          countryCode: 156
          director:
            name: 名称
            number: 43121212121212
            type: '01'
          memberId: 131103337349973170
          merchantId: 202200000001
          merchantType: PERSONAL
          phoneNo: ''
          principal:
            name: 名称
            number: 43121212121212
            type: '01'
          registrationDate: '2022-12-19'
          registrationPic: ''
          shareholder:
            - name: 名称
              number: 43121212121212
              type: '01'
          signType: RSA
          subMcc: '0742'
          subMerchantId: 12345789
          subMerchantName: 子商户名称
          subMerchantShort: 子商户简称
          transType: PAY
          version: 2.0.0
    RegistrationResponse:
      title: RegistrationResponse
      allOf:
        - $ref: '#/components/schemas/BaseResponse'
        - type: object
          properties:
            data:
              type: object
              properties:
                subMerchantId:
                  type: string
              required:
                - subMerchantId
    BaseRequest:
      type: object
      properties:
        charset:
          type: string
          description: 交互数据的编码【utf-8】
          default: UTF-8
          examples:
            - UTF-8
        version:
          type: string
          description: "接口版本，当前版本为【2.0.0】,目前只能传2.0.0，不能不传\t"
          examples:
            - 2.0.0
        transType:
          type: string
          enum:
            - 'PAY: 消费支付'
            - 'CREDIT_CARD: 信用卡支付'
            - '3D_PREAUTH_VOIDS: 3D 预授权撤销'
            - '3D_PREAUTH_COMPLETION: 3D 预授权完成'
            - 'REFUND: 退款'
            - 'VOIDS: 撤销'
            - 'QUERY: 查询'
            - 'TRANSFER: 转账'
            - 'DOWNLOAD: 文件下载'
            - 'REGISTRATION: 商户注册'
            - 'FILEUPLOAD: 文件上传'
            - 'INQUIRYREGISTRATIONSTATUS: 查询注册状态'
            - 'AUTHORIZE: 授权'
            - 'CASHIER_PAY: 收银台支付'
          description: 交易类型
          default: PAY
        accessType:
          type: string
          description: 接口接入类型，固定为服务端到服务端(s2s)模式
          default: s2s
          examples:
            - s2s
        signType:
          type: string
          default: RSA
          description: 报文签名类型，当前支持RSA。
          examples:
            - RSA
        memberId:
          type: string
          description: 机构号，商户侧唯一标识
          examples:
            - '2023010558663764'
        merchantId:
          type: string
          description: 商户号，商户唯一标识
          examples:
            - '2023010558663764'
      required:
        - charset
        - version
        - transType
        - accessType
        - signType
        - memberId
        - merchantId
      x-examples:
        Example 1:
          charset: UTF-8
          version: 2.0.0
          transType: string
          accessType: PAY
          signType: RSA
          memberId: stringstri
          merchantId: stringstri
    BaseResponse:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: "是否成功，true表示成功，false表示失败\t"
          examples:
            - true
        errCode:
          type: string
          description: "响应状态码，errCode为00000000表示响应成功，其他状态码表示响应失败。具体系统错误码可以参考系统错误码。\t"
          examples:
            - '00000003'
        errMessage:
          type: string
          description: "错误消息\t"
          examples:
            - 处理中
        status:
          type: string
          description: "订单状态(见补充说明)\t"
          examples:
            - PENDING：处理中
            - SUCCESS：成功
            - FAIL：失败
        traceId:
          type: string
          description: "请求消息唯一标识。traceId为本次调用产生的流水号，接口调用异常，可以提供此流水号用于排查问题。\t"
          examples:
            - 33fae7b7aed1233f
      required:
        - isSuccess
        - errCode
        - errMessage
        - status
        - traceId
      x-examples:
        Example 1:
          isSuccess: true
          errCode: '00000003'
          errMessage: 处理中
          status: PENDING
          traceId: 33fae7b7aed1233f
  securitySchemes:
    signature:
      type: apiKey
      description: >-
        Example: MIIEpQIBAAKCAQEA...（Base64编码的签名字符串）

        ## 加签

        加签是开放平台和商户对于交互消息完整性的校验。加签行为主要发生两个部分：

        1. 商户服务器端针对向PayAllGlobal开放平台发送的请求报文进行加签；

        2. PayAllGlobal开放平台针对通知商户的异步消息进行加签。

        PayAllGlobal平台要求使用 RSA 私钥进行加签， 使用 RSA 公钥进行验签。 因此，在以上两部分描述的交互中，
        存在商户公私钥、PayAllGlobal 公私钥，开发者需要使用商户私钥，对第一部分报文进行加签，使用 PayAllGlobal
        公钥对第二部分消息进行验签。

        ### 加签规则如下: 

        使用商户私钥对请求体进行 SHA256withRSA 签名后，再进行 Base64 编码的结果。

        1. 使用 商户私钥对待 `request.body` 进行签名（SHA256WithRSA 计算原始数据的SHA-256哈希值。
        使用私钥对哈希值进行签名，即使用私钥对哈希值进行RSA加密。此时得到的加密结果就是数字签名。）；

        ```java

        Signature signature = Signature.getInstance("SHA256withRSA");

        signature.initSign(privateKey);

        // 计算 SHA256withRSA 签名时，需要以 utf-8 的编码转换 byte 流，否则可能导致含中文参数的签名计算不正确

        signature.update(request.body);

        byte[] signedHash = signature.sign();

        ```

        2. 将加签内容进行 Base64 编码；

        ```java

        String signature = Base64.getEncoder().encodeToString(signedHash);


        ```

        3. 将编码后的内容放在请求头部 signature 参数中。

        注意，加签是对 request.body 进行签名，当查询等 request.body 为空时，则无需加签。
      name: signature
      in: header

````