Forums

Unable to pass price (amount) value to PayPal Redirect

artsapiens 29 Mar, 2018
Hi all!

I'm really stuck. I've read probably all related posts here on forum, installed demo form with PayPal and I'm sure that I've done everything right. But it's just doesn't work.

I calculate amount to be paid in php part of form, and I'm passing value from php to form like this (Chronoform6):
$this->data[total_to_pay] = (int)$to_pay;
In debugger I see this value between others, so the variable/value is there:
 [total_to_pay] => 100
I insert following line
{data:total_to_pay}
to PayPal Redirect "amount" field, just like in demo form is done.

But whatever I try, Paypal shows empty field for amount. This amount just not present. I checked with "debug" enabled, and I see that "amount" variable is not in URL-get quiery..

Both Chronoforms and Paypal plugin are validated for domain. Paypal in Sandbox testing mode, but I'm sure this should not affect, because when I put plain numbers to "amount" field, everything works as supposed to.

PLease, help! I need to complete this ASAP!
artsapiens 30 Mar, 2018
I decided to test with Demo form as well, just added there a line of php code that adds data:total value, and I have same problem. screenshots and backup of the form attached. I'm afraid that it looks more like bug, not that I'm doing something wrong %((

Please, help!.





​[file=10311]Test_PayPal_30_Mar_2018_10_42_12.cf6bak[/file]
Max_admin 30 Mar, 2018
Hi artsapiens,

You are using "total" or "total_to_pay" ? please try to enter "100" in the amount field in the PayPal settings, does it work that way ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
artsapiens 30 Mar, 2018
Hi Max!

In my form I used "total_to_pay" (first post). In your demo the value it waits for - "total". There is no mistake there. When I put plain number like 100, or keep default expression like "/100" the number passed to Paypal accordingly. (Actually, same story about "quantity" field - it works with plain numbers or default value, but doesn't pick the value from form's "data:".
Max_admin 30 Mar, 2018
So the demo form does not pass the correct value without any changes ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
artsapiens 30 Mar, 2018
If you install demo as it's provided with clean install on Chronoforms, there is NO "total" value. But in "amount" field there is expression "{data:total/3}", which means that "3" is set as default value. So it passes 3 (+/-1 because of randomizer, i suppose) every time. What I've also tried - I've changed "amount" expression to {data:zip}. Yes, to send value directly from forms field named "zip". No luck either %(.
Max_admin 30 Mar, 2018
There is no randomizer in v6 actions, it will send to the sandbox if not validated, please try to use an existing field name, and provide an integer value in the field: 10, and use {data:field_name} in the amount setting, it does not work ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
artsapiens 31 Mar, 2018
I don't know what changed overnight, but today paypal sandbox seems differently, it doesn't show any purchase details whatever I do, just offering me to log in (login doesn't work either, probably because it's sandbox), (compare new screenshot to old one)

So, I had to switch to live mode and test:

1: using demo paypal as is, not sending any data to it, "quantity" field = {data:quantity/1}, "amount" = {data:total/3}
Result - 4
(why not 3?)

2: providig INTs via on load:
$qty=1;$tot=99;$this->data[total] = (int)$tot;$this->data[quantity] = (int)$qty;

"quantity" field = {data:quantity}, "amount" = {data:total}
Result - no "amount to pay" information on Paypal

3: manually set plain numbers "quantity" field = 1, "amount" = 5
Result - 6
(Why not 5?)

It feels like I'm the first one to use this plugin ever - why it works THAT weird with numbers? Why it doesn't take form data? Did you ever test it by yourself?
Max_admin 04 Apr, 2018
Hi artsapiens,

Ok, I have just tested this on a live purchase with no problems, you can test it on sandbox but you will need a PayPal sandbox account.

I create a new form, in the PayPal settings, eneered the business email, item name and number, payment type is "single checkout", amount: {data:total}

add a button and a text field to my designer, text field name set to "total".

Save the form, preview, enter 9 in the text field and submit the form, that should take you to PayPal where you should have the amount set as 9.

Does this work for you ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.