Skip to content
Linq Copy agent prompt

Get a payment request

client.PaymentRequests.Get(ctx, paymentRequestID) (*PaymentRequest, error)
GET/v3/payment_requests/{paymentRequestId}

Returns a payment request’s status and details.

ParametersExpand Collapse
paymentRequestID string
formatuuid
ReturnsExpand Collapse
type PaymentRequest struct{…}
ID string

Unique identifier of the payment request.

formatuuid
Amount int64

What the recipient is charged at checkout, in the currency’s minor units. In subscription mode this is the first invoice’s amount due — all items after any discounts are applied — so a discount that covers the whole invoice returns 0 and checkout shows $0.00.

formatint64
CheckoutURL string

URL the recipient opens to pay: https://zero.linqapp.com/pay/{slug}?session=..., where {slug} is your partner checkout slug.

CreatedAt Time
formatdate-time
Currency string
Mode PaymentRequestMode

Whether this request collects a one-time charge or starts a subscription.

One of the following:
const PaymentRequestModePayment PaymentRequestMode = "payment"
const PaymentRequestModeSubscription PaymentRequestMode = "subscription"
Object string
Status PaymentRequestStatus

Lifecycle status of the payment request.

One of the following:
const PaymentRequestStatusRequested PaymentRequestStatus = "requested"
const PaymentRequestStatusSucceeded PaymentRequestStatus = "succeeded"
const PaymentRequestStatusCanceled PaymentRequestStatus = "canceled"
const PaymentRequestStatusExpired PaymentRequestStatus = "expired"
Description stringOptional
Discount PaymentRequestDiscountOptional

Subscription mode — the discount applied, as Stripe applied it.

Coupon stringOptional

The ID of the coupon applied.

Label stringOptional

The customer-facing discount description shown at checkout.

PromotionCode stringOptional

The ID of the promotion code applied, if you passed one.

ExpiresAt TimeOptional

When an unpaid request auto-expires.

formatdate-time
Interval PaymentRequestIntervalOptional

Subscription mode — how often the subscription renews.

One of the following:
const PaymentRequestIntervalDay PaymentRequestInterval = "day"
const PaymentRequestIntervalWeek PaymentRequestInterval = "week"
const PaymentRequestIntervalMonth PaymentRequestInterval = "month"
const PaymentRequestIntervalYear PaymentRequestInterval = "year"
IntervalCount int64Optional

Subscription mode — intervals per renewal (e.g. 3 + month = quarterly).

formatint64
Metadata map[string, string]Optional
Natural PaymentRequestNaturalOptional

Natural-rail join keys, present when rail: natural.

PaymentRequestID stringOptional

The Natural payment request (prq_...).

TransactionID stringOptional

The settled transaction (txn_...).

PriceID stringOptional

Subscription mode — the recurring price this request subscribes to.

Quantity int64Optional

Subscription mode — units of the price subscribed to.

formatint64
Rail PaymentRequestRailOptional

The rail this request settled on.

One of the following:
const PaymentRequestRailStripe PaymentRequestRail = "stripe"
const PaymentRequestRailNatural PaymentRequestRail = "natural"
Stripe PaymentRequestStripeOptional

Ids of the Stripe objects created on your connected account — your join keys into your own Stripe Dashboard, webhooks, and API. After a subscription’s first payment succeeds, its ongoing lifecycle (renewals, plan changes, cancellation) is managed in your Stripe account using subscription_id.

CustomerID stringOptional

The Customer this request is attached to (cus_...). Always set in subscription mode (created for you unless you passed customer_id); set in payment mode only when you passed one.

PaymentIntentID stringOptional

The PaymentIntent collected at checkout (pi_...).

SubscriptionID stringOptional

Subscription mode — the Subscription (sub_...).

TrialEnd TimeOptional

Subscription mode — when the free trial ends and the first charge happens. Present only on trial requests; paid_at/succeeded mean the payment method was collected (no funds move until this time).

formatdate-time
UpdatedAt TimeOptional
formatdate-time

Get a payment request

package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  paymentRequest, err := client.PaymentRequests.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", paymentRequest.ID)
}
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "amount": 497,
  "checkout_url": "https://zero.linqapp.com/pay/tomo?session=tok_abc123",
  "created_at": "2019-12-27T18:11:19.117Z",
  "currency": "usd",
  "mode": "payment",
  "object": "payment_request",
  "status": "requested",
  "description": "description",
  "discount": {
    "coupon": "LAUNCH50",
    "label": "15 OFF FIRST MONTH",
    "promotion_code": "promo_1QAbCdEfGhIjKlMn"
  },
  "expires_at": "2019-12-27T18:11:19.117Z",
  "interval": "day",
  "interval_count": 0,
  "metadata": {
    "foo": "string"
  },
  "natural": {
    "payment_request_id": "payment_request_id",
    "transaction_id": "transaction_id"
  },
  "paid_at": "2019-12-27T18:11:19.117Z",
  "price_id": "price_id",
  "quantity": 0,
  "rail": "stripe",
  "stripe": {
    "customer_id": "cus_QAbCdEfGhIjKlMn",
    "payment_intent_id": "pi_3QAbCdEfGhIjKlMn",
    "subscription_id": "sub_1QAbCdEfGhIjKlMn"
  },
  "trial_end": "2019-12-27T18:11:19.117Z",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
{
  "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": 403,
    "code": 2005,
    "message": "Access denied - insufficient permissions for this resource",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/2xxx/2005/"
  },
  "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": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "amount": 497,
  "checkout_url": "https://zero.linqapp.com/pay/tomo?session=tok_abc123",
  "created_at": "2019-12-27T18:11:19.117Z",
  "currency": "usd",
  "mode": "payment",
  "object": "payment_request",
  "status": "requested",
  "description": "description",
  "discount": {
    "coupon": "LAUNCH50",
    "label": "15 OFF FIRST MONTH",
    "promotion_code": "promo_1QAbCdEfGhIjKlMn"
  },
  "expires_at": "2019-12-27T18:11:19.117Z",
  "interval": "day",
  "interval_count": 0,
  "metadata": {
    "foo": "string"
  },
  "natural": {
    "payment_request_id": "payment_request_id",
    "transaction_id": "transaction_id"
  },
  "paid_at": "2019-12-27T18:11:19.117Z",
  "price_id": "price_id",
  "quantity": 0,
  "rail": "stripe",
  "stripe": {
    "customer_id": "cus_QAbCdEfGhIjKlMn",
    "payment_intent_id": "pi_3QAbCdEfGhIjKlMn",
    "subscription_id": "sub_1QAbCdEfGhIjKlMn"
  },
  "trial_end": "2019-12-27T18:11:19.117Z",
  "updated_at": "2019-12-27T18:11:19.117Z"
}
{
  "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": 403,
    "code": 2005,
    "message": "Access denied - insufficient permissions for this resource",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/2xxx/2005/"
  },
  "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
}