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

# Create Merchant



## OpenAPI

````yaml post /v1/aggregators/{raast-aggregator-id}/merchants
openapi: 3.1.0
info:
  title: Raast Wire
  version: 1.0.0
  description: ''
servers:
  - url: https://api.getsafepay.com/raastwire
security: []
tags:
  - name: Aggregators
  - name: Access Keys
  - name: Merchants
  - name: Raast Merchants
  - name: Payments
  - name: Refunds
  - name: QRs
  - name: Utilities
  - name: Aliases
  - name: Ledgers
  - name: Webhooks
paths:
  /v1/aggregators/{raast-aggregator-id}/merchants:
    post:
      tags:
        - Merchants
      summary: Create Merchant
      parameters:
        - $ref: '#/components/parameters/AggregatorIdParam'
      requestBody:
        $ref: '#/components/requestBodies/CreateMerchant'
      responses:
        '200':
          $ref: '#/components/responses/CreateMerchantResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
      security:
        - apiKey: []
components:
  parameters:
    AggregatorIdParam:
      name: raast-aggregator-id
      in: path
      required: true
      schema:
        type: string
        example: agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e
      description: The unique identifier for the aggregator
  requestBodies:
    CreateMerchant:
      description: Request to create a merchant linked to an aggregator
      content:
        application/json:
          schema:
            type: object
            description: >-
              Merchant creation payload specifying identifiers and pricing
              configuration
            properties:
              merchant_external_id:
                type: string
                description: >-
                  Client-supplied identifier that remains stable across Safepay
                  integrations
              iban:
                type: string
                description: Settlement IBAN used for Raast payouts
              name:
                type: string
                description: Merchant display name
              enabled:
                type: boolean
                description: >-
                  Indicates whether the merchant should be active immediately
                  after creation
              raast_merchant_id:
                type: string
                description: >-
                  Identifier of the previously onboarded Raast merchant to
                  associate
              rate_card:
                type: object
                description: Rate configuration Safepay applies to Raast transactions
                properties:
                  ratecard_kind:
                    $ref: '#/components/schemas/RateCardKind'
                  fixed_rate:
                    type: integer
                    description: >-
                      Fixed per-transaction fee in paisa when using a fixed rate
                      card
                  variable_rate:
                    type: number
                    description: Percentage fee applied to the transaction amount
                  tax_region:
                    type: string
                    description: Region for which the tax rate applies
                  tax_rate:
                    type: number
                    description: >-
                      Applicable tax rate expressed as a fraction (e.g., 0.1 for
                      10%)
                  sales_tax_withholding:
                    type: number
                    description: >-
                      Sales tax withholding rate applied to the transaction
                      (fractional value)
                  income_tax_withholding:
                    type: number
                    description: >-
                      Income tax withholding rate applied to the transaction
                      (fractional value)
                required:
                  - ratecard_kind
                  - tax_rate
            required:
              - merchant_external_id
              - iban
              - name
              - raast_merchant_id
              - rate_card
          examples:
            Create Merchant:
              value:
                merchant_external_id: sec_0c3de397-441f-471f-bcd7-b6d948e1c307
                iban: PK62ABPA0010000222380013
                name: TestingMerchant
                enabled: true
                raast_merchant_id: mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2
                rate_card:
                  ratecard_kind: RateCardKind_fixed
                  variable_rate: 0.0215
                  fixed_rate: 2900
                  tax_rate: 0.1
                  tax_region: Punjab
                  sales_tax_withholding: 0.1
                  income_tax_withholding: 0.02
  responses:
    CreateMerchantResponse:
      description: This response contains details of a merchant
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/StandardResponse'
              - type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Merchant'
          examples:
            Create Merchant:
              value:
                api_version: v1
                data:
                  id: '0'
                  token: am_d7fd05ea-8613-4038-afd7-4275f29110f5
                  name: TestingMerchant
                  aggregator_id: agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e
                  merchant_id: mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2
                  merchant_external_id: sec_0c3de397-441f-471f-bcd7-b6d948e1c307
                  bank_account_id: acc_a17a478a-f7cd-448b-9753-5729a6f237ad
                  enabled: true
                  created_at: '2025-05-21T09:36:42.586176361Z'
                  updated_at: '2025-05-21T09:36:42.586185862Z'
                  raast_merchant:
                    id: '0'
                    token: mer_eb2f5757-c0e4-4eb4-ad4b-2f4b671a84e2
                    partner_id: partner_ed4f0480-36c8-4a5a-8cd4-381bc4d83f2c
                    raast_record_id: '480776'
                    status: Inactive
                    uid_type: NTN
                    uid_value: '33225247890431'
                    name: TestHasMerchant
                    document_type: NTN
                    document_number: '33225247890431'
                    address_details:
                      country: PK
                      city: Lahore
                      state_province_region: Punjab
                      address_line: h193c1 saddiq
                    contact_details:
                      mobile_number: '+9233330226445'
                      email: testing1702@gmail.com
                    additional_details:
                      dba: The best business 001
                      mcc: '3434'
                      lat: ''
                      long: ''
                    additional_details_private: {}
                    created_at: '2025-05-21T09:36:40.660619343Z'
                    updated_at: '2025-05-21T09:36:40.660619733Z'
                  rate_card:
                    id: '0'
                    token: mrc_859bf970-6178-48c4-a801-014d027a9fe8
                    aggregator_merchant_id: am_d7fd05ea-8613-4038-afd7-4275f29110f5
                    connector_id: conn_eec2d68c-b72a-4f84-82ff-a7d4b3ebaa21
                    rate_card_id: rc_d0680a67-e8bc-4a39-a7c1-ee9998346f17
                    created_at: '2025-05-21T09:36:42.586189872Z'
                    updated_at: '2025-05-21T09:36:42.586190032Z'
                    tax_rate: 0
    BadRequest:
      description: Bad request
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/ErrorResponse'
              - type: object
                properties:
                  code:
                    example: error.bad_request
                  message:
                    example: Invalid request parameters
  schemas:
    RateCardKind:
      type: string
      description: >-
        Enumerated rate card strategy where numeric Raast values map to
        constants (0: RateCardKind_unspecified, 1: RateCardKind_variable, 2:
        RateCardKind_fixed, 3: RateCardKind_blend).
      enum:
        - RateCardKind_unspecified
        - RateCardKind_variable
        - RateCardKind_fixed
        - RateCardKind_blend
      example: RateCardKind_fixed
    StandardResponse:
      type: object
      description: Standard response structure for successful operations
      properties:
        api_version:
          type: string
          example: v1
          description: The current version of the API spec
        data:
          type: object
          description: Contains the response data
    Merchant:
      type: object
      description: Merchant resource created under an aggregator for Raast transactions
      properties:
        id:
          type: string
          description: Internal Safepay identifier for the merchant
        token:
          type: string
          description: Public token identifying the aggregator merchant
        name:
          type: string
          description: Display name of the merchant
        aggregator_id:
          type: string
          description: Identifier of the aggregator that owns the merchant
        merchant_id:
          type: string
          description: Identifier of the linked Raast merchant account
        merchant_external_id:
          type: string
          description: Original merchant identifier provided by the aggregator
        bank_account_id:
          type: string
          description: Identifier of the settlement bank account
        enabled:
          type: boolean
          description: Indicates whether the merchant is currently active
        bank_account:
          $ref: '#/components/schemas/BankAccount'
        raast_merchant:
          $ref: '#/components/schemas/RaastMerchant'
        rate_card:
          $ref: '#/components/schemas/RateCard'
        created_at:
          $ref: '#/components/schemas/Timestamp'
        updated_at:
          $ref: '#/components/schemas/Timestamp'
    ErrorResponse:
      type: object
      description: Standard error response structure
      properties:
        code:
          type: string
          description: Error code identifying the type of error
        message:
          type: string
          description: Human-readable error message
    BankAccount:
      type: object
      properties:
        id:
          type: string
          description: Internal Safepay identifier for the bank account
        token:
          type: string
        vault_token:
          type: string
        title:
          type: string
        iban:
          type: string
        redacted_iban:
          type: string
        hashed_iban:
          type: string
        servicer:
          type: string
        bank:
          type: string
        depositor_id:
          type: string
        owner:
          type: string
        kind:
          type: integer
        version:
          type: string
        created_at:
          $ref: '#/components/schemas/Timestamp'
        updated_at:
          $ref: '#/components/schemas/Timestamp'
    RaastMerchant:
      type: object
      description: Raast merchant profile synchronized from the state bank registry
      properties:
        id:
          type: string
          description: Internal Safepay identifier for the Raast merchant record
        token:
          type: string
          description: Public Raast merchant token
        partner_id:
          type: string
          description: Identifier of the upstream partner associated with the merchant
        raast_record_id:
          type: string
          description: Identifier issued by the Raast directory
        status:
          type: string
          description: Current activation status reported by Raast
        uid_type:
          type: string
          description: Type of the merchant unique identifier such as NTN or CNIC
        uid_value:
          type: string
          description: Value of the unique identifier registered with Raast
        name:
          type: string
          description: Legal entity name on file with Raast
        document_type:
          type: string
          description: Supporting document type recorded during onboarding
        document_number:
          type: string
          description: Number of the supporting document
        address_details:
          type: object
          description: Merchant registered address per Raast records
          properties:
            country:
              type: string
              description: ISO 3166-1 alpha-2 country code
            city:
              type: string
              description: City of the address
            state_province_region:
              type: string
              description: Province or region of the address
            address_line:
              type: string
              description: Street-level address line
        contact_details:
          type: object
          description: Merchant contact information on file
          properties:
            mobile_number:
              type: string
              description: Merchant contact mobile number in E.164 format
            email:
              type: string
              format: email
              description: Merchant contact email address
        additional_details:
          type: object
          description: Optional public metadata collected during onboarding
          properties:
            dba:
              type: string
              description: Doing-business-as name if different from the legal name
            mcc:
              type: string
              description: Merchant category code associated with the merchant
            lat:
              type: string
              description: Latitude coordinate when available
            long:
              type: string
              description: Longitude coordinate when available
        additional_details_private:
          type: object
          description: Safepay private metadata for the Raast merchant
        created_at:
          $ref: '#/components/schemas/Timestamp'
        updated_at:
          $ref: '#/components/schemas/Timestamp'
    RateCard:
      type: object
      description: Rate configuration associated with a merchant for Raast payments
      properties:
        id:
          type: string
          description: Internal Safepay identifier for the rate card linkage
        token:
          type: string
          description: Public token representing the merchant rate card
        aggregator_merchant_id:
          type: string
          description: Identifier of the aggregator merchant that owns the rate card
        connector_id:
          type: string
          description: Identifier of the connector through which payments are processed
        rate_card_id:
          type: string
          description: Identifier of the underlying rate definition template
        ratecard_kind:
          $ref: '#/components/schemas/RateCardKind'
        fixed_rate:
          type: integer
          description: Fixed transaction fee in paisa when applicable
        tax_rate:
          type: number
          description: Tax rate applied to the fixed fee (fractional value)
        tax_region:
          type: string
          description: Region for which the tax rate applies
        variable_rate:
          type: number
          description: Percentage fee applied to the transaction amount
        sales_tax_withholding:
          type: number
          description: >-
            Sales tax withholding rate applied to the transaction (fractional
            value)
        income_tax_withholding:
          type: number
          description: >-
            Income tax withholding rate applied to the transaction (fractional
            value)
        created_at:
          $ref: '#/components/schemas/Timestamp'
        updated_at:
          $ref: '#/components/schemas/Timestamp'
    Timestamp:
      type: string
      format: date-time
      description: ISO 8601 timestamp in UTC
      example: '2025-03-13T09:12:34.000Z'
  headers:
    ContentLengthHeader:
      schema:
        type: string
        example: '256'
    DateHeader:
      schema:
        type: string
        example: Sat, 12 Aug 2023 08:55:04 GMT
  securitySchemes:
    apiKey:
      type: apiKey
      name: X-SFPY-AGGREGATOR-SECRET-KEY
      in: header

````