I am working on a Paypal IPN script for notifications.
When creating subcriptions through Paypal, is the 'custom' field returned with each IPN response? eg. when a recurring payment is made.
Yes it is.
Once you verify the IPN, (well actually before as well but always verify first...) the name value pair collection you get will contain all fields that have data, including the "custom" field.
For reference this shows all possible values in a subscriptin IPN
https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside
Related
In Paypal IPN, I have a custom field when I am receiving a txn.type == subscr_payment message that is called option_selection2
(The input name on the html form is called "os1" by PayPal).
On a cancellation or expiration message type, that same field is called option_selection1
Does anyone know what these two fields (or really one field in two different situations) are named in PayPal WebHooks? And any documentation from PayPal that shows these names?
Sorry if this is a stupid question, but I couldn't find these documented.
PayPal Webhooks are for REST payments that use a clientID.
No such integrations have the classic fields you mention. So none of those fields are applicable to webhooks.
Our customers sends their requests for our products via email. Their requests are saved in our database and after we check their requests, we want to send them an email which contains the paypal payment link. To execute this, I am using BMCreateButton method of ButtonManager API of Paypal.
https://developer.paypal.com/docs/classic/api/button-manager/BMCreateButton_API_Operation_NVP/
This method returns EMAILLINK parameter and I am using this parameter in the email to redirect to user to paypal payment page. This method also returns HOSTEDBUTTONID and I am saving this parameter and EMAILLINK parameter to the database to make a relation between the email link(hostedbuttonid) and the user request.
For the payment notifications, I think my only choice is IPN of Paypal. I developed a page to handle the IPN messages from paypal and it works fine but the problem arises when I want to relate between the payment information with the email link that was sent to the customer. I mean I want to know for which request this payment was made. IPN message does not return any information about the HOSTEDBUTTONID. It returns btn_id(different than the HOSTEDBUTTONID), txn_id and ipn_track_id but none of them is useful to relate the customer request( or email sent) with the payment.
Do you have any suggestion about my issue? Or do you think I should use another way for sending the payment email to the user instead of BMCreateButton method of ButtonManager API.
In the BMCreateButton call, where you're setting up the standard PayPal variables for the button, add the CUSTOM parameter. Within that you can pass any value you want (up to 256 char.) and then that same value will come back in the IPN so you can relate it accordingly.
If you have a specific Order ID you could use the INVOICE field instead, and that would come back in IPN as well.
I am creating subscriptions using the PayPal Express Checkout API. What I want to do is add a seller-defined 36 character ID to each subscription that I can later search on.
When sending CreateRecurringPaymentsProfile, I am populating the PROFILEREFERENCE field, which shows up as the 'Invoice Number' on the Recurring Payments dashboard on the seller site.
On the TransactionSearch method, there is an INVMUM field that can be searched, but it doesn't appear this correlates with the 'Invoice Number'.
So...how can I populate the right field so I can use INVNUM to search - or is there a better solution to my problem?
Bruce
I would setup an Instant Payment Notification (IPN) solution. That way any data for transactions will be automatically sent through your script and can be processed accordingly in real-time.
The PROFILEREFERENCE value you're sending will come back in the IPN as invoice_number, so it would be available within your IPN script.
So whatever you're doing within a TransactionSearch script, just do that in IPN instead. Not only will give you access to the value you're after, but it will automate the entire process in real-time so you don't have to mess with TransactionSearch / GetTransactionDetails at all.
I recently converted from basic Paypal payments to Chained Payments...and I have a few questions if you guys would be so kind to help out.
First, when I setup a PayRequest, I also create an order record in the database. Previously with my basic Paypal implementation, I passed that OrderId in the custom field as part of the form post to Paypal. I would then get that OrderId back in the IPN handler and use it to mark the order as paid or whatever based on the response from Paypal IPN.
Now I am wondering what is a good unique value for my locally created order? Should I use the paykey to look up the order on the IPN callback? Or should I just set the trackingId property of the PayRequest to be the order id and pick up in the IPN callback Request object?
Secondly, there is a returnUrl and ipnNotificationUrl for the PayRequest. Should the returnUrl process the IPN callback or does the ipnNotificationUrl only should do that?
The reason why I ask is because the return url must be able to show the buyer the status of their payment and the transaction info, the same data that I get in the IPN callback.
Thanks for the input guys, once I get these two minor details ironed out, I'll be good to go!
I would add your record ID into the tracking ID parameter of the Pay request like you mentioned. That way you'll get it back in your IPN similar to what you're doing with the custom parameter now.
The IPN notification URL is what you want to set in order to trigger IPNs for the Pay request. You do not want to use the same URL for return because then the script would actually run twice.
I have Google for almost 10 hours and it seems a bit unclear.
When I create a "Subscribe" button with my own "notify_url" will PayPal send an IPN to that URL when each recurring payment is made?
Paypal will use the same notify_url that you pass for every recurring payment on that same subscription. An example, may help.
If you pass a notify_url that contains the order id, like:
http://www.mydomain.com/paypal_ipn/{$order_id}
Then when somebody buys a subscription, Order #1, with a recurring payment for $1/day for a month, you will receive IPN data at "http://www.mydomain.com/paypal_ipn/1" for the initial 'txn_type=subscr_signup' and a 'txn_type=subscr_payment' every day until one of the following things occurs:
the user cancels the subscription, at which time you will get a 'txn_type=subscr_canceled'
their credit card expires 'txn_type=subscr_failed'
a month later when the subscription expires 'txn_type=subscr_eot'
On the next order, Order #2, all the IPN calls for that subscription will go to "http://www.mydomain.com/payapl_ipn/2"
Paypal won't store the notify_URL, you need to pass it everytime you send a transaction to paypal for processing. Notify_URL is one of the attributes of the hash; so when paypal receives your transaction hash, it will pick up whatever values you set for each of the attribute and act accordingly. Your understanding is correct!
Just noting that i am also seeing a possibly related problem for echecks where the later clearing ipn is not using the dynamic url that was specified in the originating transaction. First ipn advising pending payment goes to dynamic url
Second ipn advising cleared echeck goes to stored notification url not the dynamic url.
all other instant ipn's are fine and the 2nd ipn is received - but at the wrongurl - can see it in the logs.
any ideas appreciated - pending response from paypal.