Docs/Payments/Get Payment

Get Payment

Retrieve the details of an existing payment by its ID

GET/v1/payments/:id

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer token with your API secret key

Path Parameters

ParameterTypeDescription
idstringThe payment ID (e.g., pay_abc123xyz)

Response Body

{
  "id": "pay_abc123xyz",
  "object": "payment",
  "amount": 9999,
  "currency": "USD",
  "status": "succeeded",
  "payment_method": "card",
  "customer_email": "customer@example.com",
  "customer_id": "cust_xyz789",
  "description": "Order #1234",
  "statement_descriptor": "HEDGE PAYMENTS",
  "merchant_id": "merch_abc123",
  "checkout_session_id": "cs_def456",
  "refunded_amount": 0,
  "fee": 320,
  "net_amount": 9679,
  "metadata": {
    "orderId": "order_1234",
    "sku": "PREMIUM_PLAN"
  },
  "failure_code": null,
  "failure_message": null,
  "settled": true,
  "settled_at": "2024-06-15T10:35:00Z",
  "created_at": "2024-06-15T10:30:00Z",
  "updated_at": "2024-06-15T10:35:00Z"
}

Response Fields

FieldTypeDescription
idstringUnique payment identifier
objectstringAlways "payment"
amountintegerPayment amount in cents
currencystringThree-letter ISO currency code (e.g., "USD")
statusstringCurrent payment status (see below)
payment_methodstring"card", "ach", or "crypto"
customer_emailstringCustomer's email address
customer_idstring?Associated customer ID, if any
descriptionstring?Description set at payment creation
refunded_amountintegerTotal amount refunded in cents
feeintegerProcessing fee charged in cents
net_amountintegerAmount after fees in cents
metadataobjectArbitrary key-value metadata
failure_codestring?Error code if payment failed
failure_messagestring?Human-readable failure reason
settledbooleanWhether funds have been settled to merchant
settled_atstring?ISO 8601 timestamp of settlement
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last update timestamp

Payment Status Values

StatusDescription
pendingPayment created but not yet initiated
initiatedPayment has been submitted for processing
processingPayment is being processed by the payment network
succeededPayment completed successfully
failedPayment failed (see failure_code for details)
canceledPayment was canceled before processing
refundedPayment was fully refunded
partially_refundedPayment was partially refunded

Code Examples

Node.js

import { HedgePayments } from '@hedgepayments/node'

const hedge = new HedgePayments({
  apiKey: process.env.HEDGE_API_KEY,
  apiSecret: process.env.HEDGE_API_SECRET
})

const payment = await hedge.payments.retrieve('pay_abc123xyz')

console.log('Payment status:', payment.status)
console.log('Amount:', payment.amount / 100) // $99.99
console.log('Net amount:', payment.net_amount / 100) // after fees

cURL

curl https://api.hedgepayments.com/v1/payments/pay_abc123xyz \
  -H "Authorization: Bearer sk_live_your_api_key"

Error Responses

CodeDescription
401Invalid or missing API key
404Payment not found with the given ID