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

# Get a payment

> Retrieve a payment by its `id`.



## OpenAPI

````yaml /openapi.json get /api/partner/v1/payments/{id}
openapi: 3.1.0
info:
  title: Partner Payments API
  version: 1.0.0
  description: >
    Use the Partner Payments API to create, refund, void, and retrieve payments
    from your backend.


    ## Payments and portals


    A payment is one charge, identified by `id`. Its line items describe what
    the payer paid for. The payer is the person making the payment, and the
    agency receives the payment.


    A portal is an agency's payment configuration in GroGov. It determines the
    payment gateway and service fee configuration used for a payment. GroGov
    provides the `portalId` values your API account can access. Requests for an
    inaccessible or unknown portal return `403 PORTAL_ACCESS_DENIED`. Contact
    GroGov support to request access.


    ## Environments


    Use the sandbox at `https://apistagepc.grogov.us` to test without moving
    real money. GroGov provides your sandbox API key, portal IDs, and test
    cards. Production processes live payments and requires separate access.


    ## Authentication


    All payment endpoints require one of these credentials:


    - API key: `Authorization: ApiKey pc_<your-key>`. Request your key from
    GroGov support.

    - Access token: exchange your API key at `POST /api/partner/v1/auth/token`,
    then send `Authorization: Bearer <token>`. The access token is a JWT valid
    for one hour. When it expires, exchange your API key again. There is no
    refresh token.


    Rotating an API key invalidates the previous key. Access tokens already
    issued remain valid until they expire. Deactivating your API account blocks
    both credentials on the next request.


    A card token represents card details and is separate from an access token.
    Contact GroGov support for the supported card-token integration for your
    portal. This API does not create card tokens.


    ## Amounts


    All monetary amounts are integer cents in `USD`. Monetary field names end in
    `Cents`, including `amountCents` and `serviceFeeCents`. `100` cents is $1.00
    USD. Sending a field named `amount` returns `400 VALIDATION_ERROR`.


    The principal is the payment amount excluding the service fee. GroGov adds
    the service fee to `amountCents`. Use `GET /api/partner/v1/fees/quote` to
    calculate the fee before charging.


    ## Settlement


    A batch is a group of transactions the payment processor submits for
    settlement. Settlement transfers funds for those transactions. A settled
    payment requires a refund instead of a void.


    ## Idempotency


    For `POST /payments`, `POST /payments/{id}/refund`, and `POST
    /payments/{id}/void`, use an `Idempotency-Key` header. The key can be any
    unique string up to 255 characters. The header is optional but recommended
    to prevent duplicate operations when retrying. Keys are scoped to your API
    account and kept for 24 hours.


    - Same key and body: the original response is returned with
    `Idempotent-Replayed: true`. No additional charge, refund, or void occurs.

    - Same key with a different body: `409 IDEMPOTENCY_MISMATCH`.

    - Same key while the first request is still processing: `409
    IDEMPOTENCY_IN_PROGRESS` with `Retry-After`.

    - After a `5xx` on create, the key stays reserved and a retry returns `409
    IDEMPOTENCY_RECONCILIATION_REQUIRED`. Check the payment list and resolve the
    original outcome before attempting a new charge. After a `5xx` on refund or
    void, the key is released and you can retry with the same key.


    ## Errors


    Payment errors include a machine-readable `details.code`: `{ "success":
    false, "message": "…", "details": { "code": "…" } }`. Authentication
    failures with HTTP status `401` or `403` can omit `details` and include only
    `message`.


    Case-specific restrictions use the payment-level `referenceId`. This is
    separate from each line item's `referenceId`. The applicable restrictions
    depend on the agency's payment configuration.


    | Code | HTTP | Meaning |

    |---|---|---|

    | `VALIDATION_ERROR` | 400 | The request is malformed or a field is invalid.
    See `message` for details |

    | `PAYMENT_DECLINED` | 402 | The card was declined |

    | `PAYMENT_BLOCKED` | 403 | Payments are blocked for the case identified by
    the payment-level `referenceId`. Do not retry |

    | `PAYMENT_HELD` | 409 | The case identified by the payment-level
    `referenceId` has a temporary payment hold. Try again later |

    | `DECLINE_BLOCKED` | 409 | This card was declined recently and is
    temporarily blocked. Use another card or try again later |

    | `VELOCITY_LIMIT` | 429 | Too many recent attempts for this case or card.
    Wait before retrying |

    | `PAYMENT_NOT_ALLOWED` | 422 | The payment does not meet the portal's
    payment rules or applicable case restrictions |

    | `PORTAL_ACCESS_DENIED` | 403 | The portal does not exist or your API
    account may not use it |

    | `PAYMENT_NOT_FOUND` | 404 | The payment does not exist or belongs to
    another API account |

    | `IDEMPOTENCY_MISMATCH` | 409 | The `Idempotency-Key` was already used with
    a different request |

    | `IDEMPOTENCY_IN_PROGRESS` | 409 | A request with this `Idempotency-Key` is
    still being processed. Retry after `Retry-After` |

    | `IDEMPOTENCY_RECONCILIATION_REQUIRED` | 409 | An earlier request with this
    key ended in an unknown state. Contact GroGov before retrying |

    | `INVALID_STATE` | 422 | The payment cannot be refunded or voided in its
    current state, or the refund exceeds the remaining amount |

    | `VOID_FAILED` | 422 | The payment gateway rejected the void. Check
    `details.suggestedAction` for the next operation |

    | `INTERNAL_ERROR` | 500 | An unexpected server error |

    | `CAPTURE_NOT_SUPPORTED` | 501 | Authorize-then-capture is not supported.
    Payments charge immediately |

    | `VAULT_NOT_SUPPORTED` | 501 | Storing cards and charging stored vault
    cards are not supported |

    | `PAYMENT_GATEWAY_ERROR` | 502 | The payment gateway returned an error. The
    payment did not succeed |

    | `PARTIAL_REFUND_PENDING` | 502 | The principal was refunded but the
    service fee refund failed. Retry the refund |

    | `GATEWAY_NOT_CONFIGURED` | 503 | The portal has no payment gateway
    configured |

    | `IDEMPOTENCY_UNAVAILABLE` | 503 | A request with an `Idempotency-Key`
    cannot be processed safely right now. Nothing was charged or refunded.
    Contact GroGov support |

    | `PAYMENT_TIMEOUT` | 504 | The payment gateway response was missing or
    unreadable. The outcome is unknown. Check the payment before retrying |


    ## Unsupported operations


    - Authorizing payments for later capture. `capture: "auth"` and `POST
    /payments/{id}/capture` return `501 CAPTURE_NOT_SUPPORTED`.

    - Storing cards or charging stored cards. `POST /vault` and
    `paymentMethod.type: "vault"` return `501 VAULT_NOT_SUPPORTED`.

    - Individual line-item refunds. Use the payment's `id`. A line-item ID
    returns `404 PAYMENT_NOT_FOUND`.

    - Filtering `GET /payments` by `referenceId`.
  contact:
    name: GroGov Partner Support
    email: support@grogov.us
servers:
  - url: https://apistagepc.grogov.us
    description: Sandbox
  - url: https://apiprodpc.grogov.us
    description: Production. Live payments require production access.
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Auth
    description: >-
      Exchange an API key for a one-hour access token to authenticate subsequent
      requests.
  - name: Vault
    description: >-
      Storing cards and charging stored cards are not supported. Requests return
      501 `VAULT_NOT_SUPPORTED`.
  - name: Payments
    description: Create and manage payments containing one or more line items.
  - name: Hosted checkout
    description: >-
      Send the payer's browser to a GroGov-hosted checkout page instead of
      collecting card details yourself. You never handle card data, and these
      endpoints need no API key: the portal's hosted-checkout settings authorize
      the request.


      Start a checkout by posting a form or JSON to `POST /api/v1/payer/intake`,
      or by sending the payer to a launch link, `GET /api/v1/payer/intake/link`.
      Both answer with a `303` redirect. On success the payer lands on the
      checkout page with your line items filled in. On failure they go to your
      `cancel_url` with an error code, or to a GroGov error page.


      The result comes back on the payer's browser: when they press Done on the
      receipt, they go to your `return_url`. When they leave the checkout, they
      go to your `cancel_url`. Both carry a `sig` you can verify with the
      portal's signing secret. See `HostedCheckoutPaidResult`,
      `HostedCheckoutCancelledResult`, and `HostedCheckoutFailedResult`.


      Ask the agency or GroGov support to turn on hosted checkout for the
      portal, to add your return and cancel addresses to its allowlist, and for
      the signing secret. Every address must use `https`.
paths:
  /api/partner/v1/payments/{id}:
    get:
      tags:
        - Payments
      summary: Get a payment
      description: Retrieve a payment by its `id`.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
            format: uuid
          description: Payment ID (`id`). Line-item IDs are not accepted.
      responses:
        '200':
          description: Payment found
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessResponse'
                  - properties:
                      data:
                        $ref: '#/components/schemas/PaymentGroupResponse'
        '404':
          description: Payment not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
        message:
          type: string
    PaymentGroupResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Payment ID. Use it in `/payments/{id}` routes.
        status:
          type: string
          enum:
            - pending
            - authorized
            - succeeded
            - failed
            - voided
            - refunded
            - partially_refunded
            - unknown
          example: succeeded
        captureMode:
          type: string
          enum:
            - sale
            - auth
        currency:
          type: string
          example: USD
        amountCents:
          type: integer
          description: Base amount in cents (excluding service fee)
          example: 10000
        serviceFeeCents:
          type: integer
          description: Service fee in cents
          example: 300
        totalChargedCents:
          type: integer
          description: Amount + service fee in cents
          example: 10300
        refundedAmountCents:
          type: integer
          description: Total refunded in cents
          example: 0
        remainingRefundableAmountCents:
          type: integer
          description: Cents still refundable
          example: 10300
        authorizedAmountCents:
          type: integer
          description: >-
            Reserved authorization amount in cents. Authorizing payments for
            later capture is not supported.
          example: 10300
        capturedAmountCents:
          type: integer
          description: Captured amount in cents
          example: 0
        confirmationNumber:
          type: string
          example: PP-1710000000000
        portalId:
          type: string
          format: uuid
        payer:
          $ref: '#/components/schemas/PayerInfo'
        paymentMethod:
          type: object
          properties:
            type:
              type: string
              enum:
                - card
                - card_token
                - vault
              example: card_token
            brand:
              type: string
              example: Visa
            last4:
              type: string
              example: '4242'
        gateway:
          $ref: '#/components/schemas/GatewayInfo'
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/LineItemResponse'
        expiresAt:
          type: string
          format: date-time
          description: >-
            Reserved authorization expiry timestamp. Authorizing payments for
            later capture is not supported.
        capturedAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Payment was declined.
        details:
          type: object
          required:
            - code
          properties:
            code:
              type: string
              example: PAYMENT_DECLINED
              description: >-
                Machine-readable error code. See the error table in the API
                description for every code and its HTTP status.
            id:
              type: string
              format: uuid
              description: >-
                ID of the failed payment, present on `PAYMENT_DECLINED`,
                `PAYMENT_TIMEOUT` and `PAYMENT_GATEWAY_ERROR` when the payment
                engine returns an ID for the attempt. Some timeouts return none;
                then list recent payments to check the outcome. Fetch it with
                `GET /payments/{id}` before retrying: it reads `failed` after a
                decline or gateway error, and may read `voided` or `unknown`
                after a timeout.
    PayerInfo:
      type: object
      properties:
        firstName:
          type: string
          example: Jane
        lastName:
          type: string
          example: Doe
        email:
          type: string
          format: email
          example: jane.doe@example.com
        phone:
          type: string
          example: '+15551234567'
        address:
          type: object
          properties:
            line1:
              type: string
            line2:
              type: string
            city:
              type: string
            state:
              type: string
            zip:
              type: string
            country:
              type: string
              default: US
    GatewayInfo:
      type: object
      properties:
        transactionId:
          type: string
          description: >-
            The payment gateway's transaction ID. Not the same as the payment
            `id`.
          example: '4938271649'
        authCode:
          type: string
          description: Gateway authorization code
          example: '123456'
    LineItemResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Line item ID
        amountCents:
          type: integer
          description: Cents
          example: 5000
        serviceFeeCents:
          type: integer
          description: Pro-rated service fee in cents
          example: 150
        status:
          type: string
          example: succeeded
        refundedAmountCents:
          type: integer
          description: Cents refunded so far
          example: 0
        remainingRefundableAmountCents:
          type: integer
          description: Cents still refundable
          example: 5000
        referenceId:
          type: string
          example: CASE-2024-00123
        description:
          type: string
          example: Court filing fee
        metadata:
          type: object
          additionalProperties: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your API key as `Authorization: ApiKey pc_<your-key>`. The API also
        accepts the key without the `ApiKey ` prefix. API keys authenticate
        requests to `/api/partner/v1/*`. Contact GroGov support to rotate your
        key or deactivate your API account. Rotation invalidates the previous
        key. Account deactivation blocks both API keys and access tokens.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Exchange your API key at `POST /api/partner/v1/auth/token` for a
        one-hour access token, then send `Authorization: Bearer <token>`. An
        access token cannot obtain another access token. When a token expires or
        is rejected, exchange your API key for a new one. Tokens authenticate
        requests only to `/api/partner/v1/*`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.