Skip to content
WooCommerce WooCommerce

Payment Complete → Update Customer Metadata

Automatically update WooCommerce customer data when payments are confirmed. Perfect for tracking purchase stats, loyalty programs, and customer segmentation.

intermediate 10 minutes |
#payment #customers #metadata #woocommerce #tracking

Use Case

When payment is confirmed, you want to immediately update customer metadata. This captures purchase data at the moment of payment for real-time tracking and segmentation.

Common scenarios:

  • Record payment date for RFM analysis
  • Update loyalty points balance
  • Track payment method preferences
  • Flag as paying customer
  • Store purchase milestone data

Step-by-Step Setup

1. Create a New Workflow

Navigate to Sequensy → Workflows in your WordPress admin and click Add New Workflow.

Name your workflow “Track Payment on Completion” or “Real-Time Customer Stats”.

2. Configure the Trigger

Select Payment Complete as your trigger.

Available filters:

  • Payment Method: Track by gateway used
  • Order Total: Different handling by amount
  • Products: Track product-specific purchases
  • First Order: Flag new vs returning

3. Set Up the Update Customer Metadata Action

Configure the metadata update:

SettingExample ValueDescription
Customer{customer_id}Target customer
Meta Keylast_payment_dateField to update
Meta Value{current_date}Current timestamp
Update TypeReplaceOverwrite value

4. Track Multiple Fields

Create workflows for each metric:

Meta KeyValuePurpose
last_payment_date{current_date}Recency tracking
total_payments{increment}Frequency count
lifetime_paid{add_amount}Monetary value
preferred_payment{payment_method}Preference
is_paying_customertrueCustomer flag

5. Test Your Workflow

  1. Enable the workflow
  2. Complete a test purchase
  3. Check customer metadata updated
  4. Verify timing (immediately on payment)
  5. Test with different payment methods

Pro Tips

Payment vs Order Completion: Payment Complete triggers immediately when payment clears. Order Completed triggers when fulfilled. Choose based on what you’re tracking.

Real-time analytics: Use payment-triggered metadata for live dashboards and instant segmentation.

Payment method tracking: Understanding payment preferences helps optimize checkout.

First purchase flagging: Identify new customers instantly for immediate follow-up.

Metadata Examples

Payment Tracking

Meta Key: _last_payment_timestamp
Value: 1704067200

Meta Key: _total_successful_payments
Value: 12

Meta Key: _total_amount_paid
Value: 1,250.00

Meta Key: _average_payment_amount
Value: 104.17

Loyalty Integration

Meta Key: _loyalty_points_balance
Value: 500 (updated: +{order_total_points})

Meta Key: _points_earned_this_month
Value: 150

Meta Key: _tier_progress
Value: 75% to Gold

Customer Flags

Meta Key: _is_verified_buyer
Value: true

Meta Key: _first_payment_date
Value: 2024-01-15

Meta Key: _has_completed_payment
Value: yes

Meta Key: _payment_risk_score
Value: low

Segmentation Use Cases

Payment-Based Segments

SegmentMetadata Query
New Buyersfirst_payment_date within 7 days
Regular Payerstotal_payments > 3
High Valuetotal_amount_paid > $500
Credit Card Userspreferred_payment = card
PayPal Userspreferred_payment = paypal

Marketing Automation

Condition: total_payments = 3
Action: Send "Loyal Customer" email
Offer: Exclusive 15% discount

Condition: first_payment_date = today
Action: Start welcome sequence
Trigger: Onboarding emails

Payment Method Tracking

Recording Preferences

Trigger: Payment Complete
Action: Update _payment_methods_used array
Value: Add {payment_method} to list

Over time, see:
["credit_card", "credit_card", "paypal", "credit_card"]
Most used: credit_card (75%)

Analyzing Behavior

CustomerPrimary MethodInsight
JohnPayPalDigital-first buyer
SarahCredit CardTraditional payment
MikeApple PayMobile shopper
LisaInvoiceB2B customer

Integration Ideas

Real-Time Dashboard

Update metadata that feeds live dashboards:

  • Total revenue today
  • New customers this hour
  • Average order value trend

Email Segmentation

Create segments based on:

  • Payment frequency
  • Preferred payment method
  • Lifetime value tier
  • Days since last payment

Troubleshooting

Metadata not updating?

  • Verify payment actually completed
  • Check customer ID mapping
  • Review meta key spelling

Wrong values stored?

  • Check calculation formulas
  • Verify merge tag format
  • Review data types

Can’t query metadata?

  • Check meta key prefix
  • Verify data is in user meta table
  • Use correct query methods