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.3 KB
Raw Blame
import { createAction } from '@activepieces/pieces-framework';
import {
  httpClient,
  HttpMethod,
  AuthenticationType,
} from '@activepieces/pieces-common';
import { stripeAuth } from '../..';
import { stripeCommon } from '../common';

import { invoiceOutputSchema } from '../output-schemas';
export const stripeRetrieveInvoice = createAction({
  name: 'retrieve_invoice',
  classification: 'READ',
  auth: stripeAuth,
  displayName: 'Retrieve Invoice',
  description: 'Get the full details of an invoice.',
  audience: 'human',
  aiMetadata: {
    description:
      'Fetches the full details of a single Stripe invoice by its invoice ID (e.g., in_...). Use when you have the exact invoice ID and need its current status, amounts, or hosted/PDF links. Read-only and idempotent.',
    idempotent: true,
  },
  props: {
    invoice_id: stripeCommon.invoice, 
  },
  outputSchema: invoiceOutputSchema,
  async run(context) {
    const { invoice_id } = context.propsValue;

    const response = await httpClient.sendRequest({
      method: HttpMethod.GET,
      url: `${stripeCommon.baseUrl}/invoices/${invoice_id}`,
      authentication: {
        type: AuthenticationType.BEARER_TOKEN,
        token: context.auth.secret_text,
      },
    });

    return response.body;
  },
});