How to handle specific PayPal IPN events in server-side processing

I’m working with PayPal standard integration using HTML form submission on my site. My sandbox account has IPN enabled and PayPal is sending notifications to my server successfully.

I need help identifying which IPN fields correspond to these payment events:

  • Payment completed - successful transaction
  • Subscription expired - when subscription period ends
  • Subscription canceled - user cancels recurring payment
  • Chargeback initiated - credit card dispute filed
  • Dispute started - claim process begins
  • Dispute resolved - claim process ends
  • Refund processed - money returned to customer

The PayPal documentation shows many IPN variables but doesn’t clearly explain which ones identify specific events. I think it involves checking payment_status and transaction_id fields but I’m not sure about the exact combinations.

Can someone who has implemented PayPal IPN processing share how to map these events to the correct IPN field values? For instance, I assume completed payments would be identified by payment_status equals ‘Completed’ but what about the other scenarios?

been dealing with paypal ipn for years - ur spot on about payment_status=‘Completed’ for successful payments. for subscriptions, check txn_type: ‘subscr_cancel’ means cancellation, ‘subscr_eot’ means expiration. chargebacks show as payment_status=‘Reversed’, disputes are usually ‘Pending’. refunds come as separate ipns with payment_status=‘Refunded’. always validate the ipn first!

Your approach with payment_status and transaction_id works for most cases. Beyond Maya’s points, I’ve found you need to watch the case_type field along with payment_status for dispute resolution. When disputes go your way, payment_status flips back to ‘Completed’ with a fresh IPN. For chargebacks, check the reason_code field - it tells you what type of dispute you’re dealing with. Here’s something people miss: partial refunds show up as separate transactions with parent_txn_id pointing to the original payment. I’d log all IPN data at first to spot patterns for your setup, since PayPal behaves differently based on your merchant account settings and how customers pay.

Nice setup! Maya nailed the basics, but I’m wondering - are you dealing with recurring billing profiles? Those have their own event types that can be a pain. Also, how do you handle duplicate IPNs for the same transaction? I always check the txn_id to avoid double processing. Is your sandbox acting the same as live?