How to create flexible billing agreements using PHP Rest SDK? - php

We need to create flexible billing plans for our customers, in which the timing and amount of the billing is flexible and should be determined by us. Just like a "utility bill" but with flexible charge date. Also, there's no purchasing involved upon agreeing of the customer, just his approval for us to charge his PayPal account.
After researching it we decided to go with "referenced transactions". I've read its documentation and the flow seems to be clear.
However, when I attempt to implement using PayPal's PHP REST SDK, I can't seem to find the methods that implement that flow, or some other description on how to achieve our needs using this SDK. For example, I can't find SetExpressCheckout in the PHP REST SDK.
Can anyone point out how we should implement our business needs as described above (1st paragraph) using the PHP REST SDK? I'm very aware of the rather good PayPal REST API documentation.
Thanks!

Unfortunately Reference Transaction is only available with the Classic APIs.
The only similar REST API is called "Future Payments". Unfortunately this API has only been implemented for the PayPal Mobile SDK. You cannot use it outside a native mobile app...
I'm afraid your only solution is to implement the PayPal Classic API with Reference Transaction.

Related

PayPal REST setup is too advanced for my users, is there an alternative?

I'm building a site on which I'll provide users with their own webshop.
The webshops need to be able to accept payments, and I've made the integration using PayPal's express checkout (Client-side REST).
I thought all was well, up until the point where I was writing the setup guide for my users.
In order for them to create REST credentials, they need to log into the developer portion of PayPal, create a sandbox account, and then create an app.
Compare that to how it was/is when using NVP/SOAP, where you log into your PayPal Business account, and basically just follow the flow to get your API credentials.
Furthermore the NVP/SOAP implementation of Express Checkout is deprecated, so I'd really like to avoid that implementation, if possible.
I feel like my options boil down to this:
Use REST and force my users to go through a somewhat confusing setup process.
OR
Use NVP/SOAP, which is deprecated, but has a much more streamlined setup process.
Am I missing something, or is this just how it is?
EDIT/UPDATE
I also reached out to PayPal support and received the following answer:
There is no other method to obtain REST API credentials other than logging into PayPal Developer and creating a REST application.
The only other 'method' available, would be to use Braintree Payments instead, which provides PayPal integration.
https://www.braintreepayments.com/en-dk?locale=en-dk
So all in all, there doesn't seem to be an "easy" way to get REST credentials
I'll accept the answer by neuromatter, as he is correct, it's always better to use non-deprecated APIs
Go with REST. When you're developing something new you should always avoid using something already deprecated. Usually large organizations will tell you if they plan to completely turn something off (and perhaps SOAP is too big for PayPal to end anytime soon) but you don't want to take that risk. Even worse than forcing your users to setup REST would be to force your users to setup SOAP then have to setup REST shortly thereafter because they ended support.
For context, have a look at the PayPal setup page for WooCommerce:
https://docs.woocommerce.com/document/paypal-standard/
As you can see they fully expect people to enter in credentials to configure their store. The only way around this really is if you wanted to offer a more full service product where for a fee you (or someone you employ) would be able to configure their store for them. But that's a separate discussion.

Paypal API List Withdraws

I'm implementing a PHP Web application that uses PayPal for payments. I'm using for all the things the REST API.
My problem is how can I get the list of withdraws from PayPal API?
I'm going to use the functionality to withdraw to a bank every day, but I will need to see, with the API, those withdraws...
Any idea? I'm a little bit lost after spending two days searching and trying page on google.
Thank you in advance,
Rui
I don't think the REST API supports it yet. The Classic API does, though, with the TransactionSearch API.
Our PayPal PHP SDK will make this very quick and easy for you to setup.

Is there a way to make set up reference transaction paypal's rest API

I'm trying to implement paypal using reference transactions, i read that NVP/SOAP API allows this creating a billing agreement and then reference this billing agreement ID for future payment requests.
I want to know if this is possible to achieve using the REST API.
I know that REST API allows to create billing plans and agreements for subscription plans, but this is not what i need, i need to handle recurring payments on my own, where users can approve the agreement on Paypal when they susbscribe on my app and then charge them periodically with a cron to the approved account on PayPal.
Is this possible? if so can anyone provide an example of the flow i must follow?
Thanks.
I'm going to go with no. What you want is Reference Transactions for the workflow your talking about.
Unfortunately, you can see in the base REST API bug tracker the following ticket Reference Transactions #44 which is tagged with the nvp-soap-parity tag meaning we don't have it in REST yet.
When I look through the REST API Reference for billing agreements, there's nothing that gives me hope that there's poorly publicized way to make it happen. And lastly when you look at PHP REST SDK Class Documentation, for the Plan class, it looks like there is nothing supported outside of plans that have a defined frequency and amount.
The good news is you can still use the merchant-sdk-php for now, even though NVP is apparently deprecated from Jan 1, 2017 forward. and then just plan to change things over to REST when the Reference Transactions bug is fixed.
Yes. Load the REST API reference and scroll down to the Billing Plans and Agreements section. You'll find chapters for "Create an agreement", "Execute an agreement", etc.
Meanwhile, Reference Transactions through REST are technically possible, but you have to get the feature approved by a paypal account manager. Paypal calls this "limited release".
Therefore, the feature is not included in the documentation which is officially linked, but in this "hidden" one: https://developer.paypal.com/limited-release/reference-transactions/

Authorize.Net: Authorization and Capturing Funds on AIM and ARB

I'm developing a shopping cart with both subscription and outright payments on Authorize.Net using PHP. The documentation is not language-specific so I checked the sample codes but none seems to have the answer.
QUESTION: How do we authorize and then capture funds later with Authorize.Net ARB and AIM?
Perspective A
ARB isn't supposed to be language specific, it is quite the opposite. ARB provides a SOAP or XML interface which allows any language/application that can communicate via SOAP or XML to post and receive responses to/from ARB.
I recommend SOAP over regular old XML; it is more strict and translates very well to OOP. You'll be most interested in PHP's SOAPClient. Use SoapClient to connect to the WSDL as described in Authorize.NET's ARB Guide on page 11: https://api.authorize.net/soap/v1/Service.asmx?WSDL
Perspective B
However, if you would like ready-made APIs in your language of choice (PHP), Authorize.NET has SDKs available for download and use. See http://developer.authorize.net/downloads/#mobile_sdks
Notice in the support table that PHP supports Automated Recurring Billing (ARB), Server Integration Method (SIM), and Advanced Integration Method (AIM). On that same downloads page, sample applications are available in your language of choice.
To AUTHORIZE immediately, and CAPTURE later
First, the AIM docs are located at http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm, and navigate to "Submitting Transactions" > "Credit Card Transaction Types" > "Authorization Only" and "Prior Authorization and Capture"
Perform a x_type=AUTH_ONLY
Then at a later date perform a x_type=PRIOR_AUTH_CAPTURE with a x_trans_id=$ID
Without reinventing the wheel, PHP sample code is available for download (free) at http://developer.authorize.net/resources/files/samplecode/php_aim.zip in regards to AIM.
Authorize.NET's API is well documented and they have plenty of sample code... that is if you know where to look.
Developer Account
Authorze.NET provides a free developer account and sandbox to play with for DPM, SIM and AIM. See http://developer.authorize.net/integration/fifteenminutes/ and sign up at https://developer.authorize.net/testaccount/.

Using Paypal Adaptive Payments API like Kickstarter uses Amazon Payments?

I'm wondering if it's possible to use Paypal Adaptive Payments in the way that Kickstarter.com are using Amazon Payments to collect/fundraise.
For example: A user sets up a project. People pledge $5 to that project, and if it meets a goal, the system then automatically extracts the money from everyone, and puts it into user who created the projects paypal account. Is this possible using Paypal?
Are there any good PHP libraries supporting Adaptive Payments, if this is possible?
I was also looking for the same answer since I am working on a similar crowdfunding platform as Kickstarter is, but I need to use PayPal.
After a lot of Googling and reading about PayPal's Adaptive Payments API I found out that it's possible by using the Preapproval API and then if the project is funded I can use Chained Payments to send the money to the project creator and to also retain a small fee (a percentage) for using the crowdfunding platform.
If you are looking for some PHP libraries you can found 2 versions at the links below.
One is a library for the CodeIgniter framework and the other one is a PHP API class that can be used anywhere. So, here are the links:
CodeIgniter Library - http://www.binpress.com/app/paypal-adaptive-payments-pro-codeigniter-library/140
PHP API Class - http://www.binpress.com/app/php-paypal-pro-adaptive-api-class/612
I see now that your question is 2 years old, I just hope this answer helps others looking for answers regarding PayPal's Adaptive Payments API.
Yes, it is possible using the Adaptive Payments Preapproval API. When someone 'pledges' would be when you set up the preapproval, and then you can run that preapproved transaction at some future time without any additional interaction required.
PayPal has developed a PHP SDK with libraries and examples to get you started.
If you're going to use PayPal, there's a good Ruby gem: adaptivepayments-sdk-ruby
This answer is a couple of years late but better late than never! The one downside to using the Adaptive Payments Preapproval API for a Kickstarter type of system is that you can't guarantee the "pledge" will be valid when you go to make the withdrawal, since it is possible for the user to cancel their pledge at any time.
I've been working on a crowdfunding project similar to kickstarter. I started out using paypal's adaptive payments for this kind of thing but I eventually switched to wepay's preapproval api. I'm glad I did. For one thing, their documentation is clearer and better organized with good examples in PHP, Ruby and Python.

Categories