Paypal Checkout in mobile website - php

I am developing one mobile website for selling products through paypal. When i click the paypal button it redirects to paypal site in desktop mode. i want to change that to mobile mode...
I use the following code
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="merchant#website.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="product1">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="www.website.com/mobile/paypalreturn.php"/>
<input type="hidden" name="cancel_return" value="www.website.com/mobile/" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="shopping_url" value="www.website.com/mobile/index.php">
<input type="hidden" name="notify_url" value="www.website.com/mobile/paypalnotify.php">
<script>document.paypal.submit();</script>
</form>
Here it show Desktop version . I want to change to mobile version.. I checked this with Android and Iphone Devices. in Mobile device also its shows desktop version. I googled it, some site said it automatically change according to devices but not working for me..
Please suggest on this to rectify
Thanks in advance....

Do not know what alternative there is for command _xclick, but with Express Checkout you can use instead of
<input type="hidden" name="cmd" value="_express-checkout" />
this
<input type="hidden" name="cmd" value="_express-checkout-mobile" />
So the URL looks like https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout-mobile&token=.... See more about Express Checkout Mobile here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_WPECOnMobileDevices .
Try to find similar solution for Your xclick cmd parameter.

Related

PayPal checkout form stopped working - but no code changed on our end

I have a Paypal form that stopped working, seemingly of its own accord, with no changes made to the site or to the products on sale. We've tried PayPal support but they were of zero help, so I'm hoping somebody here will know what's going on.
This is the form:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="image_url" value="http://www.example.com/images/logo.jpg">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="invoice" value="coins_RqQC0rdyH87RlYt7bkZI3GXS">
<input type="hidden" name="business" value="paypalaccountemail#example.com">
<input type="hidden" name="return" value="http://www.example.com/en/thankyou.php?order_code=seriea_RqQC0rdyH87RlYt7bkZI3GXS">
<input type="hidden" name="cancel_return" value="http://www.example.com/en/choose-account-type">
<input type="hidden" name="currency_code" value="US">
<input type="hidden" name="item_name_1" value="50 coins">
<input type="hidden" name="amount_1" value="16.99">
<input type="image" src="/images/paypal-button3.png" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
As I said, the code or products haven't changed, so I'm stuck. If you're wondering why "item_name_1" etc, it's because we have a shopping cart which allows multiple things to be purchased in the same checkout process. I have some ideas which I've been unable to verify:
1) PayPal changed things on their end without letting us know, making the code obsolete?
2) Hosting company changed the server's IP, new SSL certificate - perhaps additional action needed in our PayPal account for this reason?
3) I'm missing something obvious and will feel stupid following the first comment on this question.

Paypal Integration PHP Laravel - Get transaction ID

I'm using laravel framework. I want to add Paypal integration in my app.
Customer can pay with me this code,
<form action="{{$paypal_url}}" method="post" name="frmPayPal1">
<input type="hidden" name="business" value="{{$paypal_id;}}">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Mangalayojana PREMIUM package">
<!--<input type="hidden" name="item_number" value="1">-->
<!--<input type="hidden" name="credits" value="510">-->
<input type="hidden" name="userid" value="{{Auth::id()}}">
<input type="hidden" name="amount" value="1.05">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="header_image" value="demo.ceylonsystems.com/img/logo.png">
<!--<input type="hidden" name="no_shipping" value="1">-->
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="cancel_return" value="http://demo.ceylonsystems.com/upgrade?state=notcompleted">
<input type="hidden" name="return" value="http://mangalayojana.div.lk/payments.php">
<input type="hidden" name="thanks_page" value="http://mangalayojana.div.lk/payments.php">
</form>
I want to receive transaction ID from paypal server. How can I do it, Any idea guys?
The best way to handle post transaction processing with PayPal is to use Instant Payment Notification (IPN). There are Laravel packages for IPN available on GitHub / Packagist.
As a side note, if you ever find yourself wanting to integrate PayPal API's into your Laravel projects you may be interested in my PHP class library for PayPal. It is also available on GitHub and Packagist and makes integrating PayPal into Laravel (and any PHP platform for that matter) very simple.

Paypal Subscription check with PHP for non hosted button

I am having a peculiar problem implementing recurring payment for a webapp that I am developing. I could not use a hosted paypal subscription button, because the payment sum would be variable. So, I used a non hosted solution something like this :
<form action="https://www.sandbox.paypal.com/us/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="business#email.com">
<input type="hidden" name="item_name" value="Some item"/>
<input type="hidden" name="return" value="return_url">
<input type="hidden" name="cancel_return" value="cancel_url">
<input type="hidden" name="notify_url" value="notification_url">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="a3" value="variable_amount">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="custom" value="planid1,planid2"/>
</form>
Now, I need to check every month using a cron that who has paid, and generate content according to that.
From the discussions all over the internet, it is clear that paypal doesn't send txn_id for the subscription. So, how am I supposed to check if user has paid in the next month or not?
One thing that comes to my mind is an IPN listener, but will that work with a non-hosted button? Totally confused with this. Could someone point me to the right direction?
IPN would be the way to go. With IPN, your system would be notified when the profile is created, when the profile bills the user again, when the profile is canceld, or when it fails to bill. You would also get the transaction id back in the IPN each thim the profile is charged.

PayPal _cart Upload to Sandbox never allows login

So I have been doing a lot of Googling on PayPal's _cart Upload ability and so far, this is what I have managed to put together. And this seems to be working just fine; I am taken to a PayPal page with the purchase info and it asks me to login. But when I login with a Sandbox buyer account, it simply shows that it's logging me in but it never logs me in nor does it allow me to complete the purchase. The merchant sandbox account is working fine as it displays the Example store name on the PayPal page.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="xxx#xxx.xxx">
<input type="hidden" name="item_number_1" value="3">
<input type="hidden" name="item_name_1" value="Foo">
<input type="hidden" name="amount_1" value="22.97">
<input type="hidden" name="shipping_1" value="0">
<input type="hidden" name="shipping2_1" value="0">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="22.97">
<input type="hidden" name="notify_url" value="http://******/order.php">
<input type="hidden" name="no_shipping" value="2">
<input class="paypal_button" type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but03.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
Am I doing something wrong when I'm logging in to PayPal or is the _cart upload ability deprecated after PayPal moved to a new a developer site and API? Any and all help would be appreciated it, I have been banging my head against the wall for hours trying to figure out what I'm doing wrong.
I don't think it'd make a difference but I am using PHP to generate the checkout information.
Thank you very much for your help.
I just submitted a payment using your code and my own sandbox account. It worked fine for me.
PayPal's servers can sometimes be pretty finicky with cookies in browsers. Close your browser (all instances of it so it's completely closed) and then reopen it and try again. Make sure you're signed in at developer.paypal.com before you try it and you should be just fine.

Amazon Checkout Sandbox failing to Process Order

My goal is to integrate our website with Amazon Checkout. We have already interfaced with both google and paypal apis with minor issues. However, with Amazon we have tried their provided PHP code and tried using create a button. With the PHP code in the sandbox we can get to finalizing the order, but then it gives an error saying Payment Failed your debit card was not charged. In the seller central it gives no information at all that anything ever happen.
When trying to create a button with amazons tool, and changing the address to the sandbox address instead, it says you must send the payment to a verified e-mail address and account.
The account has a credit card on it, verified bank account, tax information completed and verified e-mail.
Has anyone else has similar issues with amazon? Is there an exciting non-amazon based project that has successfully interfaced with Amazon that can be used for a reference. Amazon's documentation is... lacking and all over the place.
<form action="https://authorize.payments-sandbox.amazon.com/pba/paypipeline" method="POST">
<input type="image" src="https://authorize.payments-sandbox.amazon.com/pba/images/payNowButton.png" border="0">
<input type="hidden" name="accessKey" value="MERCHANT_KEY_REMOVED">
<input type="hidden" name="amount" value="USD 1.1">
<input type="hidden" name="description" value="Test of the Vidya Amazon Payment Alpha">
<input type="hidden" name="recipientEmail" value="MERCHANT_EMAIL_REMOVED">
<input type="hidden" name="signatureMethod" value="HmacSHA256">
<input type="hidden" name="referenceId" value="2">
<input type="hidden" name="immediateReturn" value="0">
<input type="hidden" name="returnUrl" value="http://yourwebsite.com/return.html">
<input type="hidden" name="abandonUrl" value="http://yourwebsite.com/cancel.html">
<input type="hidden" name="processImmediate" value="1">
<input type="hidden" name="ipnUrl" value="REMOVED">
<input type="hidden" name="cobrandingStyle" value="logo">
<input type="hidden" name="collectShippingAddress" value="0">
<input type="hidden" name="fixedMarketplaceFee" value="0.01">
<input type="hidden" name="variableMarketplaceFee" value="4">
<input type="hidden" name="signatureVersion" value="2">
<input type="hidden" name="signature" value="REMOVED">
</form>
So here's the scoop. With immediate processing set to 1 you have to leave out the Fee fields, otherwise it will never be accepted.
These two need to be removed for it to work
<input type="hidden" name="fixedMarketplaceFee" value="0.01" />
<input type="hidden" name="variableMarketplaceFee" value="4" />
If you use AWS SimplyPay PHP files you have to remove the variables from all 3 files in order for them to work. Or set processImmediate = 0.

Categories