Overview
Customer synchronization ensures that customers exist in both Flexprice and Razorpay with linked identifiers, enabling:- On-demand sync: Customers are synced to Razorpay only when needed for payments
- Payment link creation for any Flexprice customer
- Invoice sync to Razorpay
- Consistent customer data across platforms
- Efficient payment processing workflows
- Creating payment links
- Syncing invoices to Razorpay
Synchronization Flow
Customer sync works on-demand and is one-way only (Flexprice → Razorpay):Key Concepts
- One-Way Sync: Customers are synced from Flexprice to Razorpay only (not bidirectional)
- On-Demand Sync: Customers are synced to Razorpay only when payment interactions occur
- Sync Triggers: Sync happens automatically when creating payment links or syncing invoices
- Entity Integration Mapping: Links Flexprice customers to Razorpay customer IDs
- Notes Storage: Customer notes store cross-platform references for linking
- Duplicate Prevention: Intelligent checks prevent duplicate customer creation in Razorpay
- Performance Optimization: No unnecessary syncs for customers who never make payments
Customer Data Model
Flexprice Customer Structure
Sync Configuration
Required Fields for Sync
| Field | Flexprice → Razorpay | Notes |
|---|---|---|
name | ✅ | Customer full name |
email | ✅ | Primary email address |
Sync Process Details
On-Demand Sync Flow (Payment-Triggered)
Customer Linking
Notes Storage
Customer linking is maintained through notes fields: In Flexprice Customer:Error Handling
Common Sync Errors
| Error | Cause | Resolution |
|---|---|---|
| ”Customer not found” | Invalid customer ID | Verify customer exists |
| ”Email already exists” | Duplicate email in Razorpay | Check for existing customer |
| ”Invalid email format” | Malformed email address | Fix email format |
| ”Razorpay API error” | Razorpay connection issue | Check Razorpay credentials |
Sync Failure Recovery
When sync fails:- Log Error: Record failure with details
- Retry Logic: Automatic retry with exponential backoff
- Manual Intervention: Admin can retry failed syncs
- Notification: Alert on persistent failures
Testing Customer Sync
Test Environment Setup
- Test Razorpay Account: Use Razorpay test mode
- Test Customers: Create test customers in Flexprice only
- Webhook Testing: Use ngrok for local webhook testing
On-Demand Sync Testing Flow
- Create Test Customer: Add customer in Flexprice (no sync yet)
- Verify No Sync: Customer should NOT exist in Razorpay initially
- Create Payment Link: Trigger payment link creation
- Verify Auto-Sync: Customer should now exist in Razorpay
- Test Invoice Sync: Sync invoice with same customer
- Verify Reuse: Should use existing Razorpay customer (no duplicate)

