PayPal
Orders (agent use capped by amount and currency), captures, refunds, draft invoices, balances and transactions, capture, refunds, invoice sending and payouts node only
Beta v0.1.0 Node.js 19 actions
About
A Graphrt plugin for the PayPal REST API: Orders v2 (create, get, capture, authorize), captures, authorizations and refunds, Invoicing v2 (draft invoices), Payouts, and reporting (balances, transactions). It is built with the declarative REST layer (definition.mjs) plus small agent-safety wrappers in lib/.
What it can do
- Orders: create_order (returns the buyer's approve link), get_order, capture_order, authorize_order
- Payments: get_capture, refund_capture, get_refund, get_authorization, capture_authorization, void_authorization
- Invoices: list_invoices, get_invoice, create_invoice (draft), send_invoice
- Account: get_balances, list_transactions (up to 31 days per call)
- Payouts: create_payout, get_payout_batch
- api_request: any other endpoint (agents: GET and allowlisted paths only)
Actions
Each action is a step you can add to a workflow. Agents can also use most of them as tools.
- Create order
paypal.create_order - Get order
paypal.get_order - Capture order
paypal.capture_order - Authorize order
paypal.authorize_order - Get capture
paypal.get_capture - Refund capture
paypal.refund_capture - Get refund
paypal.get_refund - Get authorization
paypal.get_authorization - Capture authorization
paypal.capture_authorization - Void authorization
paypal.void_authorization
Show all 19 actions
- List invoices
paypal.list_invoices - Get invoice
paypal.get_invoice - Create draft invoice
paypal.create_invoice - Send invoice
paypal.send_invoice - Get balances
paypal.get_balances - List transactions
paypal.list_transactions - Create payout
paypal.create_payout - Get payout batch
paypal.get_payout_batch - PayPal REST API request
paypal.api_request
Settings
Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.
-
PAYPAL_CLIENT_IDRequiredREST app client id -
PAYPAL_CLIENT_SECRETRequiredREST app secret (OAuth2 client credentials, the token is cached in memory) -
PAYPAL_ENVOptionalsandbox (default, api-m.sandbox.paypal.com) or live (api-m.paypal.com) -
PAYPAL_TOOL_ALLOW_ORDERSOptional1 lets agent tools create orders, within the cap below -
PAYPAL_TOOL_MAX_AMOUNTFor agent ordersMaximum total of an agent-created order (sum of purchase_units[].amount.value, major unit, e.g. 50 = $50). Unset or 0 refuses every one -
PAYPAL_TOOL_ALLOWED_CURRENCIESFor agent ordersComma-separated currencies agents may use, e.g. USD. Unset refuses every agent order -
PAYPAL_TOOL_ALLOW_INVOICESOptional1 lets agent tools create draft invoices (item totals within PAYPAL_TOOL_MAX_AMOUNT) -
PAYPAL_TOOL_ALLOWED_RETURN_HOSTSOptionalComma-separated hosts agent orders may use in return_url / cancel_url (any https host when unset) -
PAYPAL_TOOL_API_EXTRA_PATHSOptionalMore GET paths agents may reach with api_request, comma-separated, * = one segment
How to use it
In Graphrt Desktop
- Open Plugins and search for PayPal.
- Click Install and approve it.
- Follow the setup steps on the plugin's page, then paste the settings it needs.
- Describe a job that needs it, and the builder adds the steps.
With the CLI
terminal
$ graphrt plugin install paypal workflow.yaml
- id: order
type: paypal.create_order
purchase_units: [{ reference_id: "{{#start.order_id#}}", amount: { currency_code: USD, value: "25.00" } }]
return_url: https://shop.example/paypal/return
cancel_url: https://shop.example/paypal/cancel
- id: capture # after the buyer approved
type: paypal.capture_order
order_id: "{{#order.data.id#}}"