How it is built

Every tool in Giftwise, the one job it does, and where it lives in the code. Live status is on the Status page.

Every PayPal API Giftwise calls

13 PayPal APIs and tools, each with one job. All run against the PayPal sandbox. PAYPAL_ENV=live moves the REST API, the JavaScript SDK and PayPal’s MCP server together (src/lib/paypal/env.ts), with the live app’s keys. Each shop then joins through PayPal’s Partner Referrals and is paid by its merchant ID in src/lib/paypal/orders.ts; this sandbox app gets 403 NOT_AUTHORIZED from Partner Referrals until PayPal approves it as a partner, so the demo pays each shop by email address.

All 13 PayPal APIs and tools, with the call and the file for each
PayPalCallWhat it does hereWhere
OAuth 2.0POST /v1/oauth2/tokenOne cached access token for every call below.paypal/client.ts
Orders v2: createPOST /v2/checkout/ordersOne order with a purchase unit and payee for each recipient, through the APIMatic-generated Server SDK.paypal/orders.ts
Orders v2: capturePOST /v2/checkout/orders/{id}/captureCaptures every payee once, with PayPal-Request-Id, so a double click cannot pay twice. Plain REST, so the failure cases can send PayPal's negative-testing header.paypal/capture.ts
Orders v2: showGET /v2/checkout/orders/{id}Check with PayPal now on every receipt, the report check, capture's read back, and the assistant's read when PayPal's MCP server cannot run. Plain REST, so a captured order with several payees reads as PayPal sends it.paypal/orders.ts
Orders v2: confirm payment sourcePOST /v2/checkout/orders/{id}/confirm-payment-sourcePays with a sandbox test card in the failure cases and in the nightly check that pays a gift split across its payees, standing in for the giver.lib/card-check.ts
Payments v2: refundPOST /v2/payments/captures/{id}/refundThe refund failure case: PayPal lets only the shop send money back.cases/scenarios.ts
JavaScript SDK v6web-sdk/v6/coreThe PayPal button on each need and on Give any amount, and PayPal's guest Debit or Credit Card button where the SDK finds it eligible.gift/PayPalPay.tsx
PayoutsPOST /v1/payments/payouts, GET /v1/payments/payouts/{id}A fund pays many households' needs in one batch.paypal/payouts.ts
Transaction SearchGET /v1/reporting/transactionsConfirms each payout in PayPal's own transaction report.paypal/reporting.ts
BalancesGET /v1/reporting/balancesShows the fund's PayPal balance before it sends a batch.paypal/reporting.ts
WebhooksPOST /v1/notifications/verify-webhook-signatureCaptures a payment if the giver never comes back, after checking PayPal's signature.webhook/route.ts
Negative testingPayPal-Mock-Response headerMakes the sandbox decline on purpose, for the failure cases.paypal/capture.ts
PayPal MCP server@paypal/mcp over stdio, tool get_orderReads orders back from PayPal itself, twice: the assistant on /agents reads each checkout it starts before June approves it, and the nightly card check reads every gift it pays to confirm each capture, amount and payee. Giftwise runs PayPal's own server package; PayPal's hosted server is the second choice. If neither answers, the Orders API does, and the page says which one did.agent/paypal-mcp.ts