PayPal

Create PayPal Draft Invoice

Creates a draft invoice for one item, addressed to the customer's email.

Unverified

Add this first. This tool needs an access token, so add Get PayPal Access Token to the same bot. The bot calls it first and passes the token in.

What the model is told

Create a draft PayPal invoice for a customer. Get a PayPal access token first if you do not already have one. Confirm the email address, item description, quantity and unit price with the customer before calling. The invoice stays a draft and is not sent. The response holds a link to the invoice, and the invoice ID is the last part of that link. Use Send PayPal Invoice only if the customer asks for it to be sent.

Request

POSThttps://api-m.paypal.com/v2/invoicing/invoices

Headers

  • Content-Typeapplication/json
  • AuthorizationBearer {{accessToken}}

Body

{
  "detail": {
    "currency_code": "{{currency}}"
  },
  "primary_recipients": [
    {
      "billing_info": {
        "email_address": "{{email}}"
      }
    }
  ],
  "items": [
    {
      "name": "{{itemName}}",
      "quantity": "{{quantity}}",
      "unit_amount": {
        "currency_code": "{{currency}}",
        "value": "{{unitAmount}}"
      }
    }
  ]
}

Parameters

  • email stringThe customer's email address.
  • currency stringThree-letter uppercase ISO currency code.
  • itemName stringWhat is being invoiced.
  • quantity stringHow many of the item, as a whole number.
  • unitAmount stringThe price of one item as a decimal string with two decimal places.
  • accessToken stringThe access_token value returned by Get PayPal Access Token. Reuse it for the rest of the conversation.

Engage payload

{
  "source": "VOICE_AI",
  "tool": {
    "id": "ad85aaf3-2d09-4b2e-bb08-2c05207779b0",
    "type": "HTTP_REQUEST",
    "label": "Create PayPal Draft Invoice",
    "name": "create_paypal_draft_invoice",
    "customName": false,
    "description": "Create a draft PayPal invoice for a customer. Get a PayPal access token first if you do not already have one. Confirm the email address, item description, quantity and unit price with the customer before calling. The invoice stays a draft and is not sent. The response holds a link to the invoice, and the invoice ID is the last part of that link. Use Send PayPal Invoice only if the customer asks for it to be sent.",
    "parameters": [
      {
        "name": "email",
        "type": "string",
        "description": "The customer's email address."
      },
      {
        "name": "currency",
        "type": "string",
        "description": "Three-letter uppercase ISO currency code."
      },
      {
        "name": "itemName",
        "type": "string",
        "description": "What is being invoiced."
      },
      {
        "name": "quantity",
        "type": "string",
        "description": "How many of the item, as a whole number."
      },
      {
        "name": "unitAmount",
        "type": "string",
        "description": "The price of one item as a decimal string with two decimal places."
      },
      {
        "name": "accessToken",
        "type": "string",
        "description": "The access_token value returned by Get PayPal Access Token. Reuse it for the rest of the conversation."
      }
    ],
    "config": {
      "endpoint": {
        "method": "POST",
        "url": "https://api-m.paypal.com/v2/invoicing/invoices"
      },
      "headers": [
        {
          "name": "Content-Type",
          "value": "application/json"
        },
        {
          "name": "Authorization",
          "value": "Bearer {{accessToken}}"
        }
      ],
      "body": "{\n  \"detail\": {\n    \"currency_code\": \"{{currency}}\"\n  },\n  \"primary_recipients\": [\n    {\n      \"billing_info\": {\n        \"email_address\": \"{{email}}\"\n      }\n    }\n  ],\n  \"items\": [\n    {\n      \"name\": \"{{itemName}}\",\n      \"quantity\": \"{{quantity}}\",\n      \"unit_amount\": {\n        \"currency_code\": \"{{currency}}\",\n        \"value\": \"{{unitAmount}}\"\n      }\n    }\n  ]\n}",
      "timeout": null
    }
  }
}

IDs are regenerated on every copy.