Mitya
Mitya

Reputation: 34556

PayPal IPN: differentiating successful payment response from unsuccessful

I'm painfully trying to get going with PayPal's IPN system. Via the Sandbox, I've got it processind payments and sending notifications to my IPN listener.

Question: what in the response denotes that the payment was succesful? verify_sign looks promising, but then payer_status says unverified, which is less so. What would this look like if paymeny had failed?

Example response on success (truncated for brevity):

{
    "txn_type": "subscr_signup",
    "subscr_id": "I-X5CCUV52M245",
    "option_selection1": "Some Product",
    "residence_country": "GB",
    "mc_currency": "GBP",
    "item_name": "My Project",
    "recurring": "1",
    "verify_sign": "AxQ2151HawsltpX50Ic0ERjMvTm2AKxR9ZhaRWhY2vsawH.ST73m1oWR",
    "payer_status": "unverified",
    "test_ipn": "1",
    "payer_email": "[email protected]",
    "payer_id": "88F6NGLATYQ3S",
    "option_name1": "Subscription options",
    "reattempt": "1",
    "item_number": "1",
    "subscr_date": "11:23:05 May 24, 2016 PDT",
    "period1": "2 D",
    "mc_amount1": "0.00",
    "period3": "1 Y",
    "mc_amount3": "10.00",
    "ipn_track_id": "1d86661393869"
}

I'm unsure how to mimick a failed payment (e.g. legitimate card details but not enough funds in the account) via the Sandbox (since it's all pretend day) so I don't have anything to compare to.

Upvotes: 0

Views: 104

Answers (1)

user207421
user207421

Reputation: 310915

This is not a payment. It is a signup. All you should do when receiving this message is register the user. You will get another transaction for the payment. Until you do, don't give the new user the permissions concerned, or the product, or whatever it is you're selling.

Note that you can get the payment before or after the signup.

Upvotes: 1

Related Questions