NoWar
NoWar

Reputation: 37652

How to pass custom data via PayPal IPN

I use following code for the RETURN URL.

 @foreach (var item in Model)
                    {
                        <form action='@item.PayPalURL2 ' method='post'>
                            <input type='hidden' name='cmd' value='_xclick' />
                            <input type='hidden' name='business' value='@item.BusinessEmail' />
                            <input name='item_name' value='@item.Name' class="ppField" readonly="readonly"/>
                            <input type='hidden' name='item_number'  value='@item.ID' />
                            <input name='amount' value='@item.Price2' class="ppField" readonly="readonly"/>
                            <input type='hidden' name='return' value='@item.ReturnURL' />
                            <input type='hidden' name='custom' value='@item.UserID' />
                            <input type='submit' value='Buy' />
                        </form>
                    }

Any clue how to pass custom filed to IPN message and get it via Listener?

Thank you!!!

Upvotes: 0

Views: 661

Answers (1)

Drew Angell
Drew Angell

Reputation: 26056

You've already got the "custom" field included in your form. Whatever value you have in @item.UserID will be getting sent along with the payment and will come back as a POST value called "custom" within your IPN solution.

So, it looks like you're already got what you need. You just need to make sure $item.UserID actually contains what you expect it to contain, and that you're looking for the custom field in your IPN listener.

Upvotes: 4

Related Questions