Get Invoice by Payment ID API

Retrieve an invoice using the payment gateway transaction ID

Billing

Get Invoice by Payment ID API

Find an invoice using the payment gateway transaction ID. Useful when you have the payment reference but not the invoice ID.

Payment Lookup

Find by transaction ID.

Gateway Reference

Link to payment provider.

Full Invoice

Complete billing details.


Endpoint Overview

QUERY/graphql

Retrieve an invoice using the payment gateway's transaction ID. Matches invoices to their corresponding payment records.

Authentication:Bearer Token
Required scopes:admin

Request Parameters

paymentIdString!Required

The payment gateway transaction ID (e.g., Stripe charge ID, PayPal transaction ID).


GraphQL Query

query getInvoiceByPaymentId($paymentId: String!) {
  getInvoiceByPaymentId(paymentId: $paymentId) {
    id
    firstName
    lastName
    email
    totalAmount
    paymentMethod
    paymentDate
    invoiceDate
    groupId
    amountForGroup
  }
}

Variables:

{
  "paymentId": "ch_1234567890abcdef"
}

HTTP Request:

curl -X POST https://api.orbnet.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -d '{
    "query": "query getInvoiceByPaymentId($paymentId: String!) { getInvoiceByPaymentId(paymentId: $paymentId) { id email totalAmount paymentMethod paymentDate } }",
    "variables": {
      "paymentId": "ch_1234567890abcdef"
    }
  }'

Response

200Invoice Found
{
  "data": {
    "getInvoiceByPaymentId": {
      "id": "inv_12345",
      "firstName": "Jane",
      "lastName": "Smith",
      "email": "jane.smith@example.com",
      "totalAmount": 49.99,
      "paymentMethod": "stripe",
      "paymentDate": "2024-01-15T10:30:00Z",
      "invoiceDate": "2024-01-15T10:30:00Z",
      "groupId": "200",
      "amountForGroup": 49.99
    }
  }
}
400Payment Not Found
{
  "errors": [
    {
      "message": "No invoice found for payment ID 'ch_1234567890abcdef'",
      "path": ["getInvoiceByPaymentId"],
      "extensions": {
        "code": "NOT_FOUND"
      }
    }
  ],
  "data": null
}

Supported Payment IDs

Stripe

Charge IDs (ch_xxx) or Payment Intent IDs.

PayPal

Transaction IDs from PayPal.

CoinPayments

Crypto transaction IDs.

Other Gateways

Any stored payment reference.


Use Cases

Payment Reconciliation

Match gateway records to invoices.

Webhook Processing

Look up invoice from webhook data.

Support Tickets

Find invoice from payment reference.

Refund Processing

Identify invoice for refunds.



Payment ID Format

Use the exact payment ID from your payment gateway. Format varies by provider (Stripe: ch_xxx, PayPal: transaction ID, etc.).

Filter by Date Instead?

Use the date range endpoint to find invoices within a specific time period.

Invoices by Date Range