Hi All, I have been configuring a monthly subscription Paypal IPN to collect monthly recurring payments from a membership website.

I have my annual IPN working great. Just strugling with the monthly recurring payments.

I have the following configured in my subscription button

     <input type="hidden" name="a1" value="' . $price . '">
     <input type="hidden" name="p1" value="1"> 
     <input type="hidden" name="t1" value="M">  
     <input type="hidden" name="a2" value="' . $pricem1 . '">  
     <input type="hidden" name="p2" value="1">  
     <input type="hidden" name="t2" value="M">
     <input type="hidden" name="a3" value="' . $pricemthly . '">  
     <input type="hidden" name="p3" value="12">  
     <input type="hidden" name="t3" value="M">
     <input type="hidden" name="src" value="1">
     <input type="hidden" name="sra" value="1">  
     <input type="hidden" name="lc" value="US">
     <input type="hidden" name="currency_code" value="USD">

basically, the first month is free, second month is 50% off and every other month afterwards is the full price of the subscription.

What I am getting confused about is what variable names paypal send me back.
Are the variables the same name as above so I can update my database.
or do they have different names like here

Hope someone can help point me in the right direction.
Cheers

Dani AI

Generated

Short answer: the names you send in the subscription button (a1, p1, t1, a2, a3, src, sra, etc.) are the button parameters, but the IPN posts back different, documented names — for example a1/a2/a3 appear in IPN as amount1/amount2/amount3 (and in multi‑currency posts as mc_amount1/mc_amount2/mc_amount3), while p1 + t1 are returned together as period1 with a value like 1 M. Also the src/sra button flags map to the IPN subscription fields (you’ll see recurring, reattempt, retry_at and related subscription fields). See PayPal’s IPN variable reference for the exact names and when each one is sent. (developer.paypal.com)

Subscription flows generate different txn_type messages (for example subscr_signup, subscr_payment, subscr_failed, subscr_cancel, and the newer recurring_payment* set). Handle each txn_type explicitly: use subscr_id for subscr_* events and recurring_payment_id for recurring_payment* events, check payment_status for actual money movement, and always save txn_id to prevent duplicate processing. was right to point you back to the docs — they list these exact fields and examples. (developer.paypal.com)

Always verify IPN before acting on it: echo the exact POST back to PayPal with cmd=_notify-validate to the IPN verification endpoint (live vs sandbox), confirm receiver_email/business is your account, and validate the amount + currency. A minimal PHP listener pattern (verification + mapping then DB save) is the right workflow — log the raw POST for debugging and only update membership on VERIFIED + correct txn_type/payment_status. (developer.paypal.com)

Testing tips: use the IPN simulator / sandbox and watch for the test_ipn flag, log everything (raw POST, verification response), and test the trial cases you described (first‑month free, second‑month discounted) — PayPal will post the trial amounts as amount1/amount2 and the regular price as amount3 (or mc_ equivalents). If you hit unexpected txn_type names in live vs. sandbox, log them and handle both subscr_ and recurring_payment_ families. (developer.paypal.com)

Sample references:

Member Avatar for Member #949455

What I am getting confused about is what variable names paypal send me back.
Are the variables the same name as above so I can update my database.

The variable should look like this:

https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside

This has an example on how this works.

You only have to create a table on your database by using those variables:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.