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

> Create an RTP Now or Later Payment.



## OpenAPI

````yaml post /v1/aggregators/{raast-aggregator-id}/payments
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}/payments:
    parameters:
      - $ref: '#/components/parameters/AggregatorIdParam'
    post:
      tags:
        - Payments
      summary: Create RTP
      description: Create an RTP Now or Later Payment.
      requestBody:
        $ref: '#/components/requestBodies/CreatePayment'
      responses:
        '200':
          $ref: '#/components/responses/CreatePaymentResponse'
        '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
  requestBodies:
    CreatePayment:
      description: Request to create an RTP Now or RTP Later
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/CreateRtpWithRaastId'
              - $ref: '#/components/schemas/CreateRtpWithIban'
              - $ref: '#/components/schemas/CreateRtpWithVaultToken'
          examples:
            Create RTP Now with Raast Alias:
              value:
                request_id: c69aa27b-7b42-448b-af73-963bef1c5e42
                amount: 94000
                debitor_raast_id: '03202296111'
                aggregator_merchant_identifier: am_d7fd05ea-8613-4038-afd7-4275f29110f5
                order_id: order_raast_id
                type: RTP_NOW
                expiry_in_minutes: 100
            Create RTP Now with IBAN:
              value:
                request_id: 7a1b5307-4fe2-41a7-8bde-55c17de88f3d
                amount: 32000
                debitor_iban: PK89SCBL0000001234651601
                aggregator_merchant_identifier: am_749fe6ce-91f9-4f6a-9df2-ec6ae9f75a30
                order_id: order_now_iban
                type: RTP_NOW
                expiry_in_minutes: 45
            Create RTP Later with Vault Token:
              value:
                request_id: 3f7392b4-78c4-47a5-9fbc-9c74fc021970
                amount: 22000
                debitor_vault_token: lock_441d2a6f-5aea-4e0e-a7c8-48cae1273e66
                aggregator_merchant_identifier: am_749fe6ce-91f9-4f6a-9df2-ec6ae9f75a30
                order_id: order_paylater_token
                type: RTP_LATER
                expiry_in_days: 7
  responses:
    CreatePaymentResponse:
      description: Response envelope returned after a payment request is accepted.
      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/PaymentCreationResult'
          examples:
            PaymentCreated:
              value:
                api_version: v1
                data:
                  message: RTP created successfully
                  token: pm_f531c5eb-5c49-40d6-8ac5-012cfd1b24c1
                  msg_id: IG2Y50ORB7BE2OLEW0HDVJUIP9QGTL1V6WS
                  trace_reference: aa22cc9b-3f55-4613-86cf-9641f11902d1
                  uetr: 8df9cc1f-77b2-47e4-9a8b-a3050bee6972
                  status: P_REJECTED
                  order_id: NewPayNow1
                  created_at: '2025-06-26T10:58:17Z'
    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:
    CreateRtpWithRaastId:
      allOf:
        - $ref: '#/components/schemas/CreateRtpBase'
        - type: object
          properties:
            debitor_raast_id:
              type: string
              description: Raast alias for the debitor (for example, a mobile number).
          required:
            - debitor_raast_id
    CreateRtpWithIban:
      allOf:
        - $ref: '#/components/schemas/CreateRtpBase'
        - type: object
          properties:
            debitor_iban:
              type: string
              description: Debitor IBAN for direct account routing.
          required:
            - debitor_iban
    CreateRtpWithVaultToken:
      allOf:
        - $ref: '#/components/schemas/CreateRtpBase'
        - type: object
          properties:
            debitor_vault_token:
              type: string
              description: >-
                Token referencing a stored debitor payment instrument in the
                vault.
          required:
            - debitor_vault_token
    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
    PaymentCreationResult:
      type: object
      description: Data returned when an RTP request is created successfully.
      properties:
        message:
          type: string
          description: Human-readable confirmation message from the API.
        token:
          type: string
          description: Public token representing the newly created payment.
        msg_id:
          type: string
          description: Raast network message identifier assigned to the request.
        trace_reference:
          type: string
          description: Trace reference generated for reconciliation.
        uetr:
          type: string
          description: Unique End-to-end Transaction Reference associated with the payment.
        status:
          type: string
          description: Initial status assigned to the payment after creation.
          enum:
            - P_INITIATED
            - P_RECEIVED
            - P_CANCELLED
            - P_REJECTED
            - P_FAILED
            - P_AUTHORIZED
            - P_REVERSED
            - P_CAPTURED
            - P_SETTLED
            - P_PARTIALLY_REFUNDED
            - P_REFUNDED
        order_id:
          type: string
          description: Merchant order identifier echoed back in the response.
        created_at:
          type: string
          format: date-time
          description: Timestamp when the payment was created in the Safepay platform.
    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
    CreateRtpBase:
      type: object
      description: Base RTP creation payload shared across all debitor identifier options.
      properties:
        request_id:
          type: string
          description: Client-supplied idempotency identifier for the RTP request.
        amount:
          type: integer
          description: Payment amount in the smallest currency unit (PKR).
        aggregator_merchant_identifier:
          type: string
          description: Identifier for the merchant on whose behalf the RTP is initiated.
        order_id:
          type: string
          description: Merchant order identifier associated with the RTP.
        type:
          type: string
          description: >-
            Indicates whether the RTP should be processed immediately or
            scheduled.
          enum:
            - RTP_NOW
            - RTP_LATER
        expiry_in_minutes:
          type: integer
          description: >-
            Minutes until the RTP NOW request expires; must be between 1 and
            180.
          minimum: 1
          maximum: 180
        expiry_in_days:
          type: integer
          description: Days until the RTP LATER request expires; must be between 1 and 40.
          minimum: 1
          maximum: 40
      required:
        - request_id
        - amount
        - aggregator_merchant_identifier
        - order_id
        - type
    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
  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

````