Overview
Payment Customization Functions let you show, hide, or reorder payment methods based on cart contents, customer data, or other conditions.Use Cases
Hide Payment Methods
Remove options based on conditions
- Hide COD for high-value orders
- Remove Buy Now Pay Later for B2B
- Restrict payment by location
Reorder Methods
Change payment method order
- Promote preferred methods
- Push expensive methods down
- Prioritize by customer segment
Rename Methods
Customize payment method names
- Add processing fees
- Show savings
- Clarify payment terms
Conditional Display
Complex payment logic
- VIP payment methods
- Location-based options
- Cart value restrictions
How It Works
1
Checkout Loads
Customer reaches payment method selection in checkout
2
Function Executes
Your function receives cart data and available payment methods
3
Methods Customized
Function returns which methods to show/hide and their order
4
Checkout Updates
Payment method list updates based on function output
Example: Hide COD for High-Value Orders
Generate a function that hides cash on delivery for expensive orders:1
Describe Your Function
2
Review Generated Code
Synapse creates:
- Function logic (Rust or JavaScript)
- Input query for cart and payment data
- Customization rules
- Configuration
3
Deploy & Test
- Automatic validation
- Deployed to dev store
- Test with different cart totals
4
Activate Function
Payment functions are automatically active once deployed
Generated Function Structure
Function Code Examples
- Hide COD (Rust)
- Reorder Methods (JavaScript)
- Rename Method
- Input Query
Common Patterns
Cart Value Restrictions
Cart Value Restrictions
Show/hide payment methods based on order total:Prompt Example:
Customer Segment Restrictions
Customer Segment Restrictions
Different payment methods for different customers:Prompt Example:
Product-Based Restrictions
Product-Based Restrictions
Payment restrictions based on cart contents:Prompt Example:
Location-Based Restrictions
Location-Based Restrictions
Different payment options by shipping address:Prompt Example:
Operation Types
Payment customization functions support three operations:- Hide
- Move
- Rename
Remove a payment method from the list:Use when:
- Payment method not allowed
- Condition not met
- Customer segment restriction
Testing Payment Functions
1
Test in Checkout
- Add items to cart
- Go to checkout
- Proceed to payment methods
- Verify correct methods appear
2
Test Different Scenarios
- Different cart values
- Various customer types
- Multiple product combinations
- Different shipping addresses
3
Check Function Logs
4
Verify Performance
- Functions should execute in under 5ms
- Test with many payment methods
- Check with large carts
Best Practices
Always Show Some Method
Never hide all payment methods
Clear Naming
Make renamed methods descriptive
Fallback Logic
Handle missing data gracefully
Performance
Keep functions fast
- Minimize iterations
- Use Rust for speed
- Cache calculations
- Limit query surface
Advanced Examples
Dynamic Fee Display
Dynamic Fee Display
Prioritize by Customer Tier
Prioritize by Customer Tier
Multi-Condition Logic
Multi-Condition Logic
Example Prompts
Hide COD for International
Hide COD for International
VIP Express Priority
VIP Express Priority
Show Processing Fees
Show Processing Fees
Subscription Restrictions
Subscription Restrictions
Troubleshooting
All Methods Disappeared
All Methods Disappeared
Cause: Function hiding all payment methodsSolution: Add safeguard to ensure at least one method remains visible
Method Not Hiding
Method Not Hiding
Cause: Name matching logic incorrectSolution: Check exact payment method name, use contains() or regex
Function Not Running
Function Not Running
Cause: Function not activatedSolution: Payment functions activate automatically on deployment, check logs