Making a payment later with PayPal REST APIs - paypal

I'm trying to use PayPal REST APIs instead of Classic APIs for forward compatibility. What I want to do is to save user details and make a payment later. The point of making a payment could be several months later. It seems it's possible with the Class APIs, though it looks not perfect.
However, I cannot find how to do that with REST APIs. It seems not possible, but I want to check if I missed something.
These what I found.
I can make an order and capture it later, but an order is valid only for 29 days.
I can make a recurring charge with billing plans, but the point of making a payment is undefined in my case.
I can save user's credit card detail in the Vault and use it later, but I don't want to make users put their credit card details.
So, in this case should I use the Class APIs?

Related

How can I save user card details and make payment later in PayPal?

In Paypal, I m trying to implemen t a Auto payment system using paypal. Where user can save their card details then whenever the invoice is generated using card details invoice can be paid automatically.
I read the document of paypal but not found regarding that.
Please let me know how can I implement Auto payment system using PayPal.
There's quite a bit of information on the Subscriptions page, but most of that is a generic overview. However, there is link to the Integrate Subscriptions page that gives more links to specific API and SDK instructions.
Follow through the step-by-step information to get all this set up. It'll take a while to get everything correct, so definitely use their testing APIs so you aren't doing a bunch of tests on their production APIs and spending your own money doing it.
Once you get the subscriptions created and someone subscribed, PayPal does the rest. You just need to create the subscription and allow people to subscribe.
Also, PayPal keeps track of credit cards and other payment forms for you, so you don't have to go through all the PCI security procedures for storing that information yourself. That gets real involved and can cause you to get in serious trouble with fines and lawsuits if you aren't certified. It's much easier to use a payment processing gateway such as PayPal for this than create your own, especially since you are going to be using PayPal for processing the payments anyway.

Paypal fee applicable to all calls or just a particular set of apis

Does the paypal fee applicable to any call within their apis or a particular call?
For instance, if I use any call within the /billing-agreements apis, do I get charged the 2.9% or less, plus $0.30 per transaction?
If not, which api do I use that charges me?
In the case, it only charges me a particular api, does that mean all other apis are free to use? how many calls can I make per day/month/year?
Thanks for your help!
PayPal will only charge you on successful transaction, Meaning they will not charge you for setting up a billing agreements nor for looking up a transaction with API, They will only charge you when the transaction of that billing agreement go through.
They are not charging the API call directly.
I coundn't find anything on limits in the documentation and as far as I know you can do an unlimited number of API call to paypal
Check the following link for PayPal documentation
https://developer.paypal.com/docs/api/
EDIT After Comment
Im not exactly sure how it works.
But I think PayPal system is somewhat queued based, In the sense that some API call are for creating subscription, They wont charge on the API call, But they will charge on every transaction recurring every month.. You don't need to make a API call every month to make the charge go through,
but still you'll see charges on your account.
Some call like create_payment will have a response with "Successful"
But only after you also called payment_execute but wont tell you what transaction_fee you had.
To get what transaction_fee you had You need to call with an other API call after to get that information
payment_get

Paypal Rest API vs Classic Sdk

I am working with paypal first time.
I have a product and I want to integrate paypal with it.
I want to achieve the following tasks :
Client comes to my website and select a plan,which is a monthly recurring plan.
Then client is redirected to Paypal for payment.
Client makes payment.
Return backs to home page.
I have gone through the documentation of paypal and I have the following questions.
What should I use REST API or Classic Sdk, as I want to create Recurring Profile,Work with EXPRESS-CHECKOUT and REFERENCE TRANSACTIONS.
I have customers all over globe and it is stated in the documentation that, for the customers in Germany and China , I have to use REFERENCE TRANSACTION.
Some where in the documentation of Merchant SDK it is stated that the classic API's will be deprecated, so is it a good approach to use Classic SDK
I also wanted to track the transactions(payment) made by user, so that I can show him the amount that is deducted in each month in his profile details.
Please suggest a feasible solution to my problem.
Thanks in advance.
Here's what I use. I went to Web Payments Standard and created a Subscription button. (I like the unencrypted variety, but you can encrypt if you want.) In there, you set the terms of the subscription, as well as where to post the IPN message. When the IPN message comes back, you deal with it. You'll get a subscr_signup at the start along with a subscr_payment. Then, on renewals, you'll get a subscr_payment again. What I like to do is store every verified IPN message in the database for my customer.
For handling the management of those subscriptions for things like tracking info, refunds, subscription cancellations, and voids, you'll need to use NVP API, which is a very simple API. If you stored in a database every IPN message with all those fields, then you should be able to pass certain fields of those to the NVP API in order to get what you need done.
If you're worried about longevity of the APIs, then don't. All they do when they deprecate APIs is stop giving you good docs on them. They still let those older versions run. If they didn't, there would be major upheaval on the web with web commerce products breaking all over the place. However, that said, if you want to prepare for the future, then get on the Braintree Payments API because PayPal bought Braintree and that's the future of their API.

Best practice for integrating a single PayPal subscription?

I'm new to PayPal and overwhelmed by all the possible approaches for integrating with PayPal.
As a start I want to implement one single subscription with monthly recurring payment. When the user returns to the site after fulfilling the payment, he/she will instantly be upgraded to "premium" member (digital product only - no shipping involved).
The first alternative I've looked into is the Express Checkout API, which looks ok, but is there any simpler way to do it?
Can I for example create a standard button (JS button or the form based), but still be able to verify the payment details when the user returns, using either the REST API, IPN or something else?
Any hints on best practices are appreciated.
Yes, there are entirely too many ways to solve this problem by now.
You can probably satisfy your requirements via buttons (aka Standard), Express Checkout (aka Pro) style APIs, or RESTful APIs, but there are a few gotchas to know:
First, PayPal has several products to do recurring payments; these products have functional differences and are tied to different integration styles. So (for example) PayPal's product called "subscriptions" (tied to Website Standard aka buttons) has different (and generally less flexible) capabilities than "recurring payments" (tied to Express Checkout) which in turn differs from "billing agreements" (tied to REST APIs, although the term "billing agreements" is also used in the express checkout recurring payments product). Oh, and there's another similar product tied to the Adaptive Payments suite of APIs.
Confused yet? Sorry. But it is important to determine whether the specific product you want to use will satisfy your requirements first before you do any integration, or you might end up redoing that integration work later (and potentially have to migrate customers, if you have already opened your business) in order to get access to specific features of another product later on. E.g., the subscriptions product has very limited ability for sellers to modify the subscriptions after they are set up. If that is OK, then great, use it -- it's simple to integrate. If I can oversimplify a bit: the Standard subscriptions product is the oldest and most limited; the Pro recurring payments is more flexible and mature; the REST billing agreement product is the newest, very flexible, but not yet as widely used; it may lack a feature you need today, but is the most likely to be continually improved going forward. I would not personally recommend the Adaptive product, although it also has its benefits.
Now, to your integration question: fortunately all these PayPal products can use IPNs. Unfortunately, IPNs are not instant. They generally arrive quickly (1-2 seconds) but delays can happen and it is quite awkward to be unable to process the customer. I would use IPNs only when shipping physical goods, not for immediate access to digital goods or in other cases where customers are waiting for a page from you. Fortunately, each of the other methods has a way to instantly determine the success of a PayPal action without waiting for an IPN:
Website Standard Payments will include GET or POST variables when it posts the user back to your site that will tell you about the outcome. If you use the Payment Data Transfer feature, these variables will include signature information so that you can post them back to PayPal & PayPal will verify their validity (so that a would-be thief could not fool you by engineering a post that looks like a PayPal success redirect).
The two API-based methods are even easier: the APIs themselves return all the information you need in the API response. So wherever in your code you make the call to create the subscription/agreement, if you get back a success then do your work to make your user premium.
There is the odd case of a user successfully paying and then getting "lost", as it were, e.g. the redirect failing/browser closing before they return to your site, or your site choking while trying to turn on the user. For this reason many people advise using IPNs, which PayPal will attempt to redeliver until you verify them back to PayPal. Not a bad idea, depending.
And of course you can call search & get details type APIs to get information about your transactions & agreements at PayPal -- although again, you will need to integrate with the right API that matches the product you are integrated with (e.g. Standard-based subscriptions won't show up if you ask the REST interface for billing agreements).
Hope this helps.

Is it possible to automate payments through someone else's gateway?

Suppose some online retailer uses XYZ Bank's payment gateway. Is it possible to do the job of filling in card details and proceeding through the entire process using a script? If yes, is it legal?
Update:
To make the question more clear, I'll give a scenario.
Suppose the retailer we're talking about is Amazon, and I wan to use a card/netbanking (not PayPal). I want to be able to place an order on Amazon using a script which does the job of filling my cart and making the payment. Say the cart thing has been taken care of. How do I automate the payment process now? If it's allowed that is. Card details etc will not of some user, but my own, so no security issues with that I suppose.
The payment API would usually support something like this. For example, if we look at Paypal's direct payment api, they provide secure means for you to pass credit card numbers, etc to Paypal to process the payment.
If you are thinking to do this to process recurring payments, then you are doing it the wrong way. You should never store any credit card details unless you are PCI-DSS compliant. This takes a lot of work and auditing, so it is somewhat rare for small and medium companies to do it. For recurring payments, store the credit card numbers with your payment gateway (most should provide a means to do this) and the gateway should return a token to store. Every time you want to charge the card, simply pass the token to your gateway.
Given the new information:
What you are trying to do is to automate the browser (that's the best way to do it). You could write a script that connects to Amazon, loads the page, fills in the POST variable, send it back, get results and so on, but it is not very robust. For example, if amazon changes the name of a few post variables or even the markup, then your script would fail.
The best way to do this is to use a Browser Automation framework. Selenium is prbably the most popular and most well known. It is often used to automate testing user interfaces, but it is also useful for doing something like you are suggesting. You can use Selenium IDE which is a Firefox addon to quickly reproduce and replay recorded actions. For something more advanced and highly scriptable, try Selenium WebDriver.
As for whether this is legal or not, I don't see why it shouldn't be legal if you are using your own credit cards and what not.
If you are using your own credit card details it's at your own risk so very minimal legel issues. But it's always a good idea to store & transmit(SSL) card details encrypted for some peace of mind. But if it's for wider public you will need to look into PCI guidelines and matching class requirements.