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

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/.

Related

How to charge your own fees alongside Paypal?

I've searched everywhere in order to find an answer but have not found one. All i know is that in order to do it you need paypal adaptive payments i think (if you know another way let me know)
What im trying to do is make it so that when a user purchases a product 15% goes to one paypal account and the rest goes to the authors paypal account but have done loads of searching and have found nothing
PayPalAP::setAuth('my_api_username', 'my_api_password', 'my_api_signature');
// I'm not passing in an environment, which will default it to sandbox mode.
$options = array(
'cancelUrl' => 'http://my_cancel_url',
'returnUrl' => 'http://my_return_url',
'currencyCode' => 'USD',
'receiverEmailArray' => array('receiver_of_funds'),
'receiverAmountArray' => array('15'),
'ipnNotificationUrl' => 'http://my_ipn_listener_url'
);
$respo
Adaptive Payments would be the way with paypal ... But I would recommend using stripe for this kind of transaction. The API allows better control and was build for this kind of complexity. If you can replace paypal with stripe, do it. If not, you will need to contact paypal. They made this feature restricted.
Patrick Simard is correct that this feature is now restricted, but assuming you have received authorization from PayPal to use the adaptive API, then you have two option:
Chained Payments
Parallel Payments
Both will achieve the same end game, but which one you choose is ultimately up to you.
Chained Payments
With Chained Payments, you set up a payment option where the initial payment goes into one account, a portion is removed/left in that account, and then the rest is sent on to a second account.
Parallel Payments
Parallel Payments will produce a similar result, but rather than all of the funds being sent to one account first before being sent onwards, the money is instead sent to two different accounts immediately. (This option actually supports up to 6 accounts being paid at once.)
Examples of the HTTP I/O can be found on the linked documentation pages. You will simply need to set up cURL requests to create these. (Which should be a fairly straight forward process.)
To reiterate, though, heed the following notice from PayPal about using this API:
Important: Adaptive Payments is now a limited release product. It is restricted to select partners for approved use cases and should not be used for new integrations without guidance from PayPal.
This warning can be found at the top of documentation pages for Adaptive Pay.
Edit: In response to your comment, I have located a possible alternative that does not rely on the Adaptive Payments API, and seemingly does not require special permission from PayPal to use.
The option I found is to use Express Checkout with Parallel Payments. This utilizes the PayPal Name-Value Pair (NVP) and SOAP API. Some details on this option can found on this documentation page: https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECParallelPayments/
As a caution, though, that page seems to indicate that the NVP and SOAP API is deprecated. I am unsure what they are replacing it with, but at this time, it does still appear to be an opportunity, although you may have to update your code at some point when they release their replacement for NVP & SOAP and/or when they remove NVP & SOAP.
There is also a full list of SDKs, which includes an Express Checkout SDK written in PHP for the NVP & SOAP API: https://developer.paypal.com/docs/classic/api/nvpsoap-sdks/

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/

How to create flexible billing agreements using PHP Rest SDK?

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.

Paypal payments for digital goods

Hi I have some questions for paypal digital goods express checkout
I am following paypal tutorial on integrating payments for digital goods and using merchant sdk for same.But I want some suggestion and have some questions
Is there some other better alternative to integrate payment for digital goods ?
Should I configure IPN or can I rely on return url to save data on backend?
How can I make sure that data is from paypal both on return url and IPN .
As read I need to make request to https://www[.sandbox].paypal.com/cgi-bin/webscr/ with command cmd => _notify-validate [reference]
Is there any inbuilt function in sdk I am using or should I make manual call ?
re: #1, EC for Digital Goods is a solid choice for digital goods sales. If you don't need the digital-goods specific features you can also use PayPal's regular/plain EC or the newer RESTful products.
re: #2, EC doesn't do the payment until you make an API call (well, unless you explicitly ask it to with an added parameter). So you can use either the response from the DoEC API call or set up IPN. If you do choose to actually have the payment take place on PayPal's site you have some small chance of the user paying and not redirecting back successfully (e.g. they close the browser window, or the network hiccups). This should be very rare & you can probably handle it manually or with some other mechanism, but this is one reason people like IPNs: PayPal will try repeatedly to push you the info, so it requires more than a transient failure to not get the word (eventually).
re #3, it sounds like you know to validate the IPNs. And if you use GetExpressCheckout API calls you are hitting PP so again you can be certain of the source of the reply. This is one advantage the API integration model has over the redirection-based mechanisms in Website Payments Standard (although if you were using WPS you could use a feature called PDT to ask it to send you the same signature block as is used in IPN so you could post back to PP to validate the redirection contents).

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