PayPal Payment Advanced User authentication failed - paypal

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/

Related

How to add longer "item_name" using a Paypal form?

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/

The right way to fill and test a web form in ScalaTest and FluentLenium

I'm trying to fill, submit, and test a web form in Play Framework, using ScalaTest and FluentLenium. It seems like it should be very straightforward, but I'm having all kinds of problems.
First, part of the web form in question:
<form class="signin" id="loginform" method="POST" action="/login">
<div class="form-group">
<label for="name">Email Address:</label>
<input type="email" class="form-control" placeholder="Enter Email Address" id="email" name="email" required />
...
This works fine from a real web browser. Now the problem comes when I try to fill in and submit the form:
#RunWith(classOf[JUnitRunner])
#SharedDriver(deleteCookies = false)
#SharedDriver(`type` = SharedDriver.SharedType.PER_CLASS)
class TestWebsiteAuthentication extends Specification {
"Application" should {
"login as an administrative user on the web site" in new WithBrowser with GPAuthenticationTestUtility {
browser.goTo(loginURL)
browser.fill("#email").`with`(prerequisiteAccounts.head.userIdentity) must equalTo(OK)
...
At that last line, I get an exception:
[info] x login as an administrative user on the web site
[error] 'org.fluentlenium.core.action.FillConstructor#1c25c183' is not equal to '200' (TestWebsiteAuthentication.scala:93)
[error] Expected: 200
[error] Actual: org.fluentlenium.core.action.FillConstructor#1c25c183
Any ideas what I'm doing wrong here?
I've tried taking out the "must equalTo(OK)" but this just causes the form to fail on submit -- unfortunately, I haven't been able to find ANY documentation on how to do this, so I'm basically piecing it together bit by bit. Pointers to relevant documentation would be appreciated -- there doesn't seem to be anything complete at Tyrpesafe... just "teasers" that get you started, but no depth. :-(
When you write browser.fill("#email").``with``("x#y.com"), all you're really doing is telling Fluentlenium to edit the template to add a value attribute inside the input tag.
On the other hand, OK is an HTTP status code, so comparing them will naturally yield false.
When you say you tried to submit the form and it failed, i am assuming you did something such as:
browser.fill("#email").`with`("x#y.com")
browser.fill("#password").`with`("myPass")
browser.click("#button") // this should submit the form and load the page after login
and then tried to make an assertion such as:
browser.title() must equalTo("next page") // fails because "next page" != "login page"
one suggestion is to try something like this, Before browser.click:
browser.pageSource() must contain("xyz") // this will fail
When the above assertion fails, it will print the content of browser.pageSource() to your terminal, and you'll be able to see the modifications the Fill function did to the HTML.
In my case, I observed that my pageSource() now contained the following:
<input type="text" id="email" name="email" value="x#y.com"/>
<input type="password" id="password" name="password"/>
Notice how the first input has a value="x#y.com", but the second input is still empty. It turns out the second one is empty because it is an input of type password, however I eventually made the form login work.
Here is a list of things you can look into:
have a database enabled in that Spec
have it populated with Users (in case your form validation connects to a DB, that is)
from what I have experienced, using browser.goTo more than once in a test will not work well with form submission (anyone can confirm?)
Hope this helps

FORM.payment_date is reserved name bug in Coldfusion causing PayPal IPN INVALID verification in CF9

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.

HTML Form "value=[Non-Static]"

Current:
<input type="hidden" name="subject" value="| Website Owners Co. - Web Referral |" />
In a Perfect World, The following is Basically what I want it to do.
<input type="hidden" name="subject" value="| UserInput "Location" , UserInput "Date Set" |" />
IN the form itself, I would like to call upon the "Location" that the user has set, AND the "Event Date" that the user has set.
So you really get the Idea, the Form asks for the . . .
Event Date (Drop Down Values) m/d/y
Event Location (Text Field)
Can the [Subject] Line of the email be non-static in this way?
Can this be done simply? Im not that great with code beyond css/html.
You don't state what language for server side scripting you are using to process your form and it isn't tagged. If using PHP would suggest the following.
So, you want to submit a form, do some processing and then send an email using fields submitted in the form as the subject title?
In your form processing page just use something like the following using you are using method=POST and the field names are event_location and event_date. If you are creating the subject from the two submitted values you really do not need to submit subject as a hidden form field.
After the form is submitted you should be able to grab the contents of the two fields and then concatenate them together to create a new email subject variable.
$email_subject = $_POST['event_location']. ", ". $_POST['event_date'];
In PHP it would be done this way. I guess it depends on how you are processing your form.

How to prefill website form fields that are not posted

I don't really know exactly how to search for this on the web. I have a form with one input for telephone. Telephone is optional. I would like to have the word "(Optional)" in the form field. This I have done already like this:
<input type="text" name="billing[telephone]" value="<?php echo $this->__('(optional)') ?>" onFocus="if(this.value == '<?php echo $this->__('(optional)') ?>') {this.value = '';}" onBlur="if (this.value == '') {this.value = '<?php echo $this->__('(optional)') ?>';}" title="<?php echo $this->__('Telephone') ?>" class="input-text" id="billing:telephone" />
It works this way but it posts "(Optional)" everywhere, sends "(Optional)" out in customer emails etc. I would like to make it where if no phone number was inputted it doesn't post "(Optional)" and just leaves the field blank as if nothing was entered.
This code above is from Magento Shopping cart that I added the Optional code in.
Thank you
You could try using the placeholder parameter like so:
<input type="text" name="phone" placeholder="(###) ###-#### (optional)">
It will put in a temporary value to help the user, but will not be posted if the user does not input their own answer. It will also disappear on focus to allow the user to fill in their own answer without having to delete the "optional" text.
The placeholder technique is new in HTML5 :
<input type="text" name="phone" placeholder="(###) ###-#### (optional)">
I think this above line will not support browser compatibility