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

# Retrieve payment details

> Retrieve payment details by the `payment_id` returned from a subscription invoice. This `payment_id` identifies the payment generated for a subscription charge and can be used to confirm payment status, amount, and on-chain payment information.



## OpenAPI

````yaml /en/api/subscription-openapi.json get /api/v1/payment/{payment_id}
openapi: 3.1.0
info:
  title: StablePay Subscription API
  version: '2026-04-20'
  summary: >-
    StablePay subscription endpoints: subscriptions, payment sessions, payment
    methods, refunds, and webhook events.
  description: >-
    OpenAPI specification for the StablePay subscription service.


    ## Basics

    - Base URL: `https://api.stablepay.co`

    - Prefix: `/api/v1`

    - Protocol: HTTPS

    - Format: JSON (UTF-8)


    ## Authentication

    All endpoints require `Authorization: Bearer {api_key}`. Write operations
    should also include replay-protection headers: `X-StablePay-Timestamp`,
    `X-StablePay-Nonce`, `X-StablePay-Signature`.


    ## Amount precision

    Amount fields are expressed in the smallest unit of the currency (e.g.
    `1999` represents $19.99 for USD; USDT/USDC use 6 decimal places).
servers:
  - url: https://api.stablepay.co
    description: Production
security:
  - bearerAuth: []
    stablepayTimestamp: []
    stablepayNonce: []
    stablepaySignature: []
tags:
  - name: Subscriptions
    description: Create, retrieve, list, and cancel subscriptions.
paths:
  /api/v1/payment/{payment_id}:
    get:
      tags:
        - Subscriptions
      summary: Retrieve payment details
      description: >-
        Retrieve payment details by the `payment_id` returned from a
        subscription invoice. This `payment_id` identifies the payment generated
        for a subscription charge and can be used to confirm payment status,
        amount, and on-chain payment information.
      operationId: getSubscriptionPaymentDetail
      parameters:
        - $ref: '#/components/parameters/PaymentId'
        - $ref: '#/components/parameters/XStablePayTimestamp'
        - $ref: '#/components/parameters/XStablePayNonce'
        - $ref: '#/components/parameters/XStablePaySignature'
      responses:
        '200':
          description: Retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentSession'
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Payment session not found or not accessible.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    PaymentId:
      name: payment_id
      in: path
      required: true
      description: >-
        Payment ID returned by a subscription invoice, used to retrieve
        subscription charge payment details.
      schema:
        type: string
    XStablePayTimestamp:
      name: X-StablePay-Timestamp
      in: header
      required: true
      description: Unix timestamp in seconds. Must be within 5 minutes of server time.
      schema:
        type: string
      example: '1735689600'
    XStablePayNonce:
      name: X-StablePay-Nonce
      in: header
      required: true
      description: Replay-protection nonce, 16-64 characters. Use a fresh UUID per request.
      schema:
        type: string
        minLength: 16
        maxLength: 64
      example: 550e8400-e29b-41d4-a716-446655440000
    XStablePaySignature:
      name: X-StablePay-Signature
      in: header
      required: true
      description: >-
        Lowercase hex HMAC-SHA256 of `{timestamp}.{nonce}.{requestBody}` signed
        with the merchant API Secret. For GET requests, `requestBody` is an
        empty string.
      schema:
        type: string
      example: a1b2c3d4e5f6...
  schemas:
    PaymentSession:
      type: object
      required:
        - id
        - amount_total
        - currency
        - payment_status
        - created
        - expires_at
      properties:
        id:
          type: string
          description: Payment session ID.
        amount_total:
          type: integer
          format: int64
          description: Total amount in minor units.
        currency:
          type: string
          description: Merchant ledger currency, returned in lowercase.
        payment_status:
          $ref: '#/components/schemas/PaymentStatus'
        created:
          type: integer
          format: int64
          description: Creation time, Unix seconds.
        expires_at:
          type: integer
          format: int64
          description: Expiration time, Unix seconds.
        url:
          type: string
          format: uri
          description: Checkout URL.
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/LineItem'
          description: Line items.
        tax_amount:
          type: integer
          format: int64
          description: Tax amount in minor units.
        shipping_amount:
          type: integer
          format: int64
          description: Shipping amount in minor units.
        exchange_rate:
          type: string
          description: Exchange rate when currency conversion applies.
        target_currency:
          type: string
          description: Actual on-chain payment currency, for example `USDT`.
        target_amount_total:
          type: integer
          format: int64
          description: Target amount in target-currency minor units.
        rate_locked_at:
          type: integer
          format: int64
          description: Rate lock time, Unix seconds.
        subscription_id:
          type: string
          description: Related subscription ID, returned for subscription payments.
        invoice_id:
          type: string
          description: Related invoice ID, returned for invoice or subscription payments.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Merchant metadata.
    ErrorResponse:
      type: object
      description: Error response.
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              description: Error type.
            code:
              type: string
              description: Error code.
            message:
              type: string
              description: Error message.
            param:
              type: string
              description: Related parameter.
            doc_url:
              type: string
              description: Error documentation URL.
            decline_code:
              type: string
              description: Decline code.
            request_log_url:
              type: string
              description: Request log URL.
            charge:
              type: string
              description: Related payment ID.
        request_id:
          type: string
          description: Request ID.
        timestamp:
          type: integer
          format: int64
          description: Error timestamp in Unix seconds.
    PaymentStatus:
      type: string
      enum:
        - pending
        - processing
        - paid
        - failed
        - expired
        - canceled
      description: >-
        Payment status. `confirming` is returned as `processing`; `completed` is
        returned as `paid`.
    LineItem:
      type: object
      required:
        - price_data
        - quantity
      additionalProperties: false
      properties:
        price_data:
          $ref: '#/components/schemas/PriceData'
        quantity:
          type: integer
          minimum: 1
          description: Item quantity. Must be greater than 0.
    PriceData:
      type: object
      properties:
        id:
          type: string
          description: >-
            Price ID. This field is usually not returned by the current HTTP
            response.
        currency:
          type: string
          description: Currency.
        product:
          type: string
          description: Product ID or product name.
        unit_amount:
          type: integer
          format: int64
          description: Unit amount in minor units.
        recurring:
          $ref: '#/components/schemas/RecurringConfig'
    RecurringConfig:
      type: object
      properties:
        interval:
          type: string
          enum:
            - day
            - week
            - month
            - year
          description: Billing interval.
        interval_count:
          type: integer
          description: Billing interval count. Currently fixed to 1 by the server.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Bearer API Key, for example `Bearer sk_live_xxx`.
    stablepayTimestamp:
      type: apiKey
      in: header
      name: X-StablePay-Timestamp
      description: Unix timestamp in seconds. Must be within 5 minutes of server time.
    stablepayNonce:
      type: apiKey
      in: header
      name: X-StablePay-Nonce
      description: Replay-protection nonce, 16-64 characters. Use a fresh UUID per request.
    stablepaySignature:
      type: apiKey
      in: header
      name: X-StablePay-Signature
      description: >-
        Lowercase hex HMAC-SHA256 of `{timestamp}.{nonce}.{requestBody}` signed
        with the merchant API Secret. For GET requests, `requestBody` is an
        empty string.

````