> ## 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.

# Update Merchant



## OpenAPI

````yaml put /v1/aggregators/{raast-aggregator-id}/merchants/{aggregator-merchant-id}
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/{aggregator-merchant-id}:
    put:
      tags:
        - Merchants
      summary: Update Merchant
      parameters:
        - $ref: '#/components/parameters/AggregatorIdParam'
        - $ref: '#/components/parameters/MerchantIdParam'
      requestBody:
        $ref: '#/components/requestBodies/UpdateMerchant'
      responses:
        '200':
          $ref: '#/components/responses/UpdateMerchantsResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalError'
      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
    MerchantIdParam:
      name: aggregator-merchant-id
      in: path
      required: true
      schema:
        type: string
        example: am_be454a50-7612-4dc6-a97e-284ebbe7ae93
      description: The unique identifier for the merchant
  requestBodies:
    UpdateMerchant:
      description: Request to update an existing aggregator merchant
      content:
        application/json:
          schema:
            type: object
            description: Fields that can be modified for an existing aggregator merchant
            properties:
              name:
                type: string
                description: Merchant display name
              enabled:
                type: boolean
                description: >-
                  Indicates whether the merchant should be active for Raast
                  payments
              iban:
                type: string
                description: Settlement IBAN used for Raast payouts
              rate_card:
                type: object
                description: >-
                  Rate configuration Safepay applies to the merchant's Raast
                  transactions
                properties:
                  ratecard_kind:
                    $ref: '#/components/schemas/RateCardKind'
                  fixed_rate:
                    type: integer
                    description: Fixed per-transaction fee in paisa
                  variable_rate:
                    type: number
                    description: Fractional fee applied to the transaction amount
                  tax_region:
                    type: string
                    description: Region where 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)
          examples:
            Update Merchant:
              value:
                name: NSH merchant
                enabled: true
                iban: PK85HABB0002157901170103
                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:
    UpdateMerchantsResponse:
      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:
            Update Merchant:
              value:
                api_version: v1
                data:
                  id: '4'
                  token: am_749fe6ce-91f9-4f6a-9df2-ec6ae9f75a30
                  name: Lazer Sports
                  aggregator_id: agg_2288490a-2176-4de5-b373-0ffb6f8e2e6e
                  merchant_id: mer_dd0aa205-5b38-4691-bf1e-d30524c5be97
                  merchant_external_id: sec_0e84768c-048e-4946-9066-ea199fec7722
                  bank_account_id: acc_c03a57cb-a616-42a7-b1dc-de473217a558
                  enabled: true
                  created_at: '2025-03-13T09:13:25Z'
                  updated_at: '2025-06-03T11:44:56Z'
                  raast_merchant:
                    id: '4'
                    token: mer_dd0aa205-5b38-4691-bf1e-d30524c5be97
                    partner_id: partner_ed4f0480-36c8-4a5a-8cd4-381bc4d83f2c
                    raast_record_id: '478619'
                    status: Inactive
                    uid_type: NTN
                    uid_value: '4220111082020'
                    name: Lazer Sports
                    document_type: NTN
                    document_number: '4220111082026'
                    address_details:
                      country: PK
                      city: Karachi
                      state_province_region: Sindh
                      address_line: Federal.B. Area
                    contact_details:
                      mobile_number: '+923001234926'
                      email: testingbyHas@gesafepay.com
                    additional_details:
                      dba: The best business 001
                      mcc: '5633'
                      lat: ''
                      long: ''
                    additional_details_private: {}
                    created_at: '2025-03-13T09:13:23Z'
                    updated_at: '2025-06-03T11:44:56Z'
                  rate_card:
                    id: '23'
                    token: mrc_50f44cfa-7fc4-4111-82db-84233aeb7d04
                    aggregator_merchant_id: am_749fe6ce-91f9-4f6a-9df2-ec6ae9f75a30
                    connector_id: conn_c05caf8c-1f8d-4e58-bcfd-833531500693
                    rate_card_id: rc_4a61062c-c3a7-4dee-8199-f122eb9d90d3
                    ratecard_kind: RateCardKind_fixed
                    created_at: '2025-03-13T09:13:23Z'
                    updated_at: '2025-06-03T11:44:57Z'
                    fixed_rate: '40000'
                    tax_rate: 0
                    tax_region: ''
    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
    NotFound:
      description: Resource not found
      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.not_found
                  message:
                    example: Requested resource not found
    Conflict:
      description: Resource conflict
      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.conflict
                  message:
                    example: Resource already exists
    InternalError:
      description: Internal server error response
      headers:
        Content-Length:
          $ref: '#/components/headers/ContentLengthHeader'
        Date:
          $ref: '#/components/headers/DateHeader'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
          examples:
            InternalServerError:
              value:
                api_version: v1
                error:
                  code: error.internal_server_error
                  message: rpc error code Internal desc = something went wrong
  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
    ApiErrorEnvelope:
      type: object
      description: Error wrapper that includes the API version and error metadata
      properties:
        api_version:
          type: string
          description: Indicates the API version associated with the response
          example: v1
        error:
          description: Structured error details describing why the request failed
          allOf:
            - $ref: '#/components/schemas/ErrorResponse'
          example:
            code: error.unauthorized_access
            message: partner access key is required in request header
    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

````