How to get invoice details using PayPal API? - api

I must say, I can't remember the last time I've spent so much time figuring out an API. I loathe working with PayPal. That said...
I'm developing a seemingly simple script to download transactions into shipping software. I've got the script working to pull transactions in NVP and SOAP. But when a payment is on an invoice, the items purchased aren't included in the payment transaction info. So I'm assuming what I need is in the invoicing API.
I have API credentials that work just fine with TransactionSearch. I saw that for the Invoicing API, I also need an App Id, so I created an App, twice. Apparently there are two PayPal developer sites?? So I have a REST app created at developer.paypal.com and I guess a classic app "conditionally approved" at apps.paypal.com.
I guess after venting about the ridiculously unorganized developer structure and the sad excuse for documentation... !##$ ... I'd like to find out if anyone can get me on the right track.
All I need to be able to do is see what invoices have come in (start-end date, etc) and get the details so it can be exported to our shipping software. Transactions work just fine, I'm not sure why invoices are so different or why there's so much more involved in getting that data?
Just as a reference, here's how we're pulling in our transactions:
$client = new SoapClient( 'https://www.paypal.com/wsdl/PayPalSvc.wsdl',
array(
'location' => 'https://api-3t.paypal.com/2.0/',
'soap_version' => SOAP_1_1
));
$cred = array( 'Username' => $username,
'Password' => $password,
'Signature' => $signature
);
$Credentials = new stdClass();
$Credentials->Credentials = new SoapVar( $cred, SOAP_ENC_OBJECT, 'Credentials' );
$headers = new SoapVar( $Credentials,
SOAP_ENC_OBJECT,
'CustomSecurityHeaderType',
'urn:ebay:apis:eBLBaseComponents' );
$client->__setSoapHeaders( new SoapHeader( 'urn:ebay:api:PayPalAPI',
'RequesterCredentials',
$headers ));
$args = array(
'Version' => '94.0',
'StartDate' => '2014-03-25T00:00:00Z'
);
$TransactionSearchRequest = new stdClass();
$TransactionSearchRequest->TransactionSearchRequest = new SoapVar( $args,
SOAP_ENC_OBJECT,
'TransactionSearchRequestType',
'urn:ebay:api:PayPalAPI');
$params = new SoapVar($TransactionSearchRequest, SOAP_ENC_OBJECT, 'TransactionSearchRequest');
$result = $client->TransactionSearch($params);
print_r($result);

First, if you want to simplify your development with PayPal API's I'd recommend taking a look at my PHP class library for PayPal. It makes things much easier.
As for obtaining invoice details, you're correct that the Invoicing API is actually built on PayPal's Adaptive Payments platform which includes the App ID. I guess I'm a little confused on if you got that done or not..??
Once you have the APP ID, though, you can make the GetInvoiceDetails call to retrieve the invoice details.

Related

fetch all infusionsoft tags via api

I am writing an application and in one of my forms, I want to put in a listbox populated with all available tags from my client's InfusionSoft account. I am new to the InfusionSoft API and would greatly appreciate it if someone can point me toward the right direction.
Thanks
To get a list of all available tags, you'll want to query the ContactGroup table. That will return back a list of all available tags!
For example, if you were using the PHP iSDK, you could get the first 1,000 tags this way:
$app = new iSDK();
// perform authorization tasks
$returnFields = array('Id','GroupDescription', 'GroupName');
$query = array('GroupName' => '%');
$tags = $app->dsQuery("ContactGroup",1000,0,$query,$returnFields);

MailChimp API Get Subscribers ammount

I have been looking at the mailchimp api, and am wondering how to display the live ammount of subscribers to a list, is this possible? And is it possible to have this counter LIVE? I.e as users join, the number increases in real time?
EDIT:
I have been getting used to the API slightly...
after using Drewm's mailchimp php wrapper its starting to make more sense...
I have so far
// This is to tell WordPress our file requires Drewm/MailChimp.php.
require_once( 'src/Drewm/MailChimp.php' );
// This is for namespacing since Drew used that.
use \Drewm;
// Your Mailchimp API Key
$api = 'APIKEY';
$id = 'LISTID';
// Initializing the $MailChimp object
$MailChimp = new \Drewm\MailChimp($api);
$member_info = $MailChimp->call('lists/members', array(
'apikey' => $api,
'id' => $id // your mailchimp list id here
)
);
But not sure how to display these values, it's currently just saying 'array' when I echo $member_info, this maybe completly because of my ignorance in PHP. Any advice to s
I know this may be old, but maybe this will help someone else looking for this. Latest versions of API and PHP Files.
use \DrewM\MailChimp\MailChimp;
$MailChimp = new MailChimp($api_key);
$data = $MailChimp->get('lists');
print_r($data);// view output
$total_members = $data['lists'][0]['stats']['member_count'];
$list_id = $data['lists'][0]['id'];
$data['lists'][0] = First list. If you have more, then it would be like $data['lists'][1] ect...
And to get a list of members from a list:
$data = $MailChimp->get("lists/$list_id/members");
print_r($data['members']);// view output
foreach($data['members'] as $member){
$email = $member['email_address'];
$added = date('Y/m/d',strtotime($member['timestamp_opt']));
// I use reverse dates for sorting in a *datatable* so it properly sorts by date
}
You can view the print_r output to get what you want to get.

Access objects from project in sandbox environment PHP

Is there a way I can access my project under Sandbox? I'm able to use the lookup method, find in order to fetch all the features from a project under the Yahoo! subscription, but how would I be able to do this for projects under Sandbox?
In your PHP code have you used Rally sandbox server URL?
https://sandbox.rallydev.com/
Here is a WebServices URL specific to Sandbox:
https://sandbox.rallydev.com/slm/doc/webservice/
I was able to figure it out. In the query to find specific features, I had to include the query parameter "workspace" to the sandbox reference which is (for 1.43) : "https://rally1.rallydev.com/slm/webservice/1.43/workspace/7189290105.js". I included the reference of the project as well which directly fetched all the features for my project. In addition, if you seek to only fetch features from your specific project and not from the ones on top of it, you have to include the "pageScopeUp" field into the query. You have to set this field to false:
$queryParams = array(
'query' => "",
'fetch' => 'true',
'pagesize' => 100,
'start' => 1,
'workspace' => "https://rally1.rallydev.com/slm/webservice/1.43/workspace/7189290105.js",
'project' => "whatever the project reference is",
'projectScopeUp' => false
);
$results = Connection::rally()->findWithQueryParameters('feature',
$queryParams);

How to create configurable product using magento api?

How can I create a configurable product using the Magento api?
Your question of creating a configurable product using the API - the answer is: You can't. It doesn't support it (yet at least.)
This is possible with the magento-improve-api plugin. If you need to control which attributes your configurable product is configurable across, you'll need one of the forks of that plugin in
goodscloud/magento-improve-api
jdurand/magento-improve-api
dexteradeus/magento-improve-api
Here's a really good tutorial that walks you through patching the API, so you can use the API directly to create the configurable product, and assign simple products to it as well.
Good luck
Copy/pasted from http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#example_2._product_createviewupdatedelete
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
// default attribute set in my install is 4
$attribute_set_id = 4;
// configurable product to create
$product_sku = 123456789012;
$newProductData = array(
'name' => 'name of product',
// websites - Array of website ids to which you want to assign a new product
'websites' => array(1), // array(1,2,3,...)
'short_description' => 'short description',
'description' => 'description',
'price' => 12.05
);
$proxy->call($sessionId, 'product.create', array(
'configurable',
$attribute_set_id,
$product_sku,
$newProductData
));
The hard part is assigning simple products to your configurables (not supported via the api). Here's a method for assigning simples to configurables directly

Is it possible to set certain product attributes for a different store view using the Magento API?

We are currently using the Magento API for importing a bunch of products into the store.
But we now run into a problem where some product attributes should be translated into a different language.
And I was wondering if it is possible to do this using the Magento API, because I can't seem to find anything related to that problem.
We currently have 2 store views, 1 for the Dutch version of the site and one for the French version of the site.
Our current import code looks something like this:
$store_id = $soapClient->call($soapSession, 'catalog_product.currentStore', array('nl'));
echo("store_id: $store_id");
$new_product_data = array(
'name' => 'NameInDutch',
'short_description' => 'DescriptionInDutch',
'price' => $price,
'weight' => $weight,
'websites' => array('base'),
'status' => '1'
);
$new_product_id = $soapClient->call($soapSession, 'catalog_product.create', array('simple', 4, $sku, $new_product_data)); // 4 => 'Default' attribute set
$localized_product_data = array(
'name' => 'NameInFrench',
'short_description' => 'DescriptionInFrench'
);
$store_id = $soapClient->call($soapSession, 'catalog_product.currentStore', array('fr'));
echo("store_id: $store_id");
$soapClient->call($soapSession, 'catalog_product.update', array($sku, $localized_product_data ));
Now, the output of the echo statements differs, the first time it's 1 and the second time it's 2, so that doesn't seem to be problem. But apparently it doesn't matter for the API if we set that value.
The result is that on the 'catalog_product.update' call, the name 'NameInFrench' overwrites the default name 'NameInDutch'.
So my question is if something like this is possible using the Magento API, and how one would accomplish this?
Ok, I found the answer, apparently I overlooked a certain line in the Magento API docs, because the solution was right there.
So: you don't need to set the currentStore each time, you just need to append the store id or code to the update array:
$soapClient->call(
$soapSession,
'catalog_product.update',
array($sku, $localized_product_data, 'fr')
);
This works perfectly.