I am aware of how to use paypal IPN to set an inventory after checkout has been completed, but there is one part of IPN I can not figure out.
When the user clicks "checkout with paypal" on the website, I would like to set the contents of the cart to "reserved" so that they are temporarily removed from inventory. Then, after a successful checkout, I will use IPN to permanently remove these items from the inventory. HOWEVER, if the user decides not to follow through with the paypal payment, my items are left in "reserved" limbo. IPN will not, as far as I know, report back to the site that the checkout session timed out or was terminated.
How can I get my inventory out of reserved and back on the site if a user bails out during paypal checkout, or walks away from their computer and lets the checkout session timeout?
Related
I'm implementing the v2 Express Checkout Paypal Integration; It works fine, however it does not fully complete the transaction (business account does not receive the payment).
I'm running tests on sandbox.
The token is generated as well as the Order ID.
I copy and paste the given link into the URL bar and press enter to proceed to complete the transaction. https://www.sandbox.paypal.com/checkoutnow?token=2463323E24235WQ.
The transaction is completed and redirects to a new URL https://example.com/return?token=2463323E24235WQ&PayerID=UEJ2NE9233DS5W.
Everything seems to work well, however when I come to check the notifications of the sandbox business account (in which the payments were supposed to go to), it does not show any payment.
Everything seems to be set accordingly but the payments just don't go to my account.
transaction is completed
Nope, wrong; the buyer approved the payment. There is no transaction.
To create a transaction, when the buyer returns to e.g. https://example.com/return?token=2463323E24235WQ&PayerID=UEJ2NE9233DS5W , you must display an order review page and capture the order with the appropriate API call.
If you want to capture the order immediately (skipping the display of an order review page), you can specify this in the initial order setup so that the "Continue" button the buyer clicks to return to your site instead says "Pay Now".
I run a small marketplace with multiple sellers where buyers can buy items and pay with PayPal. The problem is, when someone makes a payment, they are then displayed the "Payment Confirmation" on the PayPal website and are given a choice to either return to their PayPal account, or return to the website.
Is there any way to keep the payment flow on my website, except for the payment part? I notice when buying on Etsy for example, the buyer goes to PayPal to make the payment and is then immediately returned to Etsy for the payment confirmation. They never see the PayPal payment confirmation page.
I assume it could be because Etsy and PayPal have a special arrangement that isn't available to other sites? Or am I missing something in the API?
Right now, with the normal PayPal API, this is what buyers see:
NAME, you've just completed your payment.
Your transaction ID for this payment is: XXXXXXXXXXXXXXXXXXXX.
We'll send a confirmation email to your#email.com
Go to PayPal account overview.
Go back to "seller#email.com".
I can't even figure out how to change the "Go back to..." link to my website name in the hidden fields. PayPal just chooses to display the seller's (the person that received the payment) email address.
Is there any way to at least set a website name for them to return to with hidden variables? Keep in mind that I have different sellers, so it's not something I could set inside each seller's PayPal account.
Thank you :)
I assume you are using Express Checkout with Set/Get/Do EC API integration. Please check the below document for experience options available with Express Checkout API.
https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECCustomizing/
The 'useraction=commit' in the PayPal payment auth url triigers the 'Buy' button. If you do not send that request paramter then it will show 'continue' button and you can complete rest of the process on your site.
However, if you are using Paypal Payment Standard product then you need to use Express Checkout to accomplish the outcome you are seeking.
After adding stuff in shopping cart, clicking some Pay Now with PayPal button, and successful PayPal payment (PP or CC), it is logically possible that a user stays on PayPal website, if for example the Auto Return option isn't activated (or it is but it doesn't work because the user is a guest user without PP account)
The user can return to the site by clicking a link, but doesn't have to. My question is: if he doesn't, how will the site owner be aware that the user paid so that he can now send the items by post? That the site owner gets informed of being paid seems elemental to me, so I find incomprehensible that such elemental thing be left to some obscure Auto-Return option.
Please can somebody explain this to me?
This is a common challenge with any redirected payment gateway, and it's the reason most (if not all) of them implement some sort of asynchronous notification that a payment has been completed. In PayPal, this is the Instant Payment Notification (IPN). You must setup on your site either a generic IPN listener that you link to from your PayPal account profile settings or you can create a more targeted IPN listener specifically for your transactions and use the NOTIFYURL (or related) parameter in the form or API request you use to redirect to PayPal to send IPNs to that listener.
In my integrations, I never perform any order update or transaction logging when the customer returns from the site, preferring instead to wait for the IPN that I can validate and ensure came from PayPal as opposed to a spoofed return from someone trying to hack my checkout process.
For more information, see the IPN documentation: https://www.x.com/developers/paypal/documentation-tools/ipn/integration-guide/IPNIntro
Paypal provide IPN for this purpose through which we paypal send request asynchronous to your site and you can perform whichever action you want
I think the point may have been missed here. Or a problem does exist. If the purchaser uses CC, even if you have IPN set up and it works, but if the purchaser uses CC and does not click a button on the last page, which is not presented when using PP account, it is possible for the funds to go through, but no IPN, and so your website is unaware of the purchase. This last page, is an extra page that CC user gets after the page with the Pay button on it.
In this state, you can even go into IPN history, and the IPN is there, says it is sent, but it hasn't been. It does not get sent until after the purchaser clicks the button on the extra page and then they are taken to the auto return page.
So I'm working with Express Checkout and everything seems to be going well. I noticed a strange thing though, in about 1 out of 1000 payments, the routine is the following:
All good during SetExpressCheckoutPayment, sending to PayPal
PayPal processes the payment, returns the user to to my RETURNURL
I charge the user with DoExpressCheckoutPayment and get the success response, yey!
A few seconds later PayPal sends me an IPN with a successful payment, cool!
Around 30 seconds later, my CANCELURL gets hit with that same token
Now that's confusing. Checking the transaction with GetTransactionDetails says Completed, but my user's purchase is set to Cancelled. One way would be to simply ignore a CANCELURL hit on successful transactions, but I'd really like to know why is this happening.
Have you ever noticed the same thing happening on your site? Any idea what the user workflow might be to generate such a glitch? Any other workaround ideas except ignoring calls to CANCELURL after a successful payment?
Thanks all!
I have noticed sometimes the mini browser is not faded when you click on "pay now" button (see Express Checkout for Digital Goods : can click several times on Pay now button).
So maybe your users click on pay, nothing seems to happen for them so they click on cancel link.
I'm looking for a way to prevent this (clicking on "cancel" or twice on "pay now"), if you know how...
I have integrated paypal express-checkout in a website. All seems to work fine. When customer is redirected to paypal for payment, the button Pay Now appears, since I am using:useraction=commit, i.e.:
https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=MYTOKEN&useraction=commit
Customer logs in from Paypal and clicks on the Pay Now button. Paypal gives no error, everything seems to be successful and customer is redirected at the RETURNURL, but no transaction is created in the buyer or in the seller account.
I'm afraid I missed some points from Paypal API documentation.useraction=commit will NOT complete the transaction. After returning from Paypal, we still need to execute DoExpressCheckoutPayment in order to complete the transaction.
Like George said, useraction=commit does not complete the transaction. It only changes the PayPal UI so the customer feels they have confirmed it there, so you don't have to add confirmation UI on your site. You still need to make the request behind the scenes to confirm it.
PayPal's docs say this:
The useraction URL parameter in your redirect to PayPal determines
whether buyers complete their purchases on PayPal or on your website.
If you set useraction to commit, PayPal sets the button text to Pay
Now on the PayPal Review your informaton page. This text lets buyers
know that they complete their purchases if they click the button.
After PayPal redirects buyers to your site, call
GetExpressCheckoutDetails and DoExpressCheckoutPayment to have PayPal
complete the payment successfully. Call DoExpressCheckoutPayment
without waiting for buyer interaction. Use information in the
GetExpressCheckoutDetails response to fill out your order confirmation
page.