What the agent does
This is for a yoga or pilates studio that sells monthly memberships, in the studio and for its live-streamed classes, billed as PayPal subscriptions. When a member's card expires or their PayPal balance runs short, PayPal retries the payment and, after the number of failures the plan allows, suspends the subscription. Nobody at the studio sees it happen: the member keeps booking classes until the front desk notices weeks later, and by then a friendly reminder has become an awkward conversation about money owed. Every Monday an agent checks every active membership and lists the ones in trouble while they can still be fixed.
The studio connects PayPal once with POST /me/connections {"type": "mcp", "name": "paypal", "url": "https://mcp.paypal.com/mcp", "auth": {"mode": "oauth"}} and signs in on PayPal's own page with the business account the memberships are billed to. PayPal's server lists the studio's plans with list_subscription_plans and reads one subscription at a time with show_subscription_details, but it has no tool that lists subscriptions, so the studio's booking system supplies them: its backend writes the PayPal subscription id and member name of every membership it shows as active into the run's input.
For each id the agent calls show_subscription_details and reads status, status_update_time and billing_info. PayPal documents failed_payments_count there as the number of consecutive failures, reset to 0 by a successful payment, and last_failed_payment with its amount, time, reason_code and next_payment_retry_time. It reads each plan once with show_subscription_plan_details for its payment_failure_threshold, the number of failures before PayPal suspends the subscription, so it can say how close each member is.
It sorts the memberships into four groups: suspended already, failed at least once and still active, cancelled or expired in PayPal although the booking system still shows them active, and fine. For every member in the first two it writes the amount, when the payment failed, the reason_code (such as PAYMENT_DENIED or PAYER_CANNOT_PAY), the next retry and how many failures remain before suspension, then drafts a short, kind note asking them to update their payment method in PayPal. It reads only: the prompt forbids cancel_subscription, update_subscription, create_subscription and every invoice, order and refund tool.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Check our PayPal memberships for failed payments. Use the PayPal connection, reads only. Our booking system shows these memberships active (subscription id, member): I-BW452GLLEP1G Priya Raman; I-5RT03K8LYN9M Tom Okafor; I-0DX8V6WQ3H2C Lena Brooks. 1) Call list_subscription_plans, then show_subscription_plan_details for each plan to get payment_failure_threshold. 2) Call show_subscription_details for every id and read status, status_update_time, plan_id and billing_info: failed_payments_count, last_failed_payment (amount, time, reason_code, next_payment_retry_time), next_billing_time, outstanding_balance. 3) Group: SUSPENDED; ACTIVE with failed_payments_count of 1 or more; CANCELLED or EXPIRED (out of step with our system); fine. Write memberships.md with the first three groups (member, plan, amount, failure time, reason_code, next retry, failures left before suspension) and drafts.json: [{subscription_id, member, draft}] for the first two groups, each draft a warm three-sentence note asking them to update their payment method in PayPal, with no amounts owed beyond the failed payment. Do not call cancel_subscription, update_subscription, create_subscription or any invoice, order, refund or dispute tool.",
"connections": [
"paypal"
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
memberships.md lists the memberships suspended or with a failed payment, and those PayPal and the booking system disagree on. The session returns it and drafts.json as artifacts, and the studio's webhook handler posts the summary to the front desk's inbox: how many are suspended, how many have a failed payment, and which ones the two disagree on.
What the studio manager checks before sending a note: that the member has not already paid at the desk or switched to a class pack, which PayPal does not know; that the reason makes sense to raise, since a PAYEE_ACCOUNT_RESTRICTED failure is a problem with the studio's own PayPal account and not the member's; and that a membership PayPal shows cancelled was cancelled on purpose. The manager sends each note from the studio's own email, and decides separately whether to pause class booking for a suspended membership.
Run it on every Monday morning
The studio's booking system sends POST /o/{org}/sessions at 06:30 every Monday with the list of active memberships in input and a request_id that is a UUID v5 of the date, so a retried job starts no second run. The key's webhook delivers run.completed with the result, and the handler reads the artifacts from the session.
A studio with several hundred members can split the list across a few runs of a hundred ids each and send them at once; each run reads only its own subscriptions, and the key's max_concurrent decides how many go together.
The use case this job follows, with its automation and trigger: Draft outreach from your CRM.
Why run it on Rush?
The PayPal sign-in this check needs is the studio's business account, the same one that can refund and cancel. On Rush it stays in one connection rather than in the booking system's database or a script on the owner's laptop, and each run reaches PayPal only through it. The run's record lists every PayPal tool it called, so the owner can see that it only read.
Each Monday's run has its own computer and the cost of its model calls on the session. When a member disputes that they were ever told, the run for that week shows the failure PayPal reported and the note the studio drafted. And the booking system needs no PayPal code of its own: it already knows the subscription ids, and the agent reads the rest.
Frequently asked questions
Why does the booking system have to send the subscription ids?
PayPal's MCP server reads a subscription by its id with show_subscription_details and has no tool that lists them. The booking system stored each id when the member subscribed, so it sends the ones it believes are active, which is also what lets the agent find memberships the two systems disagree on.
Does PayPal keep retrying a failed payment?
PayPal's subscription shows next_payment_retry_time for the last failed payment, and the plan's payment_failure_threshold is how many consecutive failures suspend it. The report shows both, so the studio knows whether a member has days or one retry left.
Could the agent cancel a membership by mistake?
PayPal's server has cancel_subscription and update_subscription, and the business sign-in can use them. The prompt forbids both along with every invoice, order and refund tool, and the run's record shows every call it made.
What about members who pay at the desk or buy class packs?
They have no PayPal subscription, so the booking system leaves them out of the list it sends and the check never reads them. It covers only memberships billed as PayPal subscriptions, which are the ones that can fail without anyone at the studio seeing it.
More PayPal jobs
More jobs like this: Draft outreach from your CRM
- Which Deliverables Are Stuck Waiting on Client Approval? A Marketing Agency's Twice-Weekly ClickUp Check, With a Nudge Drafted per Client (ClickUp)
- Which Estimates Are Still Waiting for an Answer? A Landscaping Company's Monday Follow-Up List From QuickBooks (QuickBooks)
- Which Tax Clients Still Haven't Sent Their Documents? An Accounting Firm's Monday List From Asana, With a Reminder Drafted for Each (Asana)