PayPal Standard not giving option for Check out as Guest - paypal

MVC 3 VB.NET applicaiton... Using express checkout with html razor view. I have tried everything mentioned in all of the docs i could google for as well as the ones on paypal's dev network. Our Paypal account is setup to allow users to Check out as Guest without requiring paypal account creation or login. However when users are taken to the paypal site after clicking the checkout button there is no option to check out as guest. I am including my checkout view for reference. Please understand that this is a valid question and do not down vote it. If there is something not clear I will clarify it..
#modeltype xxxxxxx.orderVM
#Code
ViewData("Title") = "CheckOut"
End Code
<p style="text-align:center">Once you complete your transaction you will be redirected back to the site</p>
<p></p>
<p style="text-align:center">We will process your payment within 24 hours at which time you will recieve a confirmation email which you will need for addmission. Along with a PDF attachment in this email which is your parking permit.. Please print and follow the instructions</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p style="text-align: center"> Please Click on the paypal button below to be redirected to the PayPal Site to complete the payment Transaction</p>
<form id="PayPal" name="PayPal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
#Html.Hidden("cmd", "_cart")
#Html.Hidden("upload", "1")
#Html.Hidden("business", ConfigurationManager.AppSettings("PayPalMerchantEmail"))
#Html.Hidden("page_style","primary")
#Html.Hidden("custom", Model.id.ToString)
#Html.Hidden("image_url", "http://www.xxxxxxxxxx.com/content/images/xxxxxxxxLogo.jpg")
#Html.Hidden("cpp_header_image", "http://www.xxxxxxxx.com/content/images/xxxxxxxLogo.jpg")
#Html.Hidden("cpp_logo_image", "http://www.xxxxxxxxxxe.com/content/images/xxxxxxxLogo.jpg")
#Html.Hidden("return", "http://www.xxxxxxxxxx.com/")
#Html.Hidden("cancel_return", "http://www.xxxxxxxxxx.com")
#Html.Hidden("first_name", Model.first_name)
#Html.Hidden("last_name", Model.last_name)
#Html.Hidden("address1", Model.address1)
#Html.Hidden("address2", Model.address2)
#Html.Hidden("city", Model.city)
#Html.Hidden("state", Model.state)
#Html.Hidden("zip", Model.zip)
#If Not String.IsNullOrEmpty(Model.Class1) Then
#Html.Hidden("item_name_1", Model.Class1)
#Html.Hidden("amount_1", Model.fee1)
#Html.Hidden("quantity_1", ViewBag.quan)
#Html.Hidden("shipping_1", " 0.00 ")
#Html.Hidden("handling_1", " 0.00 ")
End If
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="middle" style="text-align:center"/>
</form>
I do not feel the code for the controller is required here since it does pass all the values correctly into the view... The only issue is I can not get check out as guest working...

Have you turned on 'Account Optional' in your PayPal Profile?
Which country is your account located in? The guest checkout functionality is not available in all countries yet.

Related

How can I supply a different email address to the user's PayPal email address through the PayPal checkout system

I have a website where people buy digital downloads. Up to now I've never collected an email address from the buyer at the point of checkout. I just pass them through to PayPal, and trust that their PayPal account has the correct email address set up in it.
Naturally, a lot of people don't. They have PayPal accounts tied to email addresses they've not used or checked in years.
Once they've made a payment, I process it via PDT and IPN. The PDT is so that they can download their files instantly, as soon as PayPal redirects them back to my site. Email address is irrelevant in this case.
A lot of people don't get redirected for one reason or another though (close their browser, network cuts out, etc), or they want to revisit the site to download their order at a later date.
For this I use IPN. PayPal contacts my site, tells me about the transaction, and I send an order confirmation email to them.
But so often this goes to that unchecked/old email address that the user doesn't use any more.
In a nutshell then, I want to pass a current email address into the PayPal checkout process.
I have my own custom-coded cart on my website, and then use an encrypted "checkout with PayPal" button, that sends all of the data about what's in the cart to PayPal.
This sort of thing:
$cart['cmd'] = '_cart';
$cart['upload'] = 1;
$cart['custom'] = $_SESSION['cartGUID'];
$cart['business'] = WEBSITE_PAYPAL_EMAIL_ADDRESS;
$cart['currency_code'] = $currencyCode;
$cart['return'] = 'https://www.example.com/pdt';
$n = 0;
while ($a = $rs->fetch()) {
$n++;
$cart['amount_'.$n] = $a['amount'];
$cart['quantity_'.$n] = $a['quantity'];
$cart['shipping_'.$n] = $a['postage'];
$cart['item_number_'.$n] = $a['id'];
$cart['item_name_'.$n] = $a['description'];
}
$encrypted = str_replace("\n", "", paypal_encrypt_via_exec($cart));
echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">';
echo '<input type="hidden" name="cmd" value="_s-xclick">';
echo '<input type="hidden" name="encrypted" value="'.$encrypted.'">';
echo '<p id="paypal-button">';
echo '<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure">
echo '</p>';
echo '</form>';
You get the idea.
To pass an email through, I could append it onto the 'custom' field.
$cart['custom'] = $_SESSION['cartGUID'] . '|' . $email;
And then split it out when 'custom' gets sent back to the site via IPN. This seems very hacky though?
So instead I've tried this, which I think is the right way of doing it:
$cart['email'] = $userEmail;
$cart['address_override'] = 1;
But it doesn't seem to work, the email address that gets passed back via IPN is still their stock PayPal email address.
What am I doing wrong?
Thanks

PayPal Adaptive Payments: two payments from one sender in two browser tabs

I use PayPal Adaptive Payments (parallel) on my website and I've encountered a strange problem with two payments in two different browser tabs from the same sender. The similar question was asked before, but nobody answered there.
The scenario which reproduces the problem
The user opens the first browser tab of the website and starts a payment process to the first seller.
PayPal's lightbox with Login button appears.
The user opens the second browser tab of the website and starts a payment process to the second seller.
Again, PyaPal's lightbox with Login button appears.
The user returns to the first browser tab and login to PayPal.
After login to PayPal in the first browser tab the user sees payment details to the second seller.
After login to PayPal in the second browser tab the user sees payment details to the second seller.
It seems that PayPal Adaptive Payments support only one transaction from one sender.
How it works
The website works with Ruby on Rails and I use paypal_adaptive gem for payments with PayPal. The payment flow is quite simple:
The user clicks on Buy button on the website. The client makes AJAX request which handled by payment controller in Ruby on Rails.
In the controller the app makes Pay request to PayPal API using paypal_adaptive gem and receives a PayKey (see the code below).
The server responds to the client with the PayKey and the client uses it in PayPal form to start payment process through PayPal's lightbox (see the code below).
That's it. After that I do not control anything (the payment process goes through PayPal's external webpage).
Additional notes
I'm sure that the data for Pay request is different on the server side in the test scenario listed above.
I've tried different PayPal's dialog options besides PayPal's lightbox: mini-browser and popup. These options doesn't affect on this bug and it is still reproducable.
The client code
<script src="https://www.paypalobjects.com/js/external/dg.js" type="text/javascript"></script>
<form action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay" class="paypal-hidden-form" target="PPDGFrame">
<button id="paypal-submit"></button>
<input id="type" type="hidden" name="expType" value="light">
<!-- Insert PayKey here and click on the form's submit button using jQuery after server's response. -->
<input id="paypal-key" type="hidden" name="paykey" value="">
</form>
<!-- Paypal -->
<script type="text/javascript" charset="utf-8">
var dgFlow = new PAYPAL.apps.DGFlow({ trigger: "paypal-submit", expType: "light" });
function MyEmbeddedFlow(embeddedFlow) {
this.embeddedPPObj = embeddedFlow;
this.paymentSuccess = function(paymentStatus) {
this.embeddedPPObj.closeFlow();
// More UI code here...
};
this.paymentCanceled = function() {
this.embeddedPPObj.closeFlow();
// More UI code here...
};
}
var myEmbeddedPaymentFlow = new MyEmbeddedFlow(dgFlow);
</script>
The server code
# Make a Pay request to PayPal API.
paypal_payment_thread = Thread.new do
# Some preparation code goes here...
pay_request = PaypalAdaptive::Request.new
process_guid = SecureRandom.uuid
# Construct Pay API request data.
data = {
:returnUrl => "#{PAYPAL_RETURN_URL}?process_guid=#{process_guid}",
:cancelUrl => "#{PAYPAL_CANCEL_URL}?process_guid=#{process_guid}",
:requestEnvelope => {
:errorLanguage => "en_US"
},
:currencyCode => "USD",
:receiverList => {
:receiver => [{
# seller_paypal value is different for two payments.
# But in fact we do the last payment for both payments.
:email => seller_paypal,
:amount => ORDER_SELLER_AMOUNT,
:paymentType => "DIGITALGOODS"
}, {
:email => PAYPAL_MARKETPLACE_EMAIL,
:amount => ORDER_MARKETPLACE_AMOUNT,
:paymentType => "DIGITALGOODS"
}]
},
:actionType => "PAY",
:ipnNotificationUrl => PAYPAL_NOTIFY_URL,
:reverseAllParallelPaymentsOnError => "true",
:trackingId => process_guid
}
# Make a Pay API request.
pay_response = pay_request.pay(data)
if pay_response.success?
# Everything is ok. Update database here...
else
raise Exceptions::PaypalPaymentError
end
end
I've removed some unimportant code just to be clear, how it really works.
Thanks in advance for the help!
Looks like it is by design. I've tried the same test here on the website of one of PayPal's employees and it is reproducible there.
PayPal's support answered me that the problem in using Lightbox. However I've tried Mini-Browser and Popup options as I described in my post without no effect.
Also, PayPal's support answered me that this is by design and adviced me to contact with Technical Support. Maybe it will be useful for someone else.
Hi Michael, Thanks, yes I was able to reproduce it as well. However
it’s important to understand that PayPal is not made for handling 2
payment flows at the same time. If you want to get further on that,
you can contact our Technical Support : https://ppmts.custhelp.com/
They have other tools to debug and may be able to give you a better
understanding of the technical problem.
Finally I've blocked simultaneous payments using a special flag in HTML5 Local Storage and dgFlow.isOpen() method of PAYPAL.apps.DGFlow object to detect PayPal window. On window close I reset this flag using onunload and onbeforeunload events of window.
I close this question. Thanks.

Paypal form return value

I'm fighting against Paypal.
I'm trying to use 'return' variable but for some reason it did not work.
The documentation says:
return
The URL to which PayPal redirects buyers' browser after they complete their payments. For example, specify a URL on your site that displays a "Thank you for your payment" page.
Default – PayPal redirects the browser to a PayPal webpage.
rm
Return method. The FORM METHOD used to send data to the URL specified by the return variable.
Allowable values are:
0 – all shopping cart payments use the GET method
1 – the buyer's browser is redirected to the return URL by using the GET method, but no payment variables are included
2 – the buyer's browser is redirected to the return URL by using the POST method, and all payment variables are included
So I decide add to my form:
<input type="hidden" name="return" value="http://www.site.com/payment_confirm.php" />
<input type="hidden" name="cancel_return" value="http://www.site.com/back" />
<input type="hidden" name="rm" value="2" />
But for some reason at the end of the payment nothing happens.
So I try to search on google why this could be and some people wrote to active the automatic redirect to a page at the end of transaction from profile.
So I went in the profile page and setted up the auto return to
www.site.com/
When I tryed again after the transaction paypal return me in the profile url and not in the url written in the form AND there are some data in the URL so the form hasn't use the POST method.
My ideas is over.
How can I solve this problem?

Sandbox paypal- lightbox does not load

Beginning Wednesday, March 27th, we encountered a problem testing PAY transactions in the Sandbox Adaptive Payment (Classic API) environment. Our last successful test was on Tuesday March 26th. We made no code or environment changes that would have affected our sandbox test transactions during that timeframe.
The problem we are experiencing is that the PayPal lightbox will not load after our application contacts the sandbox Adaptive Payment environment. At the point we try to invoke the lightbox, we have obtained a paykey. You can see the URL we are contacting, and a paykey value, in the screenshots of the error consoles in Firefox and Chrome attached.
The browser error console shows "404 – not found" error when we send a request to PayPal with a paykey. There are no other javascript errors on the page other than those generated by the request to Paypal. Is the "404 – not found" error related to the PayKey value we got back from the sandbox on the initial request? If so, why are the Paykeys suddenly not valid, when they were fine before?
The App ID we are using for the Adaptive Payment sandbox is: APP-80W284485P519543T Is this the correct App ID for the "new" sandbox environment?
We are using the UserID, password and signature from a verified US Business account set up in the Classic API sandbox.
<form id="lightbox_form" action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay" target="PPDGFrame">
<input id="type" type="hidden" name="expType" value="lightbox">
<input id="type" name="autoredirectondone" type="hidden">
<input type="hidden" name="paykey" id="paykey" value="[paykey is inserted here]">
<input name="submit_order" id="submit_order" type="submit" class="common_input_button" value="Submit Order">
</form>
<script type="text/javascript" src="https://www.paypalobjects.com/js/external/dg.js">
</script>
<script>
var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submit_order' });
</script>
Your form action is pointing to an old URL.
The new URL for sandbox Adaptive Payments is:
https://svcs.sandbox.paypal.com/AdaptivePayments/Pay
See: https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/gs_AdaptivePayments/

Paypal payment buttons and IPN: how to link users up uniquely?

Strangely the documentation on the Paypal site does not cover this very well.
We have a payment button that redirects to Paypal to process a payment.
We also have an IPN server running that catches paypal payments once they're made.
However, where can we place the "user id" of our system user in the paypal button, so that it will be forwarded to the IPN request in order to match the user up on our system that they have paid. Paypal seems to want people to do this manually, which is a real mission.
I'm currently doing some PayPal integration and I concur their documentation is a mess!
I finally found a guide somewhere that details which variables of a PayPal button form are forwarded to the IPN callback. You can use the variable item_name to forward a user id:
<input type="hidden" name="item_name" value="{user id}">
You should use:
<input type="hidden" name="item_number" value="{user id}">
and here is the documentation:
https://www.paypalobjects.com/IntegrationCenter/ic_std-variable-ref-buy-now.html
As said in the doc (https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/)
in your form :
<input type="hidden" name="custom" value="<?php echo $id ?>">
and get it with ipn :
$_POST['custom']
For anyone trying to get this working for Paypal SmartButtons, you should do something like this:
return actions.order.create({
purchase_units: [{
invoice_id: 'your_custom_stuff1',
custom_id: 'your_custom_stuff2',
amount: {
value: '100'
}
}]
});
IPN will sent it as POST data, for example in PHP:
$_POST['invoice']; // 'your_custom_stuff1'
$_POST['custom']; // 'your_custom_stuff2'