Repository navigation
PayPal Schemas
github-actions[bot] edited this page Sep 29, 2026
·
1 revision
The @tundraconnect/paypal/schemas subpath exports Guardian validators and
inferred types for every request/response shape this connect uses.
import {
MoneySchemaObject,
OrderSchemaObject,
} from '@tundraconnect/paypal/schemas';
const [error, money] = MoneySchemaObject.safeParse({
currency_code: 'USD',
value: '10.00',
});-
MoneySchema/MoneySchemaObject—{ currency_code, value }.valueis a decimal STRING, never a number ("10.00", or"100"for a zero-decimal currency like JPY) — matchingpattern: "^((-?[0-9]+)|(-?([0-9]+)?[.][0-9]+))$", confirmed against PayPal's published OpenAPI spec.currency_codeis validated as exactly 3 characters (PayPal's own schema doesn't further constrain it — it relies on its supported-currency list to reject anything invalid). -
LinkSchema/LinkSchemaObject—{ href, rel, method? }, a HATEOAS link as returned on every order/capture/refund'slinksarray.
-
AmountBreakdownSchema— optionalitem_total/shipping/handling/tax_total/insurance/shipping_discount/discountsub-totals, each aMoneySchema. -
OrderAmountSchema— a purchase unit's totalamount:MoneySchemaplus an optionalbreakdown. -
ItemSchema— one purchase-unit line item.quantityis a positive-integer STRING matching^[1-9][0-9]{0,9}$(also confirmed against PayPal's spec) — not a number. -
PayeeSchema—{ email_address?, merchant_id? }. -
ApplicationContextSchema—{ brand_name?, return_url?, cancel_url?, user_action? }. -
PurchaseUnitRequestSchema— one purchase unit of acreateOrderrequest. -
CreateOrderRequestSchema/CreateOrderRequestSchemaObject—createOrder's request body:{ intent, purchase_units, application_context?, payer? }. -
CaptureSchema— one captured payment (purchase_units[].payments.captures[]). -
PaymentCollectionSchema—{ captures? }, scoped to captures (this connect doesn't implementauthorizeOrder, soauthorizations/refundsaren't modeled here). -
PurchaseUnitSchema— one purchase unit of an order response. -
OrderSchema/OrderSchemaObject— the response shape forcreateOrder/getOrder/captureOrder:{ id, status, intent?, purchase_units, links, ... }.statusis one of'CREATED'/'SAVED'/'APPROVED'/'VOIDED'/'COMPLETED'/'PAYER_ACTION_REQUIRED'(confirmed against PayPal's spec).
-
RefundRequestSchema/RefundRequestSchemaObject—refundCapture's request body:{ amount?, note_to_payer? }. Omittingamountrequests a full refund. -
RefundSchema/RefundSchemaObject— the response:{ id, status, amount?, note_to_payer?, links? }.statusis one of'CANCELLED'/'FAILED'/'PENDING'/'COMPLETED'.
-
ErrorDetailSchema— one entry of the vendor error envelope'sdetailsarray:{ field?, value?, location?, issue, description? }. -
ErrorEnvelopeSchema/ErrorEnvelopeSchemaObject— PayPal's documented error response body:{ name, message, debug_id, details?, links? }, returned on every 4xx/5xx response. Used internally byPayPal's vendor error mapping — see Errors.
Every object schema accepts unmodeled vendor fields on a response
(.passthrough()) so a field PayPal adds later doesn't break parsing;
request schemas do not, so a typo in a request field is caught locally
rather than silently dropped.