• A new version of Full Calendar is now available.

    See the details here

Paypal Form Plugin And IPN

Status
Not open for further replies.

startpoint

Active Member
Hi,
I read tutorial about Paypal plugin and put in tab After Payment ->or Return Message ->[show_all].

After payment i see only 'thanks' on page.
No paypal placeholders.
In my paypal account receive IPN messages is enabled. For Notification url I use main website url.

What else should I do to make it work?
 
It's pretty much impossible to give you detailed support for the PayPal plugin as part of Standard support, as it's a complex plugin, with a lot of options that are very dependent on your exact usage.

But I just recorded a quick overview of my simple test case, which should point you in the right direction. It's important to use the PayPal developer sandbox when testing, and I'm assuming that's what you are doing.

http://screencast.com/t/brqNODr3tvy

-- hugh
 
Thank you Hugh for your video.
I followed your steps and tried several times, but without success.
Finally I deleted the list, I created it again and only then work.
Will certainly be useful for the future.

Regards
 
With the custom IPN class. There's and example in the scripts folder in the plugin. It allows you to execute your own code on any of the IPN callbacks from PayPal, like complete, reversed, etc.

-- hugh
 
I create this custom code in paypal php file
PHP:
    function payment_status_Completed($listModel, $request, &$set_list, &$err_msg) {
   
        $item_id = ["table_name___item_id"]
       
        $pp_status = JFactory::getDBO();
        $pp_status -> setQuery("UPDATE tablename_items SET status = '3' WHERE id = '$item_id'");
        $pp_status->query();
        return 'ok';
    }

In my form I have this 'item_id' value, but apparently in this way not charged and tablename_items not updated.
How should I change the code?
 
Hmm, yeah, you can't just make up PHP syntax and hope it will work. :)

Your form elements / values aren't magically included during IPN processing. Typically we would read the form data in for you in something like this, but with PayPal IPN processing, you want to keep processing time to the minimum, and hand a response back to PayPal as quick as you can.

So you have two choices. One is to read the form data in from the database during your IPN processing, but as explained ^^ there, that's a slow database operation you should avoid if possible.

The other option is to include any data you are going to want to use during your IPN handling, in the "IPN Custom Value" field in the main plugin settings. Which is what it's for. Anything you put in there gets sent to PayPal with the payment request, and PayPal then just send it back in the IPN response. So you can associate any of your specific app data with a payment request, for use in the IPN response(s).

So ... in your "IPN Custom Value", put the {tablename___item_id_raw} placeholder, and select a filed to use as the IPN Custom Element. If necessary, create a simple field element for it. Let's assume it's called yourtable___ipn_custom.

Then in your script ...

PHP:
      function payment_status_Completed($listModel, $request, &$set_list, &$err_msg) {
        $item_id = $set_list['ipn_custom'];
        $pp_db = JFactory::getDbo();
        $pp_query = $pp_db->getQuery(true);
        $pp_query->update('tablename_items')->set("status = '3'")->where('id = ' . $pp_db->quote($item_id));
        $pp_db->setQuery($pp_query);
        $pp_db->execute();
        return 'ok';
      }

-- hugh
 
Also note that if you have anything you want to set in the form's main table, you can do that by adding to the $set_list. The $set_list is an array of field names we are going to update in your form's table, like the txn ID, IPN status, etc, at the end of our IPN handling. So if you wanted to set something else, you can just add it to the $set_list thusly ...

Code:
$set_list['some_other_field_name'] = "whatever";

Note the array uses short (table column) names, rather than Fabrik's full (table___element) names. So no tablename___ prefix.

-- hugh
 
Status
Not open for further replies.

Members online

No members online now.
Back
Top