Paypal Listener

Update a database field after a PayPal payment using ChronoForms.

Overview

The issue occurred because the custom code in the PayPal Listener's Onverified event did not correctly reference the data model ID for the cf_id field, causing a new database row to be created instead of updating the existing record.
Ensure the custom code includes the correct data model ID when setting the cf_id value before the DB save action, so the listener updates the intended existing row.

Answered
fa faros 25 Sep, 2014
Hi And thanks for this great component

I'm using the paypal redirect action and the Paypal Listener following what is explained in this http://www.chronoengine.com/faqs/57-cfv4/cfv4-actions/2583-how-to-use-the-paypal-redirect-action.html

I have a form which is used by chronoconnectivity to edit a record and in this form I' using the Paypal redirect to process a payment and the paypal linstener to send email on success and to update a field of my table.

Every thing works fine (I receive the emails) but the updating of the field,
In the ipn event under "Onverified" status of Paypal Listener I put a custom code with this inside:
<?php $form->data["cf_id"] = $form->data["custom"];
$form->data["RichiestaConsulenza"]["status"] = "Pagata" ?>

and after I put a db save, but it dont work

What is wrong? the "status" is never changed to "Pagata"

Thanks for your help
Fabrizio
Gr GreyHead 25 Sep, 2014
Hi Fabrizio,

Where does $form->data['custom'] come from? Is that a value returned by PayPal. Are you sure that it is in the $form->data array?

Bob
fa faros 02 Oct, 2014
Hi Bob and thnks for you reply
at a more deeper look the status = Pagata is written in the db but on a new table row, so it mean that there is a problem with the cf_id but I cannot understand Where.
I set in the Paypal Redirect (in extra field) "custom=richiestaconsulenza_cf_id"
than in the paypal listener Osuccess Status I insert a Custom Code With this code inside:
<?php $form->data["cf_id"] = $form->data["custom"];
$form->data["richiestaconsulenza"]["status"] = "Pagata" ?>
Than a Db save action with this model ID: richiestaconsulenza

Thanks for you help
fa faros 02 Oct, 2014
Answer
Ok I found the error
it was in the custom code before the dbsave, where I wrote: <?php $form->data["cf_id"] = $form->data["custom"];
$form->data["richiestaconsulenza"]["status"] = "Pagata" ?>

Forgetting to add the data model ID
<?php $form->data["RichiestaConsulenza"]["cf_id"] = $form->data["custom"];
$form->data["richiestaconsulenza"]["status"] = "Pagata" ?>

Thanks a lot :-))
This topic is locked and no more replies can be posted.