Skip to content
Linq Copy agent prompt

Get a payment

payments.retrieve(strpayment_id) -> Payment
GET/v3/payments/{paymentId}

Get a payment

ParametersExpand Collapse
payment_id: str
ReturnsExpand Collapse
class Payment:
id: Optional[str]
amount_cents: Optional[int]
formatint64
approval_url: Optional[str]

Present on awaiting_user_action once a card is on file and the charge needs the customer’s passkey. Re-send the create request with the same Idempotency-Key to collect the payment after they approve.

attach_url: Optional[str]

Present on awaiting_user_action when the customer has no card on file yet. A hosted page — open it for them; it stays valid for about 48 hours. Not returned on needs_connection: connect the handle first.

currency: Optional[str]
description: Optional[str]
handle: Optional[str]
merchant: Optional[Merchant]

The merchant the card is minted against, echoed from the request.

name: Optional[str]
url: Optional[str]
metadata: Optional[Dict[str, str]]

Your own key/values, echoed back from the request.

status: Optional[Literal["needs_connection", "connecting", "awaiting_user_action", 6 more]]
One of the following:
"needs_connection"
"connecting"
"awaiting_user_action"
"ready"
"authorized"
"succeeded"
"declined"
"canceled"
"expired"

Get a payment

import os
from linq import LinqAPIV3

client = LinqAPIV3(
    api_key=os.environ.get("LINQ_API_V3_API_KEY"),  # This is the default and can be omitted
)
payment = client.payments.retrieve(
    "paymentId",
)
print(payment.id)
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount_cents": 2500,
  "approval_url": "approval_url",
  "attach_url": "https://app.agentcard.sh/attach/eyJhbGciOi...",
  "currency": "usd",
  "description": "description",
  "handle": "+14155550123",
  "merchant": {
    "name": "DoorDash",
    "url": "doordash.com"
  },
  "metadata": {
    "foo": "string"
  },
  "status": "ready"
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/2xxx/2004/"
  },
  "success": false
}
{
  "error": {
    "status": 404,
    "code": 2001,
    "message": "Resource not found",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/2xxx/2001/"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/3xxx/3006/"
  },
  "success": false
}
Returns Examples
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount_cents": 2500,
  "approval_url": "approval_url",
  "attach_url": "https://app.agentcard.sh/attach/eyJhbGciOi...",
  "currency": "usd",
  "description": "description",
  "handle": "+14155550123",
  "merchant": {
    "name": "DoorDash",
    "url": "doordash.com"
  },
  "metadata": {
    "foo": "string"
  },
  "status": "ready"
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/2xxx/2004/"
  },
  "success": false
}
{
  "error": {
    "status": 404,
    "code": 2001,
    "message": "Resource not found",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/2xxx/2001/"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/3xxx/3006/"
  },
  "success": false
}