11

Strangely the documentation on the Paypal site does not cover this very well.

We have a payment button that redirects to Paypal to process a payment.

We also have an IPN server running that catches paypal payments once they're made.

However, where can we place the "user id" of our system user in the paypal button, so that it will be forwarded to the IPN request in order to match the user up on our system that they have paid. Paypal seems to want people to do this manually, which is a real mission.

4 Answers 4

4

I'm currently doing some PayPal integration and I concur their documentation is a mess!

I finally found a guide somewhere that details which variables of a PayPal button form are forwarded to the IPN callback. You can use the variable item_name to forward a user id:

<input type="hidden" name="item_name" value="{user id}">
3

You should use:

<input type="hidden" name="item_number" value="{user id}">

and here is the documentation:

https://www.paypalobjects.com/IntegrationCenter/ic_std-variable-ref-buy-now.html

3

As said in the doc (https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/)

in your form :

<input type="hidden" name="custom" value="<?php echo $id ?>">

and get it with ipn :

$_POST['custom']
0
0

For anyone trying to get this working for Paypal SmartButtons, you should do something like this:

return actions.order.create({
  purchase_units: [{
       invoice_id: 'your_custom_stuff1',
       custom_id: 'your_custom_stuff2',
       amount: {
         value: '100'
       }
  }]
});

IPN will sent it as POST data, for example in PHP:

$_POST['invoice']; // 'your_custom_stuff1'
$_POST['custom']; // 'your_custom_stuff2'
2
  • How would you do it for an email link? Aug 28, 2022 at 12:22
  • email_id: 'yourEmailHere' then get post data with $_POST['email']
    – TomoMiha
    Aug 31, 2022 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.