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

# Get or create the stable referral code for a merchant



## OpenAPI

````yaml /openapi.json get /merchants/{merchantId}/referral-code
openapi: 3.0.0
info:
  title: PayGood Merchant API
  description: Server-to-server integration surface for merchant API keys.
  version: '1.0'
  contact: {}
servers:
  - url: https://api-sandbox.paygood.co
    description: Sandbox
  - url: https://api.paygood.co
    description: Production
security: []
paths:
  /merchants/{merchantId}/referral-code:
    get:
      tags:
        - merchant-referrals
      summary: Get or create the stable referral code for a merchant
      operationId: MerchantReferralCodeController_getCode
      parameters:
        - name: merchantId
          required: true
          in: path
          description: Referring merchant TypeID (`mer_...`).
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantReferralCodeResponseDto'
      security:
        - bearer: []
components:
  schemas:
    MerchantReferralCodeResponseDto:
      type: object
      properties:
        code:
          type: string
        shareUrl:
          type: string
          format: uri
      required:
        - code
        - shareUrl
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: merchant_<prefix>_<secret>
      type: http
      description: >-
        Merchant API key bearer token. Legacy wire prefixes `api_key_` and
        `api_` are also accepted.

````