Skip to content
Get started

Start payment-provider onboarding

client.PaymentProviders.Connect(ctx, provider, body) (*PaymentProviderConnectResponse, error)
POST/v3/payments/providers/{provider}/connect

Begins connecting your organization to a payment provider (e.g. agentcard). Returns a hosted URL where an admin authorizes the connection; on completion the provider redirects back and Linq stores your connected credentials.

ParametersExpand Collapse
provider string
body PaymentProviderConnectParams
ReturnURL param.Field[string]

Where to send the admin after they authorize the connection.

ReturnsExpand Collapse
type PaymentProviderConnectResponse struct{…}
HostedURL stringOptional

Send the admin here to authorize the connection.

SessionID stringOptional
Status stringOptional

Start payment-provider onboarding

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"),
  )
  response, err := client.PaymentProviders.Connect(
    context.TODO(),
    "provider",
    linqgo.PaymentProviderConnectParams{
      ReturnURL: "https://partner.example/settings/payments",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.SessionID)
}
{
  "hosted_url": "https://app.agentcard.sh/connect-platform/tok_abc",
  "session_id": "pcs_9f2a",
  "status": "pending"
}
{
  "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
{
  "hosted_url": "https://app.agentcard.sh/connect-platform/tok_abc",
  "session_id": "pcs_9f2a",
  "status": "pending"
}
{
  "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
}