Get transaction details in real time, Paypal - api

I am creating a website and instead of using a fully featured shopping cart I want to use the Paypal API to "automate" some functionality.
By that, the user clicks on the "buy now" button goes and makes payment to paypal, and I want them to be redirected back to my site so I can process some info for my database. I looked into IPN but it seems like an overkill. Is there any simpler way of doing it?

You should look at either IPN or Express Checkout.
If you are using web standard payments it is important to note that a customer does not have to return to your page, once they hit pay on the Paypal site - the transaction is complete. Hence relying on them to return to your page to do a database update is a bad idea. This is where IPN comes into play.
Express Checkout gets around this by allowing the customer to authorize on Paypal and complete a transaction on your site. Passing the data directly to your site once the transaction is complete.

Related

A good way to check if the payment form was left off in between

We use PayPal to accept donations on our website. The problem we're facing is usually this happens that a user clicks on the pay button on our website but then for some reason drops from PayPal.
Is there a way through the PayPal API we could check that the user for some reason left off the transaction or maybe his transaction was denied.
No there is not; keep track of that drop off yourself if they don't come back or you don't get a resulting transaction.
If you are not using an API to accept the donations, then to be notified of resulting transactions you can use Webhooks. A parameter you can use for reconciliation is custom, which can be set at the moment the user clicks 'Pay' and you redirect them to PayPal.
(But if you are using an API, then the API is your notification already)

Paypal rest api express checkout with no shipping field (WebProfile handling)

I'm using Paypal rest api to make payment
the workflow is:
Create payment
Redirect to approval Url
User approved (return back to my site)
Execute payment
But there's one thing that I don't want users re-filling shipping address again because it was filled in my website.
So I change the workflow to:
Create web profile (set no shipping field)
Get web profile ID
Create payment with experienceProfileId given
Redirect to approval Url
User approved (return back to my site)
Execute payment
But I found this will create a lots WebProfile every time user request payment.
I think it is crazy to do:
create and delete it later again and again
attempt listing WebProfiles and check which is the one I want to use every time while creating payment
store experienceProfileId as a constant
What is the best practice for handling WebProfile or does there any solution just hiding shipping address while user approving payments?
Maybe this is not the answer regarding this "WebProfile". As a fact, I dont know what exactly "WebProfile" does or is.
I worked on the same Workflow these days. As you wrote I needed to predefine some address. For me it was obvious, that I have to do the database-stuff on my Website. Then I exactly define the order, shipping_address, etc. and send the users to Paypal.
If you predefine the new ShippingAddress() to your ´new ItemList()´ by
$itemlist->setShippingAddress($shippingaddress) the user cannot change it within the Process.
http://i.imgur.com/nAg8jxU.png
Maybe this helps you a little.

How To Know if a paypal transaction is succeed?

I am creating a website where user can buy digital stuff. Its not downloadable material or something like, just a sensitive data.
I used paypal payment button and integrated it to my website. I tested it using paypal sandbox. So, i would like to perform a certain action once the user purchase the item and roll back to the site. So please tell me how it is possible?
For any post-transaction processing you want to do you should use Instant Payment Notification (IPN).
Instant Payment Notification (IPN) is a message service that automatically notifies merchants of events related to PayPal transactions. Merchants can use it to automate back-office and administrative functions, like automatically fulfilling orders and providing customers with order status.
For PHP PayPal provides a basic IPN script to get you started. Alternatively, you could take a look at this IPN template solution I put together many years ago. It has an installer that sets up a MySQL database for you, and then it automatically saves all of the IPN into the database and emails you notifications. You could start with that and then easily customize it to suit your needs.

Shopify / Paypal Express: Shipping cost not showing until after payment

Ok so I got the following problem with my Shopify shop: Because my shipping varies based on weight paypal does not show the shipping rate until after the customer has logged in and paid for it. It then gets send back to Shopify where it receives the message that it will be billed an additional $10 for shipping, which already got me some complaints.
So what I want is that it will already shows the shipping cost before the customer logs in and pays for it. I imagined that more people had this problem and perhaps found a solution to fix this?
Thank you
There are a number of ways to handle this with the PayPal system, but I'm not sure if Shopify is open enough for you to make any changes. You'll probably need to ask them how it's configured and see if you have any option to adjust it.
The standard flow for Express Checkout is that you would show the user their cart and any fees you've gathered at that point so you can generate the subtotal. Then you send them over to PayPal where they login and agree, and are then sent back to your site. Back at your site you would obtain the shipping address from PayPal and you could then display a final review page that breaks down any additional shipping, tax, etc. that might be applied now that you know their shipping address. No money would actually be charged until they approve this final review page.
In order to skip the additional review page on your own site, PayPal introduced the Instant Update API a few years ago. This gives you the ability to generate a web service that PayPal's review page will call and send the shipping address so that the service can calculate shipping and tax and return it back to PayPal. The PayPal review would then update accordingly so the buyer can choose their shipping option and see the grand total on the PayPal review page. That way they can finalize and would still be returned to your site, but you wouldn't need to show another review. You could simply show the thank you / receipt page.
I'm not sure if that first method I outlined is in fact what you're getting..?? It sounds like you're saying that Shopify is skipping the extra review, finalizing the payment, and then simply notifying the user that more money was charged than they agreed to. If that's the case, I would say that's very sloppy checkout design.
Again, though, as Shopify is a hosted solution, you probably won't have the ability to adjust this on your own. It's possible they have the Instant Update API available, though, and maybe you just need to enable it..??
You'll need to check with them for more details about your options.

Confused as to which PayPal api to use for generic payments?

I'm building a small cart app in PHP which needs to have PayPal integrated into it for payments.
Checking the PP developer site you get 100 different APIs for every kind of job, however there is no clear answer as to which is the GENERIC API I should use to accept payments in the classic manner most webshops implement:
1. Client clicks pay
2. Redirected to PP site where he is asked to login.
3. After login he is presented with confirmation, he clicks OK.
4. Browser redirects back to my cart which presents user with a "Thank you" message, order code etc, while in the background a request is sent to my cart with the transaction credentials (transaction id, success status etc).
By the way, I'm not looking for Express Checkout since in this case PP provides the shipping info.
You could use the DoDirectPayment API to process payments. This will keep the buyer on your site, and they will enter in the information on your site. Then you will pass the details over to PayPal through an API call, and PayPal will then send the response back to you if the payment is approved.
If you are not wanting to use the DoDirectPayment API and are wanting to direct the buyer over to PayPal's pages to complete the payment but do not want to use Express Checkout, you could use PayPal Payments Adv/Payflow.
Express Checkout is what you want. Shipping info can be set on your end or Paypal end. It makes no difference.