Custom Paypal form only collecting some data after completed transaction - forms

I have created a custom form following information I have gained from the Paypal KB, StackOverflow and other support forums. However things are not working as I had planned. I'm guessing I've missed something along the way that's causing my issue.
I have created a custom donation button building the base of what I need in Paypal, but then not saving the button, and using the code Paypal generates as the base which I then customize (code posted below). The point is to collect info of the type of donation (dropdown), name of the person the donation is honoring (text field), the amount the donation is for (amount field) and then 5 other optional text fields using the on and os variables. At the end of all fields is the Paypal donate button.
What happens correctly:
When someone fills out the form and then clicks donate ALL values they enter into the form show up properly on the PayPal payment page.
When the transaction is complete the DONOR gets an email showing their transaction AND shows all the information from the form they filled out in the donation details area. Everything on the donor side goes perfectly and they never know there is a problem.
What goes wrong: HOWEVER, things go awry for the organization accepting the donation at payment completion. When the organization gets the email notification of the payment only the top 3 values from the donation form show in the details (value from the dropdown menu, the value in the first text field, and the amount field). All other relevant paypal transaction info is there and the transaction is fine. But all the needed detail that was collected from the custom form is missing. If I log into the paypal account that received the payment I see the transaction, but just as the notification email all data after the amount is missing.
Summary:
The custom form, for the donor, appears to function properly including values passed from the web form to the paypal payment form and even included in the donation receipt email received by the donor. However, when it comes to the organization only the first 3 fields show in the notification email and on the transaction itself in the paypal account
Any idea why all values show up on the donor email notification and only 3 values show up on the organization site? Has my formatting of the form (adding spaces between fields) broken the form? If so why does all info show properly for the donor and not the organization? I have included the form code below. Please advise. Thank you so much!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_donations"> <input type="hidden" name="business" value="paypal#sthecompany.org"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="item_name" value="Honor/Memorial Donation"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="no_note" value="0"> <input type="hidden" name="cn" value="Please add your comments here"> <input type="hidden" name="no_shipping" value="2"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
<table>
<tbody>
<tr><td><input type="hidden" name="on0" value="Gift Type">Gift Type</td></tr>
<tr>
<td height="32"><select name="os0">
<option value="Honor">Honor</option>
<option value="Memorial">Memorial</option>
</select></td>
</tr>
<tr>
<td><input type="hidden" name="on1" value="Name">In Honor or Memory of</td>
</tr>
<tr>
<td><input type="text" name="os1" maxlength="200"></td>
</tr>
<tr>
<td><label for="amount">Amount $<br /></label><input id="amount" type="text" name="amount" value=""></td>
</tr>
<tr>
<td><br />If you would like a letter sent to the honoree or next of kin,<br />please fill out the following information otherwise leave blank. <br /><br /> <input type="hidden" name="on2" value="Notification Name">Notification Name</td>
</tr>
<tr>
<td><input type="text" name="os2" maxlength="200"></td>
</tr>
<tr>
<td><br /><input type="hidden" name="on3" value="Notification Address">Notification Address</td>
</tr>
<tr>
<td><textarea name="os3" rows="5" cols="40"></textarea></td>
</tr>
<tr>
<td><br /><input type="hidden" name="on4" value="Notification City">Notification City</td>
</tr>
<tr>
<td><input type="text" name="os4" maxlength="200"></td>
</tr>
<tr>
<td><br /><input type="hidden" name="on5" value="Notification State">Notification State</td>
</tr>
<tr>
<td><input type="text" name="os5" maxlength="200"></td>
</tr>
<tr>
<td><br /><input type="hidden" name="on6" value="Notification Zip">Notification Zip</td>
</tr>
<tr>
<td><input type="text" name="os6" maxlength="200"></td>
</tr>
</tbody>
</table>
<br /> <input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"> <input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="PayPal - The safer, easier way to pay online!"><img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1"></form>

I was able to produce the same results that you describe. I would suggest opening up a ticket with PayPal's Merchant Technical Team at www.paypal.com/mts. Once you have a ticket opened up, if you would like to provide the ticket number I will grab your ticket and look into this further. It may be a bug or intended, I would have to look deeper into the code. Intially some of the additional variables were not supported for some buttons, but I will look into it further and update you through your ticket as to if this is a bug or something that needs to have a feature request filed for.

I haven't checked whether those custom values are sent through an IPN message, but that might solve the problem.

Related

PayPal Convertings Spaces in _cart Form to Plus Sign

Recently (starting March 2017), the _cart form integration with PayPal payments standard has started encoding spaces in all item info (names and options) to the plus sign (+). I verified this was happening in Chrome and added the enctype attribute to the form, which seemed to solve the issue for me. In Chrome and Firefox, I can send data to PayPal and spaces are preserved properly. Perhaps this is a fluke?
However, almost every customer that purchases is getting their info encoded improperly, which results in the IPN request not being able to verify the products they purchased.
The form:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="name#example.com">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="item_name_1" value="Product With Spaces">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="amount_1" value="30.00">
<input type="hidden" name="on0_1" value="Name">
<input type="hidden" name="os0_1" value="First Last">
<input type="hidden" name="on1_1" value="Email">
<input type="hidden" name="os1_1" value="customer#example.com">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px; margin-top: 2px;">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
When submitted to PayPal, the product is shown as Product+With+Spaces and the name as First+Last. Thus the transaction record on PayPal and the IPN request have the incorrectly encoded data also.
I tried encoding the spaces as %20 or + (which would normally result in double-encoding, so I didn't expect it to help), but those literal characters were shown on PayPal.
I've read over the PayPal developer docs, and I seem to be using the most up-to-date fields and URLs. Also, this code has been running successfully for years without trouble.
Solved! added the enctype="multipart/form-data" attribute to the paypal button form, return variables to ipn come back in same state as submitted

PayPal - Send secondary email confirmation though pay now form (not account)

I've been looking for a solution to this issue but can't quite find the correct one, here is the problem:
I'm working on a simple paypal integration tool, all it does is show a pay now form customized to each of our customers' payPayl account, when an end user pays our customer gets the payment (so far this works).
The problem is that I need it to also send a copy of the confirmation to our email address as well, but only for the transactions that go through this form, as customers will have other transactions from elsewhere that we shouldn't be getting confirmations for (so adding our company email to every customer's paypal account is not an option).
Does anyone have an idea of how this can be achieved? Is there a hidden field I can add which will do the trick? Here is a sample form:
Amount: {{this.amount}}
Paypal Email: {{this.paypalEmail}}
<br><br>
{{#if this.paypalEmail}}
{{#if this.amount}}
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="border: 1px solid #ccc; padding: 30px; width: 200px;">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="{{this.paypalEmail}}">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="item_name" value="Service Charge">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_SM.gif:NonHostedGuest">
<table>
<input type="hidden" name="item_name" value="Service Charge">
<strong>Invoice Amount: </strong><br>
<h3>{{this.amount}}</h3>
<input type="hidden" name="amount" value="{{this.amount}}">
<button style="padding: 5px 10px; background-color:mediumaquamarine; color: white; border-radius: 3px; border: 0px;" border="0" name="submit" alt="Pay Now">Pay Now</button>
<!--<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">-->
<!--<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">-->
</table>
</form>
{{/if}}
{{/if}}
Any help is greatly appreciated, as we are stuck at this point!
I still have not found an answer, but I did find an alternative, you can post a copy of the reply to an API by adding a hidden input field to the form, which is the next best thing I guess, from there you can email a copy or just process the results, here is the code:
<input type="hidden" name="notify_url" value="<API URL>">
I hope this helps anyone having this issue, it's was very frustrating.

paypal amount 0 on order summery page

Amount $0 on order summery page.
My Code for Buy Now Button is
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="AF">
<input type="hidden" name="amount" value="10.10">
<table>
<tr><td><input type="hidden" name="on0" value="License Option">License Option</td></tr><tr><td><select name="os0">
<option value="Single User">Single User </option>
<option value="Site License">Site License </option>
<option value="Global License">Global License </option>
</select> </td></tr>
</table>
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
It looks like you have modified the button, which is what's probably causing the issue. When using a hosted button, typically the amount doesn't appear in the code. This is one of the reasons behind the hosted button, it keeps a person from viewing the code and modifying the amount. If you added the line of code in there for the amount, after creating your button this is probably the issue. Either you need to set the amount when creating the button in your account if you are wanting to use a hosted button. Otherwise if you want to be able to edit the amount in the code, you need to create a non hosted, clear text button. This can be done by setting your button not to be hosted on step 2 of the button creation process. Then once the code is generated, it will be encrypted. You have to then select clear text/un-encrypted to generate the HTML code that you can edit.
If you are trying to create button in your PayPal account, please do not change the name and value fields generated there. All data are saved in PayPal system and could not be modified in code line. If you are trying to create a customized button, please refer to below page for its details.
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/buynow_buttons/#id08A2G0920QN
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

Paypal return url is giving blank array

<form id="dvrr" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<table border="0" cellpadding="5" cellspacing="5" align="center" width="100%">
<tr>
<td></td>
<td><input type="hidden" name="business" value="ceo#world-airport-city-transfer.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Cab Booking">
<input type="hidden" name="item_number" value="<?php echo $orderid; ?>">
<input type="hidden" name="amount" value="<?php echo number_format((float)$data['price'], 2, '.', ''); ?>">
<input type="hidden" name="currency_code" value="USD">
<!-- Specify URLs -->
<input type="hidden" name="cancel_return" value="http://www.wer.com/payment-cancel/">
<input type="hidden" name="return" value="http://www.wer.com/payment-processing/">
<input type="hidden" name="notify_url" value="http://www.wer.com/notify-payment/">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" ></td>
</tr>
</table>
This is my PayPal form that I'm using for payment, on thank you page we add the code to get the response and update it on our system that the transaction is complete or not.
we place this code on weburl.com/payment-processing/ that is our return URL
$data=$_POST;
if($_POST['payment_status']!=''){
$item_name=$_POST['item_name'];
$item_number=$_POST['item_number'];
$txn_id=$_POST['txn_id'];
$payer_email=$_POST['payer_email'];
$payment_gross=$_POST['payment_gross'];
$payment_status=$_POST['payment_status'];
$insert = mysql_query("INSERT INTO cr_payments(item_name,item_number,txn_id,payer_email,payment_gross,payment_status) VALUES('".$item_name."','".$item_number."','".$txn_id."','".$payer_email."','".$payment_gross."','".$payment_status."')") or die(mysql_error());
global $wpdb;
$is_added = $wpdb->query("UPDATE cr_booking SET fld_booking_status = '$payment_status' WHERE fld_booking_id = '$item_number'");
but we get data when we run code on sandbox mode .. but on live mode we are getting blank array
PayPal website payments standard, including the PayPal button you use, do NOT carry anything back to your return URL.
You will have to store data in your shopping cart before jumping to PayPal payment page.
Another PayPal product you can use, which is very different from the one you are using, is express checkout. It requires you to program the API calls between your server and PayPal, but the actual charge is done by calling doexoresscheckout on your server, so you can decide what to display according to the result of this API call.
i resolve the issue by my custom way i just write the ipn data on a file by file_put_content and convert file data in to array and by twice exploding it by & and = i got the exact data after it on that bases we process the payment data in our website

Submit form to another page within the same domain

How to submit form to another page within the same domain which has no form ID or name?
Form that needs to submit to another page:
<form id="login_form" action="roundcube" method="post">
<div class="input-req-login">
<label for="user">Email Address</label>
</div>
<div class="input-field-login icon username-container">
<input name="_user"
id="rcmloginuser"
autofocus="autofocus"
placeholder="Enter your email address."
class="std_textbox"
type="text"
tabindex="1" required>
</div>
<div style="margin-top:30px;" class="input-req-login">
<label for="pass">Parola</label>
</div>
<div class="input-field-login icon password-container">
<input name="_pass"
id="rcmloginpwd"
placeholder="Enter your email password."
class="std_textbox"
type="password"
tabindex="2" required>
</div>
<div class="controls">
<div class="login-btn">
<button type="submit"
onclick="document.getElementByName("form").submit()"
tabindex="3">Autentificare</button>
</div>
Target form:
<form name="form" action="./" method="post">
<input type="hidden" name="_token" value="543e98f5e6cc25841fc0df79cb939590">
<input type="hidden" name="_task" value="login">
<input type="hidden" name="_action" value="login">
<input type="hidden" name="_timezone" id="rcmlogintz" value="_default_">
<input type="hidden" name="_url" id="rcmloginurl" value="">
<table>
<tbody>
<tr>
<td class="title">
<label for="rcmloginuser">Utilizator</label>
</td>
<td class="input">
<input name="_user"
id="rcmloginuser"
size="40"
autocapitalize="off"
autocomplete="off"
type="text">
</td>
</tr>
<tr>
<td class="title">
<label for="rcmloginpwd">Parolă</label>
</td>
<td class="input">
<input name="_pass"
id="rcmloginpwd"
size="40"
autocapitalize="off"
autocomplete="off"
type="password">
</td>
</tr>
</tbody>
</table>
<p class="formbuttons">
<input type="submit"
class="button mainaction"
value="Autentificare" />
</p>
</form>
Ok, I have taken a look at your sites now. This is actually quite simple.
I guess what you are trying to do is to set up a personalized web site to log in so you can give your own look and feel. And roundcube, I guess that is a standard mail system you have installed?
Well the problem is that roundcube not only sends user name and password. If you look at the HTML code you also see:
<input type="hidden" name="_token" value="5b6a757df5eee91fa7ee7171466b8b2a">
<input type="hidden" name="_task" value="login">
<input type="hidden" name="_action" value="login">
<input type="hidden" name="_timezone" id="rcmlogintz" value="_default_">
<input type="hidden" name="_url" id="rcmloginurl" value="">
All these are hidden values that are automatically sent with the log in POST. You probably need to add the last 4 of them.
There might be a big problem for you though. The first one called _token I have a theory that this is a randomized string that the server will require you to provide. I can be wrong but if I am correct you will not be able to do what you want. The reason for having this random string is to prevent users from posting log ins from other forms (that is if I am correct)
Maybe it is possible for you to turn off this randomized string in the roundcube admin settings? If not I think you don't have an easy way to proceed unless you want to dig into the code of round cube.
Edit: I just tried submitting the original form without the _token and it does not work. so unfortunately you are out of luck this time.
I am not quite sure I understand your question, but I guess you are writing a new page and want to post to another page. What if you do like this?
<form id="login_form" action="http://webmail.mysite.com/roundcube/" method="post">