Skip to content
Get started

Create a payment (agent pays on a customer's behalf)

client.payments.create(PaymentCreateParams { amount_cents, currency, handle, 3 more } body, RequestOptionsoptions?): Payment { id, amount_cents, approval_url, 5 more }
POST/v3/payments

Advances the pay flow for a connected customer handle and returns a status describing where it is (needs_connection, awaiting_user_action, ready, …). A payment id appears once a card is minted. Idempotent on the Idempotency-Key header.

ParametersExpand Collapse
body: PaymentCreateParams { amount_cents, currency, handle, 3 more }
amount_cents: number
formatint64
currency: string
handle: string

Customer phone (E.164) or email.

description?: string
merchant?: Merchant
name?: string
url?: string
metadata?: Record<string, string>
ReturnsExpand Collapse
Payment { id, amount_cents, approval_url, 5 more }
id?: string
amount_cents?: number
formatint64
approval_url?: string

Present when the customer must approve with a passkey.

attach_url?: string

Present when the customer must attach a card.

currency?: string
description?: string
handle?: string
status?: "needs_connection" | "connecting" | "awaiting_user_action" | 6 more
One of the following:
"needs_connection"
"connecting"
"awaiting_user_action"
"ready"
"authorized"
"succeeded"
"declined"
"canceled"
"expired"

Create a payment (agent pays on a customer's behalf)

import LinqAPIV3 from '@linqapp/sdk';

const client = new LinqAPIV3({
  apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted
});

const payment = await client.payments.create({
  amount_cents: 2500,
  currency: 'usd',
  handle: '+14155550123',
});

console.log(payment.id);
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount_cents": 2500,
  "approval_url": "approval_url",
  "attach_url": "attach_url",
  "currency": "usd",
  "description": "description",
  "handle": "+14155550123",
  "status": "ready"
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2004/"
  },
  "success": false
}
{
  "error": {
    "status": 403,
    "code": 2005,
    "message": "Access denied - insufficient permissions for this resource",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2005/"
  },
  "success": false
}
{
  "error": {
    "status": 404,
    "code": 2001,
    "message": "Resource not found",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2001/"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error",
    "doc_url": "https://docs.linqapp.com/error/codes/3xxx/3006/"
  },
  "success": false
}
Returns Examples
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount_cents": 2500,
  "approval_url": "approval_url",
  "attach_url": "attach_url",
  "currency": "usd",
  "description": "description",
  "handle": "+14155550123",
  "status": "ready"
}
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2004/"
  },
  "success": false
}
{
  "error": {
    "status": 403,
    "code": 2005,
    "message": "Access denied - insufficient permissions for this resource",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2005/"
  },
  "success": false
}
{
  "error": {
    "status": 404,
    "code": 2001,
    "message": "Resource not found",
    "doc_url": "https://docs.linqapp.com/error/codes/2xxx/2001/"
  },
  "success": false
}
{
  "error": {
    "status": 500,
    "code": 3006,
    "message": "Internal server error",
    "doc_url": "https://docs.linqapp.com/error/codes/3xxx/3006/"
  },
  "success": false
}