Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.2 KB
Raw Blame
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';

export const getPaymentLink = createAction({
  auth: trueLayerCommon.auth,
  name: 'get-payment-link',
  classification: 'READ',
  displayName: 'Get Payment Link',
  description: 'Retrieves payment link details. This API must be called using a backend bearer token.',
  audience: 'both',
  aiMetadata: { description: 'Retrieve the configuration and status of a single payment link by its ID. Use to inspect a link you created; read-only and safe to repeat. To list the payments collected through it instead, use Get Payments.', idempotent: true },
  props: {
    id: Property.ShortText({
      displayName: 'Payment Link ID',
      description: 'The ID of the payment link to retrieve.',
      required: true,
    }),
  },
  run: async (ctx) => {
    const response = await httpClient.sendRequest({
      method: HttpMethod.GET,
      url: `${trueLayerCommon.baseUrl}/v3/payment-links/${ctx.propsValue.id}`,
      headers: {
        Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
      },
    })

    return response.body;
  },
});