Forums

Save IPN Return Info to DB

sbsi 02 Nov, 2016
I have been testing the Paypal Redirect / IPN and everything works perfectly (using sandbox mode for now) but I can make payments and receive notifications via IPN. Here is what I am still struggling with :

Before the Paypal Redirect I have a DB Save call so that I have an entry of the dubmitted form with all the Info (created the table using the create table function in Chronoforms Component). I manually added 2 fields to that table payment_status and transaction_id which I want to populate with the information received from the IPN message from Paypal. I read the FAQ at (https://www.chronoengine.com/faqs/57-cfv4/cfv4-actions/2583-how-to-use-the-paypal-redirect-action.html) but a few things don't "jive" :

It states to pass a custom==chronoform_data_cf_id to the Paypal Redirect module in the Extra Params which I did (but used =chronoform_data_id instead since looks like Chronoforms V5 uses "id" as the Primary key of the table rather than "cf_id")
But, custom=xx is not part of the url string I see via the Debug in the Paypal Redirect option. Why ?

What I also don't understand, if the cumtom field would work and retrund as part of the IPN message, how do we configure the DB Save module so that it updates the existing record based on the ID received ? That portion is very unclear to me in the FAQ.

Thanks in advance.
GreyHead 03 Nov, 2016
Hi sbsi,

First, I would change the Primary Key column name in the table from id to cf_id just to remove the possibility of interference from different values of id.

If you have cf_id in the data being returned by the PayPal IPN then a DB Save action should update the record with that value.

Personally I prefer to assign a unique random string to the invoice number and use that to identify the transaction. Then you can use the Conditions box in the DB Save action to identify the record with the matching invoice number to update.

Bob
sbsi 03 Nov, 2016
Ok, the table created by Chronoforms used "id" rather than "cf_id", I can change the field name, but how do I get it's value into the Extra Param of the Paypal Redirect function ... I tried using the unique_id filed (also created by Chronoforms but if I put custom=chronoform_unique_id .... Nothing gets passed to PayPal (but if I try custom="1" it passes it so my guess is that the field name I'm using. Two questions :

What prefix should I be using to get the field values (since choronoform_ does not seem to work)
And when you say use the Condition box in the DB Save, what should be put in there exactly ? PHP Code ? SQL statement ?

Thanks in advance.
GreyHead 03 Nov, 2016
Hi sbsi,

If you add a Debugger action to the form On Submit event drag it up before the PayPal Redirect action, and temporarily add a ShowStopper after the Debugger action (to block the redirection) then you can see all the form variable names.

Please see this FAQ for the Conditions box syntax.

Bob
This topic is locked and no more replies can be posted.