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 createPaymentRefund = createAction({
auth: trueLayerCommon.auth,
name: 'create-payment-refund',
classification: 'DESTRUCTIVE',
displayName: 'Create Payment Refund',
description: 'Refund a merchant account payment, either fully or partially.',
audience: 'both',
aiMetadata: { description: 'Issue a refund against an existing merchant-account payment, given its payment ID; omit the amount to refund in full or set an amount in minor units for a partial refund. Use to return funds to a payer. This creates a new refund each call and is not safe to repeat without external deduplication.', idempotent: false },
props: {
id: Property.ShortText({
displayName: 'Payment ID',
description: 'The payment ID for the payment to be fully or partially refunded.',
required: true,
}),
amount_in_minor: Property.ShortText({
displayName: 'Amount in Minor Units',
description: 'The amount to refund, expressed in minor units (e.g., 100 means 1 GBP).',
required: false,
}),
},
run: async (ctx) => {
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${trueLayerCommon.baseUrl}/v3/payments/${ctx.propsValue.id}/refunds`,
headers: {
Authorization: `Bearer ${(ctx.auth as OAuth2PropertyValue).access_token}`,
},
body: {
amount_in_minor: ctx.propsValue.amount_in_minor,
},
})
return response.body;
},
});