Skip to content
Get started

Get a payment

client.Payments.Get(ctx, paymentID) (*Payment, error)
GET/v3/payments/{paymentId}

Get a payment

ParametersExpand Collapse
paymentID string
ReturnsExpand Collapse
type Payment struct{…}
ID stringOptional
AmountCents int64Optional
formatint64
ApprovalURL stringOptional

Present when the customer must approve with a passkey.

AttachURL stringOptional

Present when the customer must attach a card.

Currency stringOptional
Description stringOptional
Handle stringOptional
Status PaymentStatusOptional
One of the following:
const PaymentStatusNeedsConnection PaymentStatus = "needs_connection"
const PaymentStatusConnecting PaymentStatus = "connecting"
const PaymentStatusAwaitingUserAction PaymentStatus = "awaiting_user_action"
const PaymentStatusReady PaymentStatus = "ready"
const PaymentStatusAuthorized PaymentStatus = "authorized"
const PaymentStatusSucceeded PaymentStatus = "succeeded"
const PaymentStatusDeclined PaymentStatus = "declined"
const PaymentStatusCanceled PaymentStatus = "canceled"
const PaymentStatusExpired PaymentStatus = "expired"

Get a payment

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"),
  )
  payment, err := client.Payments.Get(context.TODO(), "paymentId")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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": 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": 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
}