Hi, I have purchased the Chronoforms Paypal Action subscription and have looked at the faq How to use the Paypal Redirect Action, but my form has a free element and an optional paid element, so I would like to make paypal conditional on the amount. I can code php no problem, but I don't see a way to put an "if" into the Form Submit action for Paypal so it only submits to paypal if the amount is > 0.
Also, the user can purchase up to 3 items simultaneously. I'm anticipating using the Pro version of the gateway to do this so each item can show up separately, be totalled up and the user makes one payment. The faq I mentioned only describes how to enter one item ID. Will I receive more detailed documentation now I have bought the subscription?
Thanks
Brian
Also, the user can purchase up to 3 items simultaneously. I'm anticipating using the Pro version of the gateway to do this so each item can show up separately, be totalled up and the user makes one payment. The faq I mentioned only describes how to enter one item ID. Will I receive more detailed documentation now I have bought the subscription?
Thanks
Brian
OK, I've figured out I can do a custom serverside validation to decide whether to send to paypal or not. :-)
For the multiple items, I've added the cost of the separate items together inside a custom code and created an item name that includes all the separate items in one line. It will do for our purposes. :-)
For the multiple items, I've added the cost of the separate items together inside a custom code and created an item name that includes all the separate items in one line. It will do for our purposes. :-)
Many thanks. I figured that bit out ok :-)
It would seem that the DBSave and the email functionality of the IPN Faq that I quoted in my original post could only work if the column names in the form match those returned by Paypal. Since the variable names used by Paypal are not fully documented in that faq, the chances of getting it working without a lot of effort are very slim. Although there is facility to match the outgoing paypal request variables to form variables, there is some code missing in the IPN handler which translates the variables returned by paypal back to those same form variables and thus to field names stored in the database. Implementing the IPN as documented in the FAQ results in an email containing data such as {forename} etc rather than the values actually returned.
There is a way as I see it to make the FAQ better. For IPN to work and for the DBSave to actually store a record with more than just the date and time and first_name in it, the original form variables for anything you send paypal should match paypal's variable names. For example, to get the forename and surname to work, you must call your form variables first_name and last_name and nothing different. If you are doing a DBSave before sending off the paypal request, you also need to write custom code to update the saved record when the confirmation comes back from Paypal by IPN.
Rather than changing the FAQ, I think this could be fixed by updating the Paypal Redirect (full) code so that a unique ID is passed to paypal (cf_uid would seem to fit the bill as documented in a separate un-linked FAQ), and that on receiving the IPN, the variables are matched back to form variables (using the data already entered in the Paypal redirect plugin's "Fields" parameter section) and the record matching the unique ID is updated to a status of "paid" (or whatever). This would save everybody re-inventing the wheel as it were. Also, rather than hardcoding the IPN Notification in your Paypal account as the FAQ says to do, you should set the extra variable notify_url to the URL of your form (in the format the FAQ says). The plugin could easily be made to do that as it knows its own address already, requiring only the addition of the "&event=ipn". Hardcoding it at the Paypal end means you can only have one Paypal-enabled form on your site. I do appreciate that those who have already hardcoded their notify_url may need to tweak their code if they ever update this plugin but the release notes could cover that. :-)
I hope these observations are helpful and constructive. :-)
Brian
It would seem that the DBSave and the email functionality of the IPN Faq that I quoted in my original post could only work if the column names in the form match those returned by Paypal. Since the variable names used by Paypal are not fully documented in that faq, the chances of getting it working without a lot of effort are very slim. Although there is facility to match the outgoing paypal request variables to form variables, there is some code missing in the IPN handler which translates the variables returned by paypal back to those same form variables and thus to field names stored in the database. Implementing the IPN as documented in the FAQ results in an email containing data such as {forename} etc rather than the values actually returned.
There is a way as I see it to make the FAQ better. For IPN to work and for the DBSave to actually store a record with more than just the date and time and first_name in it, the original form variables for anything you send paypal should match paypal's variable names. For example, to get the forename and surname to work, you must call your form variables first_name and last_name and nothing different. If you are doing a DBSave before sending off the paypal request, you also need to write custom code to update the saved record when the confirmation comes back from Paypal by IPN.
Rather than changing the FAQ, I think this could be fixed by updating the Paypal Redirect (full) code so that a unique ID is passed to paypal (cf_uid would seem to fit the bill as documented in a separate un-linked FAQ), and that on receiving the IPN, the variables are matched back to form variables (using the data already entered in the Paypal redirect plugin's "Fields" parameter section) and the record matching the unique ID is updated to a status of "paid" (or whatever). This would save everybody re-inventing the wheel as it were. Also, rather than hardcoding the IPN Notification in your Paypal account as the FAQ says to do, you should set the extra variable notify_url to the URL of your form (in the format the FAQ says). The plugin could easily be made to do that as it knows its own address already, requiring only the addition of the "&event=ipn". Hardcoding it at the Paypal end means you can only have one Paypal-enabled form on your site. I do appreciate that those who have already hardcoded their notify_url may need to tweak their code if they ever update this plugin but the release notes could cover that. :-)
I hope these observations are helpful and constructive. :-)
Brian
Hi Brian,
Thanks for the observations. I've never really used the PayPal IPN action (I have written my own code to do this when I needed it). I agree with you about the need to add a unique ID, I do that in my Mollie action; I also use a second table to save the large amount of data that PayPal returns. (The PayPal parameter names are in their docs, or can be found by dumping the reply.)
I'd also suggest that the action should optionally enable Joomla! logging as it is hard to track hand-shake transactions that have no link to the browser.
Bob
Thanks for the observations. I've never really used the PayPal IPN action (I have written my own code to do this when I needed it). I agree with you about the need to add a unique ID, I do that in my Mollie action; I also use a second table to save the large amount of data that PayPal returns. (The PayPal parameter names are in their docs, or can be found by dumping the reply.)
I'd also suggest that the action should optionally enable Joomla! logging as it is hard to track hand-shake transactions that have no link to the browser.
Bob
Hello Bob,
Yes. I now have it working tickety-boo. :-)
I have used your excellent GH Unique ID action. I pass the unique ID in the "custom" parameter to Paypal. When ipn returns, I use the DBLoad action to load back in the previously saved record using the returned custom value as the key. Once loaded, I can update the status column to "paid" (I include the amount and currency too) and simply DBSave the record again - it updates the same record.
I like your suggestion to save the full data returned from Paypal in a separate table. It can be saved using the same unique key.
Wonderful stuff! :-)
Brian
Yes. I now have it working tickety-boo. :-)
I have used your excellent GH Unique ID action. I pass the unique ID in the "custom" parameter to Paypal. When ipn returns, I use the DBLoad action to load back in the previously saved record using the returned custom value as the key. Once loaded, I can update the status column to "paid" (I include the amount and currency too) and simply DBSave the record again - it updates the same record.
I like your suggestion to save the full data returned from Paypal in a separate table. It can be saved using the same unique key.
Wonderful stuff! :-)
Brian
This topic is locked and no more replies can be posted.