I'm creating a webpage for a client where the user can select multiple options for an item, and then send that information directly to Paypal with a Buy Now button.
Everything works but I can't put a description longer than 125 characters it seems (in the item_name field).
any ideas on how to send all the info onto paypal? ( I would need around 250 chars )
Thanks!
"item_name" value can only be 127 Character Length, however you can also pass the variable "item_number" (127 Character Length) to track product or service purchased (this value is also visible to buyers).
Example:
<input type="hidden" name="item_name" value="T-shirt AB Black">
<input type="hidden" name="item_number" value="APB9823400f">
Ref. https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
And for internal reference, you can also pass "custom" variable (256 Character Length), Pass-through variable for your own tracking purposes, which buyers do not see.
In alternative, you might consider "Add to Cart" buttons with Upload command, you can find instructions and examples here: https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/cart_upload/
Related
Run the following experiments on your ColdFusion server/development environment:
1) Create the following, basic HTML form that submits to itself using the post method:
<form method="post">
DATE: <input type="text" name="date" value="gfsgfdgfsd"><br>
MARTIN: <input type="text" name="martin" value="beardy"><br>
PAYMENT: <input type="text" name="payment" value="50 POUNDS"><br>
PAYMENT_DATE: <input type="text" name="payment_date" value="06:05:13 Apr 09, 2014 PDT"><br>
XEVI: <input type="text" name="xevi" value="cool"><br>
<input type="submit" value="submit"><br>
</form>
<cfdump var="#FORM#" />
Now access the page and hit the Submit button. Notice you get the error Form entries are incomplete or invalid. Now remove the ' POUNDS' from the end of the PAYMENT field so the value only contains numeric values. Re-submit the form and notice the error goes away.
2) Now study the CF Dump of the FORM structure. Notice how PAYMENT_DATE is missing from the comma separated list under the FIELDNAMES element! Clearly it exists because it's visible as the penultimate element in the dump. So why is it not listed?
Note: This strange bug wasted 4 hours of my life while trying to integrate the PayPal IPN (Instant Payment Notification) notification verification/validation stage which requires you to post everything back to the PayPal server with the arguments in the same order they were when submitted to you. Because payment_date was missing is was returning as INVALID. I fixed it with a dirty hack that looks for mc_gross while looping over fieldnames and inserts payment_date manually. Eerrgh, I feel unclean!
Experiment 1 proves that FORM.PAYMENT is a reserved value that must be numeric.
Experiment 2 proves that FORM.PAYMENT_DATE is a reserved value that gets ignored when FORM.FIELDNAMES is populated.
Why?
In the form scope in ColdFusion anything ending in _date is reserved as per http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec173d0-7ffe.html for validation purposes.
I cannot replicate the issue you are having with 'payment' being an integer. As soon as I change the payment_date field to paymentdate it submits just fine.
I am working on a site that's using PayPal Payment Advanced.
I've went through the documentation and have tried several methods for getting the initial token.
Below is my code:
Dim collection As New NameValueCollection()
collection.Add("PARTNER", "PayPal")
collection.Add("VENDOR", "*Vendor ID*")
collection.Add("USER", "*Transaction ID*")
collection.Add("PASSWORD", "*The USER Password*")
collection.Add("TRXTYPE", "S")
collection.Add("AMT", "0.01")
collection.Add("CREATESECURETOKEN", "Y")
collection.Add("SECURETOKENID", Guid.NewGuid().ToString().Replace("-", ""))
Dim wc As New WebClient()
Dim response As Byte() = wc.UploadValues("https://pilot-payflowpro.paypal.com", "POST", collection)
Dim text As String = ASCIIEncoding.ASCII.GetString(response)
The result is always
something like.....
RESULT=1&SECURETOKENID=11d95bb67d924cb2b8d9b4df81dfd586&RESPMSG=User authentication failed
I've tried this basic process using a simple html form with post and hidden form fields with key value pairs the result is always the same.
I can access both accounts in PayPal Manger with no issues.
Any help from anyone out there would be greatly appreciated.
I found the issue, I am posting here in the hopes that someone else won't have to go through the same headache as myself.
When attempting to submit test data for PayPal payment advanced you'll need to ensure that you do have a sandbox account email associated and tied to the PayPal manager. I created a fictitious email because my actual email was already associated with another account.
So be sure to go to developer.paypal.com and select "Sandbox Accounts" --> Create Account.
After you've created the account, in the Sandbox test accounts select the new entry and select "Profile" under the Profile tab ensure PayPal Payments Pro is selected.
Now, off to PayPal manager. From here you'll want to be sure the PayPal Sandbox email address is associated. With the new account added in the developer sandbox enter the email address and select update.
Under transaction settings ensure that you have a value in "Maximum Amount per Transaction"
Lastly ensure the name value parameters are set properly. In my case it was failing on the parameter PASSWORD. It should have been PWD.
So your form should be set as in the following example.
<form method="POST" action="https://pilot-payflowpro.paypal.com:443" target="paypal">
<input type="hidden" value="PARTNER" name="PayPal" />
<input type="hidden" value="VENDOR" name="*Vendor Name*" />
<input type="hidden" value="USER" name="*User Name*" />
<input type="hidden" value="PWD" name=""User Password"" />
<!-- NOT PASSWORD -->
<input type="hidden" value="CREATESECURETOKEN" name="Y" />
<input type="hidden" value="TRXTYPE" name="S" />
<input type="hidden" value="AMT" name="1.01" />
<input type="hidden" value="SECURETOKENID" name="random guid here" />
<input type="submit" value="Submit">
</form>
Or
Dim collection As New NameValueCollection()
collection.Add("Partner", "Partner Name - Usually PayPal or Verisign")
collection.Add("Vendor", "Vendor Name")
collection.Add("User", "User Name")
collection.Add("PWD", "User's Password")
collection.Add("TRXTYPE", "Transaction type, example A, S, etc")
collection.Add("AMT", "Amount")
collection.Add("CREATESECURETOKEN", "Y")
collection.Add("SECURETOKENID", Guid.NewGuid().ToString().Replace("-", ""))
Dim wc As New WebClient()
Dim response As Byte() = wc.UploadValues(txtWebAddress.Text, "POST", collection)
wc.Dispose()
Dim responsetext As String = System.Text.ASCIIEncoding.ASCII.GetString(response)
I would like to thank PayPal support for their help in resolving this issue. They were most helpful.
To note, from the Paypal Knowledgebase site,
Note: Although PayPal Manager allows special characters to be part of the password, avoid using them because some operating shells like DOS or UNIX treat them differently. For example, the percent sign (%) is a special character within DOS. A password such as "PaSS%word1" will truncate to "PaSS" because DOS will drop all the characters after the second "S".
I had a password containing a non alpha-numeric character, and authentication would fail in same way as OP.
https://www.paypal-knowledge.com/infocenter/index?page=content&id=FAQ1223&actp=LIST
Are you using the API credentials? or the USER credentials?
Give a look to: https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECAPICredentials/
So I've implemented paypal IPN in my site and I'm in the middle of the
work process. Now I want to use more than 1 custom variable in the pp form
currently I'm using this one only
<input type="hidden" name="custom" value="<?php echo $user_id; ?>">
So I know the variable with the name 'custom' is allowed. I want to know if
I can pass more variables so I can filter the payments based on their criterias.
So if for example shipping is more than $0.00 I set a variable "shipping_cost" like this:
<input type="hidden" name="shipping_cost" value="<?php echo $cost; ?>">
or for other purposes. Is this allowed? Or paypal has an already defined list of allowed
variables we can use? I really want to solve this problem as there's not always one type
of payment we can process...
Thank you guys.
this way you can pass more parameters
<input type="hidden" name="custom" value="variable1=234&var2=summa&etc=xyz"/>
use the above one on your paypal form.
and process through the following code.
parse_str($_POST['custom'],$_MYVAR);
echo $_MYVAR['variable1'];
echo $_MYVAR['var2'];
echo $_MYVAR['etc'];
i hope this one help you.
As I (and many others I imagine) am also facing this problem, I thought I'd share some solutions I came across.
This one raised in the PayPal Community, suggests the use of the Option Variables which appear to offer a key/value pair implementation to facilitate up to 99 vars (for the record I have not actually tried this).
The most commonly accepted solution (which I also favor) is to add all of your data to a DB record, then use the custom var to store your record ID, which can obviously be used later (e.g. via IPN) to retrieve your data.
PayPal defines what fields you may use here. Any other fields will be ignored.
There is a 'shipping' field defined, and PayPal will use the value of that field to charge an extra amount for shipping. You will also be able to get that value from the IPN or PDT data.
If you need to pass other values, you could consider passing a string formatted in query-string style (var1=value1&var2=value2...) in the 'custom' field. Note that the maximum number of characters permitted in this field is 256. You would then parse this when you get the IPN or PDT response.
If the size of the custom field is too limiting, then you could try what I described in another answer here.
I have a form and using a normal submit button with no name like this below.
<input type="submit" value="Submit" />
Everything works fine like it is. My question is there a way I can give it a name say random numbers like this below.
<input type="submit" name="R312321321" value="Submit" />
Then when I submit can I get the value of the name of the submit button like if it was a hidden input. I can't use a hidden input for what I'm doing. The reason I want to do the submit button this way is browser macros look for the name. If the name is always changing its harder for their macro to work. Once I get the value of the submit button I can authenticate it which I have something already created just need to get the value of the submit in php.
Thank you
Yes, this would work. However, the spec says otherwise about input names beginning with numbers.
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed by any number of letters, digits ([0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".").
After you submit the form you will have a key value pair
[312321321] => Submit
I'd like my form to include a certain value if the quantity is equal to 1 (via a text box).
I've managed to show what the total cost is using JavaScript and I could submit it with this value but I'm worried that when JavaScript is turned off the user will be able to submit the form without the extra fee being added. Therefor escaping the fee.
<form>
<label>Qunatity</label>
<input type="text" name="qyt" />
<input type="text" name="fee" value="250" />
<div class="total">[whatever the total is]</div>
<input type="submit" value="submit" />
</form>
Is there a way I can submit this form so that it submits 250 only if a quantity of 1 is added to the form? I'd like to avoid using a select input.
Will I need to split my form out into two stages to achieve this?
You need to check your logic in server-side code.
Most people have Javascript enabled, so you should do it in Javascript to provide a better experience, but you must always reproduce the logic on the server.
If you need to validate your input without JavaScript, have a server-side component (PHP?) to do the job and return the same form with an error message if no quantity was given. That way you don't have to split your form into two steps.
The best/safest way to handle this would be to do your total calculation on the server side. That way the data you store will always be correct.