I am trying to build a very simple paypal-backed shopping cart so users can purchase multiple items. I want paypal to handle all the payment details. I don't even want an order confirmation. I will manually check for order confirmation on paypal.
At first I wanted to use "Website Payments Standard" because it seemed easy to create a form that will post to paypal and let paypal handle it from there. But no, this did not work because the "Website Payments Standard" buttons/form do not support submitting multiple items. I tried all sorts of key/value in my form, and it never worked.
Then I tried Express Checkout using the instructions found here. It largely worked, but as I understand it, after sending a SetExpressCheckout, you have to listen for a request from paypal and do a DoExpressCheckoutPayment to complete the transaction. SO reference.
I find this a bit troublesome, because what if my server fails to receive the request from paypal and I never send a DoExpressCheckoutPayment? So a customer THINKS they have finished submitting an order, but the order was never received.
Does anyone know of a way to skip this "confirmation" step? I find it unnecessary, and not sure why paypal requires it.
That's because Express Checkout and Website Payments Standard are fundamentally different products.
To use Express Checkout, you would call the SetExpressCheckout API. In the API call, you specify the details of the products, amounts, and the RETURNURL.
Once you post this data to PayPal's API endpoint, you receive a token in return.
You would then redirect the buyer, and append the token to the following URL: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX
Once the buyer has agreed to your purchase, he is redirected back to the URL you specified in the RETURNURL.
You should now show the order confirmation, and call the GetExpressCheckoutDetails API**.
When calling GetExpressCheckoutDetails, supply the token. In the GetExpressCheckoutDetails API response you'll find a PayerID.
Now you're ready to call DoExpressCheckoutPayment, and charge the buyer. Remember to include both the token and the payerID when calling DoExpressCheckoutPayment.
Note: If you want to charge the buyer immediately by calling GetExpressCheckoutDetails and DoExpressCheckoutPayment immediately, redirect the buyer to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX&useraction=commit.
The useraction=commit will change the "Continue" button on the PayPal 'Review your payment' page to a "Pay now" button.
--
The reason there's such a significant difference between Express Checkout and Website Payments Standard, is that Website Payments Standard is intended to be a drop-in working solution where PayPal handles the whole transaction flow. Express Checkout is a more flexible solution which allows you to integrate it deeply with an existing checkout flow of a website / shopping cart.
For your use case; lookat using PayPal 'cart upload' buttons.
See for an example https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_cart_upload
<form action="https://www.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="seller#designerfotos.com">
<input type="hidden" name="item_name_1" value="Item Name 1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2" value="Item Name 2">
<input type="hidden" name="amount_2" value="2.00">
<input type="submit" value="PayPal">
</form>
Note however, that this is insecure by default, as the amounts you're going to charge will be plainly visible in the HTML.
** The PayerID is appended in the GET of your RETURNURL as well. So you could skip calling GetExpressCheckoutDetails if you wanted to.
For the purposes of this site, the DoExpressCheckoutPayment operation simply is required by the PayPal Express Checkout API.
You're correct that it's not required for PayPal to process a payment, but there are scenarios that would require a second operation. An example of such a scenario would be one where the user (your site's customer) is choosing a shipping address during the PayPal payment confirmation. Depending on your shipping provider(s), you may need to calculate actual shipping amounts after the user has chosen a shipping address on the PayPal confirmation pages.
Related
We are trying to implement subscription on our website using Paypal's subscription feature. What we want is to let Paypal do the recurring process even if the first payment fails until we or the subscribed user manually cancel the subscription profile.
From what I read here
https://developer.paypal.com/docs/classic/express-checkout/digital-goods/ECDGRecurringPayments/#id086520F027U
If we set the MAXFAILEDPAYMENTS variable to zero it means Paypal will still keep continuing the recurring process even if the payment fails.
However to specify the variable we have to use NVP/SOAP API.
Can we achieve the same thing using the basic HTML Code specified in the payment form ?
<input type="hidden" name="a3" value="1">
<input type="hidden" name="t3" value="M"> <!-- billing cycle unit=month -->
<input type="hidden" name="p3" value="1"> <!-- billing cycle length -->
<input type="hidden" name="src" value="1"> <!-- recurring=yes -->
<input type="hidden" name="sra" value="0"> <!-- reattempt=no -->
{{--End of recurring variables--}}
I could not find the option here
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
Unfortunately, no, and what's even worse is the parameter you mentioned for the NVP/SOAP API gets ignored.
No matter what you set that paramter to PayPal follows the same routine, which is this...
If a scheduled payment fails it will re-attempt in 5 days. If there are three re-attempts that each fail the profile will be "suspended due to max failed payments."
IPNs would be triggered for each failed attempt as well as for the suspension of a profile, so it's recommended to get an IPN solution setup and working if you do go that route.
What's strange, too, is that sometimes a profile will become suspended after failing three re-attempts as explained, but then if you "collect outstanding balance" using the same billing details provided for the subscription it will process successfully, and then you can re-activate the subscription profile.
Honestly, if I had it to do over again with my own system I would probably not use PayPal's recurring payments API. Instead I would use billing agreements and reference transactions so that I can build my own recurring system and process payments whenever I need for any amount I need. If you're just getting started I would recommend the same for you.
I'm trying to integrate PayPal on my site and I have problems with receiving information from PayPal about transaction.
I'm using sandbox environment for tests.
I generated the form and placed return url into there:
<input type='hidden' name='return' value='my-local-site/success.php'>
After all payments are done (and they are done correct - I'm getting money to my account) I'm returned to my-local-site/success.php without any parameters about this transaction.
I tried to make it like here - http://www.dollarfry.com/paypal-integration-guide-php/ but it does not work for me.
My question is why I don't receive any information about transaction from PayPal as payments were done correctly via sandbox (money were sent from one account to another correctly).
I want to get some info like
http://my.local.site/success.php?tx=6BC88318RN685282M&st=Completed&amt=20.00&cc=USD&cm=&item_number=BEAR05
What should I do to get that info? Is something wrong I do, or with my account?
Thank you!
Try adding an extra parameter.
<input type="hidden" name="rm" value="0" />
Check PayPal's HTML variables documentation for more details. Search for "return method" on that page and you should find it easily.
ok, it's working. However, I need one thing fixed:
how to remove the shipping to field for in our case it's not needed. thanks.
Pass in no_shipping=1 (if you're using Website Payments Standard).
E.g. <input type="hidden" name="no_shipping" value="1">
For Express Checkout, you'd add NOSHIPPING=1 in your SetExpressCheckout API call.
My client created a hosted Subscription button and gave me following code to apply in our website:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="X9Z9BHN867R2E">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
On Paypal's Checkout screen there are 2 options:
1) Already have PayPal account (2) Create PayPal account.
If I choose first option and enter a wrong username/password. Then I see a link: "Pay using your credit or debit card". When user clicks on this link, it just throws an error: "The link you have used to enter the PayPal system is invalid. Please review the link and try again."
What is the possible cause of this issue? Am I doing something wrong or is it a bug at PayPal end.
this sounds like enhanced recurring payments. Your client must verify the Paypal account using email and this should solve your problem.
AR
This is clearly an error on PayPal's side. If you click on the hosted subscription button using a browser with no PayPal cookies, you will see a screen that says "You need a PayPal account for this purchase." and then two radio buttons:
I already have a PayPal account. (and then fields for entering your Email and Password)
I need to create a PayPal account (where available).
HOWEVER, if you click on a hosted subscription button using a browser with PayPal cookies (in other words, used by someone that has a PayPal account -- not necessarily your user, but anyone that has used that browser to logon to PayPal in the past), then the screen does NOT say you need a PayPal account for this purchase, instead it says:
Check out using PayPal (followed by fields for entering your Email and Password).
And below that (and it's a little hard to see at first), it says: "No PayPal account? Pay using your credit or debit card"
If you click on that, you will get the following error:
The link you have used to enter the PayPal system is invalid. Please review the link and try again.
PayPal requires a PayPal account for subscription payments, but for reasons only PayPal knows, they have chosen to have a link on the form that suggests otherwise and only confuses poor users when they click on it (who were trying to give you money, I might add) and then vaguely they are told there was an error.
Perhaps the only current work around -- until someone brings it to PayPal's attention -- would be to warn your users on your checkout page that a PayPal account is required for subscription payments.
I used Paypal sandbox to test my code and my IPN is working.
Now, I need to go to my original Paypal account. My confusion is in sandbox, we make buyers' and sellers' accounts. And we get tit_789456613_biz#yahoo.com like seller account.
Is it needed in original account? If needed, how to make it?
If not needed, which email address should I use? Client's email or client's Paypal contact?
When you switch over from sandbox to real service you use your own real PayPal account as seller/business.
Example:
<input name="business" value="you#domain.com" type="hidden">
And you change the form action from https://www.sandbox.paypal.com/cgi-bin/webscr to https://www.paypal.com/cgi-bin/webscr
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">