How to set and use includeTransactions with Authorize.net PHP SDK? - php

I and others have been working with the Authorize.net automatic recurring billing (ARB) portion of the API, trying to retrieve recent transactions related to a subscription.
The documentation (https://developer.authorize.net/api/reference/#recurring-billing-get-subscription-status) for ARBGetSubscriptionRequest states that there is an optional parameter includeTransactions that will return recent transactions associated with the subscription.
The PHP SDK seems to be missing the parameter includeTransactions.
In my call to Authorize.net, the following results in an error:
$subscription->setIncludeTransactions(true);
Has anyone managed to get it working?
Related github issues: #120, #280

I suspect that includeTransactions support has been implemented in the underlying Authorize.net API; however, the PHP SDK is woefully out of date. And no sample code has been forthcoming from Authorize.net (earliest request is from June 2016)
So, for my purposes, I forked the PHP SDK:
https://github.com/sjordan1975/sdk-php
I implemented get ARB Transaction from Get Subscription sufficient for what I needed.
Specifically, I modified the following 4 files:
lib/net/authorize/api/contract/v1/ARBGetSubscriptionRequest.php
lib/net/authorize/api/contract/v1/ARBSubscriptionMaskedType.php
lib/net/authorize/api/yml/v1/ARBGetSubscriptionRequest.yml
lib/net/authorize/api/yml/v1/ARBSubscriptionMaskedType.yml
Immediately after setting setSubscriptionID in the sample code (https://github.com/AuthorizeNet/sample-code-php/blob/master/RecurringBilling/get-subscription-status.php) add the following:
$request->setIncludeTransactions(true);
Note: I have used TransactionDetailsType whereas I suspect the actual type should be something like ARBTransactionType, but the yaml definition is missing and I have not defined it
The result is for now not all transaction data is populated; HOWEVER, transId IS populated and this is good enough to make an additional API call to get Transaction Details.
Feel free to have at it. Code provided AS IS to the Community. YMMV

Related

Google Calendar APIv3 - how to handle incoming resource change notification using webhook?

Using Google APIv3 I wish to synchronize my PHP webapp calendar with Google Calendar by creating a notification channel using a webhook on my server. As per the documentation of Google I did the necessary preparations (defining and validating webhook, creating the notification channel) in order to receive status update information from the Calendar using the watch method.
My issue is that I cannot figure out what to do with the incoming information - as per my understanding and as stated in these docs, my webhook should be notified not only about the fact of change, but it should get the actual change as well so I can avoid unnecessary processing. Unfortunately, the know-how on receiving these notification are quite vague and I cannot find where to look for the nature of change made to the Calendar resource.
Am I missing something? Do I have to get the resource using the identifier returned to the webhook and "manually" check differences or there is some technique I can use to update (or even more preferred patch, but I also do not understand how to do that in PHP) the changed Calendar resource on my webapp side? Is PHP even a suitable language to implement this?

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/

Invalid merchant configuration for paypal Direct Credit card payment

We have used DoDirectMethod to credit card payment and recurring payment with CreateRecurringPaymentsProfile Method. But Some how i can not get error "This transaction cannot be processed due to an invalid merchant configuration.".
I found some solution for this :
1)I have problem like : Features that are not enabled for live transactions
2) If for use of REST API ,
I need to change my country then how can i change country or currency.
3) In paypal errorcode i found : Occurs when you have not agreed to the billing agreement.
- Then how can i agreed billing agrrement- need steps for it.
Please help me by providing steps of configuration or any other solution.
PayPal is confusing peoples/developers completely, i am also getting the same issue from one month on one of our client's website, i was used DoDirectPayment, and it works like a charm for test transactions, but as i make it LIVE it is was showing the same issue, i found that too, to performing transactions in LIVE mode we need to 'Enable' this feature for Direct Credit Cards, but many times i requested them (PayPal) to enable that feature, but all time they just received my Application Online and reponsed that it will take about 24 hours. I have also added extra information like SSN, EIN all that but they are so lazy or not active to do that.
At one point they are saying we need Website Payments Pro but i have not found a single link to register that, I found PayPal Payments Pro link at many sites and even in their site, these guys have a huge documentation on that website payments pro and dodirect method but not a single link how to register for that service or how they enable that feature for 'Live' mode.
And today i found they updated their developers site and make things a little different, also provided an extra method "braintreegateway" in order to process, and i tried that too using their sandbox account, its working with only PHP 5.4 and above, so old PHP version servers are unable to get that. And they also need to register your details at their end.
If i have already a PayPal Business account why do i need to register at every single method.
Sucked

QuickBooks API error when updating

I'm attempting to use the QuickBooks API to sync up my company's product list with the workbook's item list. I have gotten through the OAuth system to be able to make read/write requests to the API, but always get an error while attempting to update an object.
The reference that I have been using is here, and within the same documentation is a reference to retrieving an object that I have been able to use just fine. This is the XML that I'm sending. I have been tweaking the XML for a few hours now to no avail.
The error message that I get is "QB item name already exists ERI=420962215". That ERI is my realm ID. It seems like QuickBooks thinks I am trying to add a new item, when I'm trying to modify an existing one. If I omit the name field or leave it null, it gives me an error as well.
The item that I am attempting to modify was created in QuickBooks, then synced through QuickBook's Sync Manager. I then authenticated my app to that workbook and have been able to read data easily. I only have an issue when I attempt to write. I have yet to try creating or deleting an object since I've been stalling out on updating.
I am trying to just set up a simple form on my company's site that will hit the API and update data when saving, but I can't find a way around this error.
Any help would be greatly appreciated. I began to have trouble on Friday and feel like I'm just spinning in circles now. I found a QuickBooks / PHP library and tried looking through it to see if I could find useful information, but it was a bit too large for me to locate what I was looking for, since I think the error is just some incorrect XML.
I have followed all the directions within the update reference and just can't make progress. I've double and triple checked that my authentication works, that the URL is correct, that I'm sending POST and not GET and that my XML matches the XML shown in that example.
UPDATE 2012-03-15
It seems the problem is that the API is not able to update an item that was created through QuickBooks. Ever item has an id and an idDomain, which indicates if it was made through the API (NG) or Quickbooks (QB). An example id/idDomain would be 1/QB or 2556587/NG.
Whenever I was doing this, I was able to perfectly update an item that was made through the API, but not one made through Quickbooks. After looking into the Supported Object Reference, I noticed that item assembly update/create is listed as beta.
It seems that what I wrote in the update is correct. I am not able to update items that were made in quickbooks through the API. I can read items made in quickbooks, I can create items and I can edit items made through the API, but editing an item made in quickbooks through the API returns this error.
A few things:
What URL are you POSTing to?
Can you show the full HTTP response you're getting? IDS has a bad
habit of returning error messages/codes that are sometimes ambiguous
if you don't look at the full XML response.
Some of these fields are not updateable: QtyOnPurchaseOrder,
QtyOnSalesOrder
You do know you can only use IDS/Sync Manager for applications you're
going to resell to other companies, right? i.e. you can't use it for
internal/one-off apps.
You're going to get much better support if you post these questions
to Intuit's developer forums: https://idnforums.intuit.com/
You may consider migrating to QBO V3 it is way better and easy to work with.
there is a very good api made to for this purpose. which you can get here.
https://github.com/consolibyte/quickbooks-php (Made By : Keith Palmer)
i am using this and am very satisfied with it.

Paypal Checkout Express empty cart problem

I'm working on Paypal integration in my website, following Paypal's API specifications. I'm testing it in a sandbox, and after sending a SetExpressCheckout request like this:
CURRENCYCODE=EUR
&RETURNURL=http%3A%2F%2Fwww.xxxxxxxx
&CANCELURL=http%3A%2F%2Fwww.xxxxxxxx
&PAYMENTACTION=Sale
&L_PAYMENTREQUEST_0_NAME0=T-shirt+ring-spun+attillata%3B+taglia+L%3B+colore+Navy
&L_PAYMENTREQUEST_0_NUMBER0=0LLR7IQ-B0SIE+%28Product+%230LLR7IQ-B0SIE%29
&L_PAYMENTREQUEST_0_DESC0=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&L_PAYMENTREQUEST_0_AMT0=1.90
&L_PAYMENTREQUEST_0_QTY0=1
&L_PAYMENTREQUEST_0_NAME1=T-shirt+ring-spun+attillata%3B+taglia+M%3B+colore+Dark+Heather
&L_PAYMENTREQUEST_0_NUMBER1=0LLR7IQ-2KEI1+%28Product+%230LLR7IQ-2KEI1%29
&L_PAYMENTREQUEST_0_DESC1=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&L_PAYMENTREQUEST_0_AMT1=1.90
&L_PAYMENTREQUEST_0_QTY1=1
&L_PAYMENTREQUEST_0_NAME2=T-shirt+ring-spun+attillata%3B+taglia+S%3B+colore+White
&L_PAYMENTREQUEST_0_NUMBER2=0LLR7IQ-TFOHI+%28Product+%230LLR7IQ-TFOHI%29
&L_PAYMENTREQUEST_0_DESC2=160+g%2Fm%C2%B2%2C+100+%25+cotone+ring-spun%2C+pre-ristretto%2C+simple+jersey%2C+scollatura+arrotondata%2C+maniche+corte%2C+impunture+sulla+scollatura%2C+sul+bordo+delle+maniche+e+sulla+base%2C+cuciture+laterali.
&L_PAYMENTREQUEST_0_AMT2=1.59
&L_PAYMENTREQUEST_0_QTY2=1
&ITEMAMT=5.39
&TAXAMT=1.08
&SHIPPINGAMT=0.00
&AMT=6.47
&ALLOWNOTE=1
&USER=XXXXXXXX
&PWD=XXXXXXXX
&SIGNATURE=XXXXXXXX
&METHOD=SetExpressCheckout
&VERSION=53.0
I forward the user to here, which is the token Paypal gives me back in response to my first request.
The problem is that, despite the successful request with all prices set in, I have an empty Paypal review page, with absolutely no prices into.
What am I missing?
Attack of the poor API docs! Paypal sure tried hard, but they fall short. I've fought this API and won! :)
Change these values in what you already have... let me know if it takes care of the problem
&PAYMENTREQUEST_0_PAYMENTACTION=Sale [[ <--- payment action ]]
&PAYMENTREQUEST_0_CURRENCYCODE=EUR [[<-- currency code]]
&PAYMENTREQUEST_0_ITEMAMT=5.39 [[<---- subtotal here]]
&PAYMENTREQUEST_0_TAXAMT=1.08 [[<---- tax here]]
&PAYMENTREQUEST_0_SHIPPINGAMT=0.00 [[<---- shipping here]]
&PAYMENTREQUEST_0_AMT=6.47 [[<---- grand total here]]
&PAYMENTREQUEST_0_ALLOWNOTE=1
This one bugged me as well for a couple of days.
Using the Java SDK from developer.paypal.com (as of 2008), I finally came across a new version of the SDK (Nov 2011) at https://www.x.com/developers/paypal/documentation-tools/sdk#3
Using the new SDK (in particular, the updated paypal_base.jar) however did NOT yet solve my issue.
You have to figure out the correct API Version String to make it run. With version "51.0" (as in some of my example code), the call failed. As with version "78.0", the new SDK did the job.
Cheerio....
In addition to the other comments here, be sure to use the undocumented "useraction" option when you redirect to PayPal after getting the response from SetExpressCheckout:
?cmd=_express-checkout&useraction=commit&token=the-returned-token
(the link below no longer works)
Here's the PayPal forum reference to this parameter

Categories