Skip to main content

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

Common Patterns

Show/hide payment methods based on order total:
Prompt Example:
Different payment methods for different customers:
Prompt Example:
Payment restrictions based on cart contents:
Prompt Example:
Different payment options by shipping address:
Prompt Example:

Operation Types

Payment customization functions support three operations:
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

  1. Add items to cart
  2. Go to checkout
  3. Proceed to payment methods
  4. Verify correct methods appear
2

Test Different Scenarios

  • Different cart values
  • Various customer types
  • Multiple product combinations
  • Different shipping addresses
3

Check Function Logs

View function input/output
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

Example Prompts

Troubleshooting

Cause: Function hiding all payment methodsSolution: Add safeguard to ensure at least one method remains visible
Cause: Name matching logic incorrectSolution: Check exact payment method name, use contains() or regex
Cause: Function not activatedSolution: Payment functions activate automatically on deployment, check logs

Next Steps

Shipping Customization

Customize shipping rates and options

Discount Functions

Create custom discount logic

Functions Overview

Learn about all function types

Debugging

Debug and optimize functions