Payment Customization Functions
Apayment_customization function modifies the merchant’s payment-method
list before it renders at checkout. Use it to hide a method conditionally
(e.g. block COD for high-value orders), rename one for clarity, or pin a
preferred method to the top of the radio list.
Runs at both cart verification (preview) and order placement (enforcement)
so a stale frontend can’t bypass a hide op — the backend rejects the
order if a hidden method is submitted.
How It Works
Function Manifest
Input Schema
price and totalPrice are in display currency units, not cents.
totalPrice: 599.99 means ₹599.99 / $599.99.The CLAUDE input is intentionally minimal — no customer, tags,
productType, or vendor is passed. If your rules need that data, look
the customer up via your own backend using the customer email from
verify-cart payload (which your app receives via the App Bridge).Output Schema
paymentMethod (the provider key like "cod") or paymentMethodId
(the UUID) works for all ops. The backend matches against both.
reorder is accepted as an alias for move — both produce the same
result. New code should use move.Operations
hide
Removes the method from the radio list (preview) and rejects the
order if the customer submits it.
"Payment method 'cod' is not available for this order"
rename
Overrides the displayed name. The underlying provider key is unchanged —
charging behaviour is identical, only the radio label is different.
__renamed: true so the
checkout payment list displays methodName instead of the provider’s
built-in label.
move
Sets the index of the method in the radio list. Lower positions render
first.
Examples
Hide COD for high-value orders
Region-based methods
Rename for clarity, pin preferred
How it renders in the UI
paymentMethodsin the verified-cart response — filtered list (afterhide)- Each plan carries
__renamed: true+methodNamewhen a rename op fired.
Best Practices
Never hide every method
Never hide every method
The backend doesn’t auto-recover — if all methods are hidden, the
customer literally can’t pay. Always leave at least one method
available for any reachable cart state.
Match by provider key, not UUID
Match by provider key, not UUID
Provider UUIDs differ per store.
paymentMethod: 'cod' is portable
across installs; paymentMethodId: '<uuid>' is not.Test against the real checkout
Test against the real checkout
Drive
/checkout with Puppeteer and screenshot the payment radio.
JSON-only tests don’t catch the __renamed flag wiring; only the
rendered label does.Keep customizations idempotent
Keep customizations idempotent
Functions re-run on every cart change. Always derive ops from the
current cart + config, not from cached state.
See Also
- Delivery Customization Functions — same operations applied to shipping zones.
- Order Validation Functions — block the order outright instead of just hiding a method.