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

# Get Intent

> You can use this API to get the status of the transaction that corresponds to a particular intent. This API also returns the masked card info of the payer (if it's a card transaction) and the transaction lifecycle, which includes multiple attempts, failures, and other checkpoints during a transaction.

export const entityType_0 = "payment intent"

<Warning>
  **Anti-Polling Warning**: Avoid polling this endpoint; use webhooks for real-time {entityType_0} updates. See [Anti-Polling Policy](/developer-resources/rate-limits#quotas).
</Warning>


## OpenAPI

````yaml GET /payments/v2/get-intent/{xIntentId}
openapi: 3.0.1
info:
  title: xPay API Store
  description: ''
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.xpaycheckout.com
security:
  - basicAuth: []
paths:
  /payments/v2/get-intent/{xIntentId}:
    get:
      description: >-
        You can use this API to get the status of the transaction that
        corresponds to a particular intent. This API also returns the masked
        card info of the payer (if it's a card transaction) and the transaction
        lifecycle, which includes multiple attempts, failures, and other
        checkpoints during a transaction.
      parameters:
        - name: xIntentId
          in: path
          required: true
          schema:
            type: string
            example: in_fooBOwYsaK50AEfK
          description: Unique identifier of the intent
        - name: expand
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - charge_attempts
                - succeeded_charge
          description: |-
            List of fields to expand in the response. Available options: 
             - `charge_attempts` : includes all charge attempts 
             - `succeeded_charge` : includes the successful charge details
          example:
            - charge_attempts
            - succeeded_charge
      responses:
        '200':
          description: Successful response with transaction status and related details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get-intent-details-response'
        '400':
          description: Invalid request, xIntentId not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    get-intent-details-response:
      type: object
      properties:
        amount:
          type: integer
          description: The amount in lowest count unit (e.g., cents for USD)
          example: 100
        currency:
          type: string
          description: Three-letter currency code
          example: USD
        presentmentCurrency:
          type: string
          description: The currency that the customer paid in
          example: USD
        receiptId:
          description: Your identifier for the order
          type: string
          example: order123
        customerDetails:
          $ref: '#/components/schemas/BillingDetails'
        customerReferenceId:
          type: string
          description: >-
            Your unique identifier for the customer. This can be used to
            associate the payment with a specific customer in your system.
          example: cus_Tfd3Jq1tZxPjYVhRQW2r3
        description:
          type: string
          description: Description of the order, if any
          example: Order for 2 items
        callbackUrl:
          type: string
          description: Callback URL to notify order status
          example: https://example.com/callback
        cancelUrl:
          type: string
          description: The URL to redirect the customer to when they cancel the payment.
          example: https://example.com/cancel
        createdAt:
          type: string
          format: date-time
          description: Timestamp of when the intent was created
          example: '2024-09-26T10:41:50.472+00:00'
        status:
          type: string
          description: >-
            Current status of the intent. Refer [payment
            statuses](/products/one-time-payments/payment-statuses)
          example: CREATED
        xIntentId:
          description: Unique identifier of the intent
          type: string
          example: in_fooBOwYsaK50AEfK
        succeededAt:
          $ref: '#/components/schemas/SucceededAt'
        metadata:
          type: object
          description: >-
            A collection of key-value pairs that were provided when the object
            was created. These metadata values are echoed back in the response,
            allowing you to store and retrieve custom information such as
            context-specific attributes, references, or tags. This can be useful
            for correlating records in your system or attaching meaningful
            context to transactions.
          additionalProperties:
            type: string
          example:
            orderId: '12345'
            customerNote: Deliver after 5 PM
        chargeAttempts:
          type: array
          items:
            $ref: '#/components/schemas/ChargeDTO'
          description: >-
            List of all charge attempts for this intent. Only included when
            `charge_attempts` is specified in the expand parameter.
          example:
            - status: FAILED
              paymentMetadata:
                paymentMethod: CARD
                cardMetadata:
                  brand: visa
                  country: US
                  lastFourDigit: '4242'
                  expiryMonth: 12
                  expiryYear: 2025
                  cardType: CREDIT
              chargeTime: 1727340330123
              errorCode: card_declined
            - status: SUCCESS
              paymentMetadata:
                paymentMethod: CARD
                cardMetadata:
                  brand: visa
                  country: US
                  lastFourDigit: '4242'
                  expiryMonth: 12
                  expiryYear: 2025
                  cardType: CREDIT
              chargeTime: 1727340331123
              errorCode: null
        succeededCharge:
          $ref: '#/components/schemas/ChargeDTO'
          description: >-
            Details of the successful charge attempt. Only included when
            `succeeded_charge` is specified in the expand parameter and the
            payment was successful.
          example:
            status: SUCCESS
            paymentMetadata:
              paymentMethod: CARD
              cardMetadata:
                brand: visa
                country: US
                lastFourDigit: '4242'
                expiryMonth: 12
                expiryYear: 2025
                cardType: CREDIT
            chargeTime: 1727340331123
            errorCode: null
        paymentMethod:
          type: string
          enum:
            - CARD
            - GOOGLE_PAY
            - APPLE_PAY
            - PAYPAL
            - AMAZON_PAY
            - CASH_APP
            - KLARNA
            - AFTERPAY
            - AFFIRM
            - VENMO
            - CARD_INSTALLMENT
          description: >-
            The payment method associated with a successful intent. See [Payment
            Methods](/get-started/payment-methods-supported) for the full list
            of supported payment methods and their availability.
          example: CARD
    Error:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          example: bad_request
        errorDescription:
          type: string
          example: Failed to read request
    BillingDetails:
      type: object
      description: Billing details for the customer.
      required:
        - name
        - email
        - contactNumber
      properties:
        name:
          type: string
          description: Customer's name
          example: John Doe
        email:
          type: string
          description: Customer's email address
          example: john.doe@example.com
        contactNumber:
          type: string
          description: >-
            Customer's contact number ([E.164
            format](https://en.wikipedia.org/wiki/E.164)), including the country
            code (e.g., +1 for US, +44 for UK, +91 for India).
          example: '+919123456789'
        customerAddress:
          $ref: '#/components/schemas/CustomerAddress'
    SucceededAt:
      type: integer
      description: >-
        Epoch timestamp in milliseconds of when the payment was successfully
        completed
      example: 1727340330123
    ChargeDTO:
      type: object
      description: Charge attempt details
      properties:
        status:
          type: string
          description: Status of the charge attempt
          example: SUCCESS
        paymentMetadata:
          $ref: '#/components/schemas/PaymentMetadataDTO'
          description: Payment metadata for this charge attempt
        chargeTime:
          type: integer
          format: int64
          description: Timestamp in epoch milliseconds when the charge was attempted
          example: 1727340330123
        errorCode:
          type: string
          description: >-
            Error code if the charge attempt failed. Refer to [error codes
            documentation](/products/one-time-payments/error-codes) for a
            complete list of possible error codes.
          example: card_declined
    CustomerAddress:
      type: object
      properties:
        addressLine1:
          type: string
          description: Line 1 of the customer's address
          example: 123 Main St
        addressLine2:
          type: string
          description: Line 2 of the customer's address
          example: Apt 1
        city:
          type: string
          description: City of the customer's address
          example: New York
        state:
          type: string
          description: State of the customer's address
          example: NY
        country:
          type: string
          description: >-
            Two-letter country code ([ISO 3166-1
            alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
          example: US
        postalCode:
          type: string
          description: Postal code
          example: '2424'
    PaymentMetadataDTO:
      type: object
      description: >-
        Payment metadata containing additional information about the payment
        attempt
      properties:
        paymentMethod:
          type: string
          description: >-
            The payment method used for this attempt. Refer to [supported
            payment
            methods](/get-started/payment-methods-supported#payment-method-enums)
            for a complete list of available payment methods.
          example: CARD
        cardMetadata:
          $ref: '#/components/schemas/CardMetadataDTO'
          description: Card-specific metadata (only present for card payments)
    CardMetadataDTO:
      type: object
      description: >-
        Card metadata containing additional information about the card used for
        payment
      properties:
        brand:
          type: string
          description: >-
            The brand of the card (e.g., `amex`, `diners`, `discover`, `jcb`,
            `mastercard`, `unionpay`, `visa`, `rupay`), among others
          example: visa
        country:
          type: string
          description: Country code of the card issuer
          example: US
        lastFourDigit:
          type: string
          description: Last 4 digits of the card number
          example: '4242'
        expiryMonth:
          type: integer
          format: int64
          description: Card expiration month
          example: 12
        expiryYear:
          type: integer
          format: int64
          description: Card expiration year
          example: 2028
        cardType:
          type: string
          description: Type of card funding, such as Credit or Debit
          enum:
            - CREDIT
            - DEBIT
            - PREPAID
            - UNKNOWN
          example: CREDIT
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````