On Paypal Sandbox:
After logging in using a test account and then clicking the "Pay Now" button, the user is redirected to "Thanks for your order" page inside Paypal. The page has three(3) links below the message that says:
Return to Test Store
Go to PayPal account overview
Add funds from your bank
Clicking the "Return to Test Store" will redirect me to the return URL I specified on my query string. This marks the order as "Completed" or whatever the value of the payment_status returned by Paypal is.
The Problem:
Clicking the other links bypasses the return URL and goes to user account profile which leaves the order incomplete even if the transaction was successfully paid because the return URL has the script to mark the outcome of the transaction.
The Question:
Is there a way to bypass the Thank you page and just redirect to my return URL so the transaction can be concluded accordingly?
BTW, I have my Test Business Account set to autoredirect to the return URL after the order.
You want to read about PayPal's Instant Payment Notification and about Identifying Your IPN Listener to PayPal.
You have the option to be notified whenever a transaction takes place, regardless of what users clicks on. Paypal's servers will make requests to a Notification URL you provide and give you informations about that transaction.
Related
I use java checkout-sdk-1.0.4 to develop PayPal payment. I successfully submit an order to PayPal, get the payment url.
I log in with personal account and click the continue button.
And then paypal just redirect to the url i set.
http://localhost:38001/checkout/submit/result?token=60X99286YV4394812&PayerID=9WXE2YPSNEJSN
I can see the api call history in developer dashboard.
But i can't see any transaction history in my business account and personal account.
How do I determine if my payment is successful。
I try this tutorial from here
https://developer.paypal.com/docs/business/checkout/server-side-api-calls/create-order/
https://developer.paypal.com/docs/business/checkout/server-side-api-calls/capture-order/
At the end, paypal return capture success.
Status Code: 201
Status: COMPLETED
Order ID: 1AL061567P026410J
Links:
self: https://api.sandbox.paypal.com/v2/checkout/orders/1AL061567P026410J
Capture ids:
6NY33838LX3268618
But i still can't see transaction history in my personal test account.
But I can't see any transaction history in my business account and personal account. enter image description here
You can't see any transaction because there is no transaction. There won't be any, unless you show the required order review page and perform the required capture API call when the customer returns to your site. (if you want to skip showing a review page and proceed directly with making the API call, then you should set the application_context object's user_action to 'PAY_NOW', so the last button's text is changed from 'Continue' to 'Pay Now' and the user knows to expect no review page. You still need to perform the API call to capture regardless).
The flow you are using of redirecting over to PayPal and then showing a review page or doing a capture call after being redirected back, is an old checkout flow and does not provide the best user experience. It is better to not use any redirects. At all.
Instead, make two routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return only JSON data (no HTML or text). The latter one should (on success) store the payment details in your database before it does the return (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID)
Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
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".
Trying to Accomplish:
In checking out using PayPal Express lightbox pops up and displays "Pay Now." I bypass the order review page and send user to an order confirmation page that completes payment and displays confirmation.
Problem: PayPal will sometimes display lightbox overlay with "Pay Now" and sometimes redirect the whole page to a legacy paypal page that shows "Continue - You're almost done. You will confirm your payment on New Owner's Test Store."
Why this is a problem?
They get sent to an order confirmation page that bypasses an order review page, it would look strange if they click continue and they are immediately transferred to a payment success order confirmation page.
Technical details:
URL they are sent to after handshake for token-https://www.sandbox.paypal.com/checkoutnow?useraction=commit&token=&useraction=commit#/checkout/login
Fallback URL they sometimes get redirected to-https://www.sandbox.paypal.com/webapps/hermes/fallback?product=ec&reason=hermes_to_legacy&fallback=1&incontext=1&token=&useraction=commit
-The fallback URL shows users 'continue' even though I selected commit (ie.pay now)
What I don't know how to do:
I don't know how I can create a catch on the return URL in the response I get from PayPal so I know whether or not the user was shown a "Pay Now" button or a "Continue - You're almost done. You will confirm your payment on New Owner's Test Store." If they were shown "Pay Now", I want it to show a payment confirmation page, if they are shown "Continue" I want to not call the DoExpressCheckoutPayment and instead show a "Complete Order" button which will then call the DoExpressCheckoutPayment and show them then payment confirmation.
Note: I am working in the Sandbox.
There is a success url option when you create the buy now button. But also there is this option on Website Payment Preferences. What I wonder is, are users auto redirected to success url or return url ?
When creating the buttons, the success url that you set in the button code will override the return URL that you set in the account. Also keep in mind that buyers only making a payment with a PayPal account will be automatically returned to your site. Buyers that make the payment using a credit card, will have to click a link/button once they have made the payment on the PayPal page to return to your site. This is done so that they can either print a copy of the receipt from that page, write the info down or etc before they are returned to your site. Unlike buyers that use PayPal accounts to make the payment, these buyers that use credit cards can not always get back to these details. Some one that pays with their PayPal account can simply log into their account and view these details at any time.
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.