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
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { createAction, OAuth2PropertyValue, Property } from '@activepieces/pieces-framework';
import { trueLayerCommon } from '../../common';
export const cancelPayment = createAction({
auth: trueLayerCommon.auth,
name: 'cancel-payment',
classification: 'DESTRUCTIVE',
displayName: 'Cancel Payment',
description: 'Cancel a payment. This API can be called using the `resource_token` associated with the payment or a backend bearer token.',
audience: 'both',
aiMetadata: { description: 'Cancel an in-progress payment so it can no longer be authorized or executed. Use to abandon a payment before it completes. This is a state change on the payment and should be treated as one-time; callable with the payment resource token or a backend bearer token.', idempotent: false },
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The ID of the payment to cancel.',
required: true,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/actions/cancel`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
})
return response.body;
},
});