PayPal Subscription IPN custom_id?

Soldato
Joined
16 Jun 2013
Posts
5,375
I set up a subscription button that used a custom_id generated on my end to track when a payment came through to add to the database. It was the case that the custom_id could be grabbed from the IPN notification using "$_POST["rp_invoice_id"]".

However a few days after confirming it was working on the live account it suddenly stopped sending the custom_id back in the IPN messages but still shows it as the "Custom ID" in the subscription details on the main PayPal website. Doesn't show in IPN sent messages :/

Code Below, If you need any more information I'm happy to provide it.


HTML:
<script src="https://www.paypal.com/sdk/js?client-id=AURxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&vault=tru..." data-sdk-integration-source="button-factory"></script>

<script>

paypal.Buttons({
style: {
shape: 'pill',
color: 'black',
layout: 'vertical',
label: 'subscribe',

},
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': 'P-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'custom_id': "" + params.get('bearer') + "", //Where I set the custom ID to be returned in IPN.
"application_context" : {
"shipping_preference":"NO_SHIPPING"
}
});
},
onApprove: function(data, actions) {
document.getElementById("payment-created").style.display="block";
}
}).render('#paypal-button-container');
</script>

I really hope someone has an answer as to how I'm being an idiot :).
 
Sample IPN messages here suggest rp_invoice_id isn't included in the Payment Made notification. I can't see any official documentation to back that up though.

You’re quite right rp_invoice_id doesn’t appear to show up in the official documentation however when using the custom_id field it would be returned in the ipn under rp_invoice_id.

Honestly most confusing documentation I’ve come across yet :(.
 
That link I posted does document the rp_invoice_id and says it's one of the fields passed with the Profile Cancelled message but not the Payment Made message.

What happens if you try to cancel a subscription? Does the message correctly include the rp_invoice_id in that scenario?
 
Unfortunately it's not appearing within any of the messages, I've tried profile creation, payment, recurring payment, profile cancelled and payment reversed.

None of them contain a custom nor rp_invoice_id. Custom_id shows on paypals side but is never sent back.
 
I guess the other option is to use one of the Paypal generated IDs to link subscribers to payments then? There will be something in the onApprove callback in your javascript code above which gives you an ID I would guess?
 
I'll have a look see if I can grab it that way instead. I had hoped to keep it all server side obviously to stop anyone being a pest. Guess the confirmation is still separate from front end.

Thanks for your time!
 
Looks like I can get it done via webhooks.

In PayPal’s infinite wisdom they culled the custom_id tag returning in the IPN as it was apparently enabled by mistake.....

Thanks for the help @touch :).
 
Back
Top Bottom