Workflow Confusion: PayPal Cordova Plugin / Magento - php

I am a little bit confused by the Cordova plugin by PayPal in terms of what this means for implementing a safe workflow for interacting with a Magento instance.
Normally, the Express Checkout workflow looks like this:
Customer visits Magento Site checkout
Customer is directed to PayPal
Customer is returned to Magento Site
Customer clicks 'Place Order' on Magento Site
Magento Site converts quote to order
Magento Site accesses PayPal to capture / confirm funds, check for possible fraud, etc...
The workflow imposed by the Cordova plugin appears to be like this:
Customer visits App checkout
Customer is directed to PayPal
Payment is authorized or captured based upon the configuration
Customer is directed back to App
App executes a success handler
In the above Cordova Plugin workflow, notice that the step where a quote to order conversion is missing. From my perspective, I see two options:
Insert quote -> order conversion call between 2 and 3
Caveats:
The customer may not complete checkout and now an order is permanently orphaned in the system
The customer may wish to change something (which now can't happen -- orders can't be modified)
Insert quote -> order conversion call after 5
Caveats:
The client is being trusted to notify the server that the payment was made (which requires server-side cross-examination with PayPal / additional complexity)
The client may never actually send the notification.
I do not like any of the options presented above. Can anyone help clear up my confusion or show me what I hope that I'm missing?

I've found that I am able to provide a placeholder invoice number to the Cordova application to pass on to PayPal.
PayPal can then send this invoice number along with relevant transaction details to the Magento server via an IPN. This takes the client out of the picture and fits my needs.
So really the workflow is as follows:
The client clicks on the 'PayPal Button'
A request is sent to the Magento Server to create an order and placeholder invoice
The Magento Server provides the placeholder invoice number to the client
The order is now 'Pending Payment' in Magento
The client proceeds to PayPal to make the payment
If the client successfully pays, an IPN is sent to the Magento Server and the client is returned to the App payment success page
If the client fails to pay and fails to return to the app, the order will remain as 'Payment Pending' to be cancelled by a crontask every so often
If the client fails to pay and successfully returns to the app, the app will contact the Magento Server and immediately cancel the order
I'm severely disappointed by the lack of documentation / support for this product.

Related

Why are the funds in a transaction not transferred to the account automatically?

I have setup a Paypal payment environment, for the purpose of selling a certain service. I used Laravel to setup the API endpoints in the server for the creation and the approval of the order.
Whereas in the frontend, I used the paypal buttons, specifying the aforementioned API URL endpoints for the purpose of creating and capturing orders (onCreate and onApprove parameters of the button).
Everything is working as intended, the order is correctly created and verified before the payment is processed, but there's a small problem. For every new order, I have to go to the transaction log of my business account and manually click "Get your money" in order to actually transfer the funds to the account. (Refer to image with a couple of test payments).
With the increasing number of orders, this becomes a very tedious process. I don't quite understand why it is even implemented this way.
Is there a way to automatically transfer the funds to the account when a new order is made?
Have I made a mistake (or missed something) in the implementation of the payment gateway, or is there a default setting in the business account that I have to change?
Any help is greatly appreciated. Please let me know if you require any additional information.
Thank you in advance
Why is the payment pending? The screenshot does not show the details.
Is it a currency issue? If you don't have a balance of EUR on the account, open one if you want to receive payments as EUR, or change your payment receiving preferences to automatically convert to your primary currency balance.
Is the payment an authorization? If so the integration facilitating the creation of these transactions needs to be changed to create transactions that are of type "sale" or immediate capture, rather than authorizations for later capture.

How can I make an automatic PayPal buy button?

I want my PHP web application to have the ability to save the user's PayPal details in their user account.
When they go to purchase items, rather than going through the standard PayPal form, it will automatically grab the user's PayPal details from their user account, and make the payment directly from my website. There is definitely a way to do this, as I have seen this feature on sites such as Freelancer.com
Thanks for the help! :)
No, you don't need Payments Pro for that. That would only be if you want to do it with direct credit cards. What you're after in general is called Reference Transactions, and when done with PayPal Express Checkout it uses Billing Agreements.
You'll use Express Checkout and/or Payments Pro (optional) to process an original authorization or sale transaction. Then, you can send that ID you get back in that original transaction along with a new amount in the DoReferenceTransaction API and that new amount will be instantly processed without any redirection or further authorization required.

Committing payment on sellers website

I am working on a project which will be able to accept paypal payments. The sequence I am using is as follows:
My current development sites' payment steps:
The user goes to my site,
Chooses to pay for something,
Is redirected to paypal,
The payment is completed on paypal,
Then the user gets redirected back to my sites success url.
This works fine, as I use an IPN listener to update my database in the background when paypal decides to confirm the committed payment and let the user know accordingly.
However, a few days ago, I was doing some online shopping of my own, and paid using paypal. I noticed that when I paid, I was redirected to paypal, where I logged in and saw the paypal invoice. I clicked confirm, and I was redirected back to the sellers website, where I so a summary and was told to commit the purchase!!!
So basically, the sequence was something like this:
My shopping experience from a different sellers site:
I wanted to pay for the items,
I was redirected to paypal,
I was the invoice and confirmed the payment,
I was redirected to the sellers site,
I was was shown a confirmation of the order and was asked to commit the payment,
I committed the payment and was told that the order has been completed.
The difference, my site commits the purchase on the paypal website and I listen for a reponse from paypal using their IPN system, but this second site seems to commit the payment on the sellers actual website.
I thought, wow, that felt so much more reassuring from a user experience point of view.
How is that done?
Sounds like you're currently using Payments Standard and you want Express Checkout.
Express Checkout is very similar to Standard except that it's API based and the user gets returned to your site prior to finalizing the payment.
It consists of 3 API calls...
1) SetExpressCheckout - gets a token back from PayPal that you append to the end of a redirect URL that sends the person over to PayPal to login and review the payment.
2) GetExpressCheckoutDetails - This allows you to pull the payer details (name, phone, shipping address, etc.) back into your app from PayPal. This is an optional step.
3) DoExpressCheckoutPayament - this finalizes the payment. No money is moved until this API call happens, and it doesn't happen, of course, until the user is already back at your site and within your own app flow again.
You can still use IPN the way you are, but you could also things directly within the flow as well since you get instant responses back from the API, and you can setup your own review however you want to.

Paypal IPN needed?

I'm doing a project involving Paypal, more specifically with the NVP API in PHP. But I just can't seem to figure what to use the IPN feature for.
I mean, when the user has been redirected to Paypal to confirm the purchase, he is redirected back to my website's "Paypal-succes-page", when the transaction is complete. And just to be sure that he actually payed i could use the "PaymentDetails" operation.
Now where does IPN fit in this process? and what is the benefit of it?
Thanks
The integrate with PayPal's services you will notice there are three main channels (and IMO it's important to know this so you can decide the benefits for your application):
IPN: Instant Payment Notification
PDT: Payment Data Transfer
PayPal's API
To use PayPal's IPN you need to add a 'listener' script (example) and add the address to your PayPal account. Whenever an event occurs PayPal will send a message directly to your server via your listener and you then update your accounts appropriately. This is especially useful for running subscription services as events will occur in the background without user intervention and you can capture successful/failed recurring payments etc.
PayPal's PDT is a system for accepting data when a user is redirected back to your site from PayPal. For example, a user clicks 'Buy', they are directed to PayPal, enter information etc. Then, once the payment has been taken, they are redirected back to your site. PayPal can pass details about the transaction including whether it was successful or not so you can display the appropriate success/failed page from your site.
PayPal's API allows you to integrate more deeply with PayPal's services, and you would use this if you were managing payments directly from your site.
These services aren't mutually exclusive, so you can use any combination with your application.
I hope this helps
The IPN feature is a very useful feature which you should use to update your database in my opinion. Sure the user is redirected to your success-page after the purchase where you can validate the payment details.
But what if he closes (by accident or not) the browser before reaching your success page? You will never know the result of the transaction and you will never update your database or process his order accordingly.
When using the IPN you can be sure that the transaction result will always reach you because PayPal will keep on making an offline request to your IPN page until it has reached your servers.
Instant Payment Notification
The typical usage of the IPN is to validate the purchase and to let your script or management system know that the transaction is complete so your system can update any records you may have for your service.
But the most important part is that the transaction is validated.
IPN send all data about transaction to your server - price, items, contacts ... so you can check, if someone don't pay you only 1$ instead of 100$ and confirm your order. It prevets thiefs, cheaters, ... USE IT! ;)

How do I get data back from Paypal so I can alter my MySQL database accordingly?

I'm just starting out with Paypal, so this is a newbie question.
I've been going through the instructions for setting up Paypal subscription service, but I think I'm looking at the wrong thing.
What I want to acheive is to get back some kind of response from Paypal so that I can update the database on my web site to mark a registered user as having paid. Basically I have a flag in the database that says if the user is subscribed or not. I want to ensure that the user is marked as paid so long as their Paypal subscription is maintained.
While the instructions linked above do say how to set up a button to receive a payment, there's nothing there about getting any data back from Paypal.
I know there are terms like IPN and sandbox that are related to what I'm trying to do, but I can't find clear instructions for how to get started on this process. I'm just circling around and not getting anywhere.
Where do I start on setting this up? Where is there a clear beginner's tutorial?
Also, I'm using PHP/Javascript/MySQL on my website.
PayPal's IPN service is what you want to use. I've used it myself to do just what you're looking to do.
Instant Payment Notification (IPN) is PayPal's message service that
sends a notification when a transaction is affected. Once IPN is
integrated, sellers can automate their back office so they don’t have
to wait for payments to come in to trigger order fulfillment. IPN can
send notifications for these transactions:
Instant payments, including Express Checkout and direct credit card payments
eCheck payments and pending, completed, or denied status payments
Pending payments
Recurring payments and subscriptions
Authorizations
Disputes, chargebacks, reversals, and refunds
You can also view notifications on PayPal’s IPN History page and
resend them if you need to. As PayPal’s interface for handling
purchase confirmation and server-to-server communications, IPN can
also be used to manage and customize a variety of APIs and
communications, including:
Customize your website's response to customer purchases in seconds
Track customers via IPN "pass-through" variables
Notify sellers who deal mostly in software downloads and other digital, online goods
Track affiliate sales and commissions
Store transaction information in your own database
For more about IPN:
Technical Overview (link to new html version of docs on developer central)
Instant Payment Notification Guide (PDF)
Code Samples
I'm not sure if its the same thing, but I just setup my friends website with Express Checkout, and I wanted to add all paid orders to an orders table in my database.
After I call SetExpressCheckout, and the user is returned to my site after going through the purchase flow on Paypal's side,
I used the information from GetExpressCheckoutDetails.
Then, if DoExpressCheckoutPayment
is successful (also called from the "callback" page) I then do the appropriate work in my database as far as logging the order details. For you in this case, it could be updating a record for the user in the database.
Hope that helps a little.

Categories