As you can see in the image below, I have 1 subscription active in my Stripe Test environment.
But when I try to retrieve this subscription through the endpoint GET /v1/subscriptions it comes empty.
https://stripe.com/docs/api/subscriptions
$stripe = new \Stripe\StripeClient(env('STRIPE_SECRET'));
$list = $stripe->subscriptions->all();
print_r($list);
The result:
Stripe\Collection Object
(
[object] => list
[data] => Array
(
)
[has_more] =>
[url] => /v1/subscriptions
)
I have double checked and I'm using the test keys.
Also, if I try to retrieve the single subscription using the endpoint GET /v1/subscriptions/:id:
$stripe->subscriptions->retrieve('sub_....', []);
It returns the error:
No such subscription 'sub_.....'
And the ID is totally correct (just copied and paste from Stripe dashboard).
If you cannot retrieve the subscription directly by ID, you are likely mixing up keys from a different account. Double check the account you're logged in to and which account the keys belong to and try again.
Related
I had made a simple APP which automatically creates my upwork invoices to my Invoice ninja setup but lately, upwork side broke. I saw that there were updates and changes on it but after my research, nothing changed in my specific call. After the authorization, I am using the following call:
$finreports = new \Upwork\API\Routers\Reports\Finance\Accounts($upwork_client);
$freelancerReference = "8009XXX";
$params = array(
"tq" => "SELECT amount, notes WHERE date >= '2018-06-01' AND date <= '2018-06-30'"
);
$results = $finreports->getOwned($freelancerReference, $params);
echo "<pre>".print_r($results, true)."</pre>";
and i am receiving this:
stdClass Object
(
[version] => 0.6
[status] => error
[errors] => Array
(
[0] => stdClass Object
(
[reason] => invalid_query
[message] => Internal Server Error
)
)
The auth seems OK because I can successfully get the response from:
$auth->getUserInfo();
it's a pity to hear that your reporting system stopped working correctly. Unfortunately, you use the API which is marked for deprecation. Inherently, the changes are being rolled out, and that seems to be the root of the issue you experience - see the proper announce.
Since mnovozhilov is the author on the Upwork API library files that I've read, it is great to have his confimation that the Accounts API has been deprecated.
Perhaps you can get the information you need through billings. Just a note that the API documentation says to use:
from upwork.routers.reports import billings
But for the version I have, there is an extra finance folder, so I need to use:
from upwork.routers.reports.finance import billings
I've been checking my paths by looking in File Explorer at the install folder\Lib\site-packages\upwork...., to see where the import files are located.
With your team reference you can use get_by_buyers_team(self, buyer_team_reference, params)
With your company reference you can use get_by_buyers_company(self, buyer_company_reference, params)
Trying to synchronize member information from Mailchimp to our local DB. We are able to request the information, but we get back only the FNAME, LNAME and BIRTHDAY fields. We are calling the function:
$mailchimp_v3_service->get_list_members($list_id, $count, $offset)
And are getting back a list of stdClass objects:
stdClass Object
(
[id] => <an id>
[email_address] => <an email>
[unique_email_id] => <a unique email id>
[status] => unsubscribed
[merge_fields] => stdClass Object
(
[FNAME] => Testable
[LNAME] => Contact
[BIRTHDAY] =>
)
)
Looking at the function call inside the Mailchimp code (MailchimpV3Service.php), it looks like it is requesting more/different fields than we are getting:
fields=members.id,members.email_address,members.status,members.unique_email_id,members.merge_fields.LNAME,members.merge_fields.FNAME,,members.merge_fields.PHONE
It looks like the function is requesting PHONE, and not requesting BIRTHDAY.
Any thoughts?
Ok, I figured out the issue - our support team was adding a phone number field to only certain accounts, depending on who needed it. If there is no phone field, it's just not returned. Lesson learned: check your "List fields and |MERGE| tags" section. 8-/
I'm a bit new to using the Facebook API and I'm currently trying to query the API for the user's profile picture. I am using this access-token return to get the user information when he/she logs in:
//Next get the user id of the current user, which is unique and will be used in the database
$response = file_get_contents("https://graph.facebook.com/me?fields=id,name,picture&access_token=$accessToken");
$data = json_decode($response);
print_r($data);
This print_r outputs:
stdClass Object ( [
id] => 0000000000000000
[name] => Username
[picture] => stdClass Object (
[data] => stdClass Object (
[is_silhouette] => [url] => valid_url )
)
)
However, the picture is low-resolution and also 50x50. How can I get a higher quality image and a higher dimension? I couldn't find any information in the API. I read the API (which added to my confusion), and it first asked me to add a redirect=false in my query (it was using an HTTP GET method)
I can specify it correctly in the http_get method
Fetch image based on Facebook id of user and you can get every size of image like below example :
Large : https://graph.facebook.com/{facebookId}/picture?type=large
You can change type based on your requirement here is the some type normal,small,square.
You can also use custom width and height for get any size profile picture by link http://graph.facebook.com/{facebook-user-id}/picture?width=1000&height=1000
and for type parameter you can use {small, normal, album, large, square}
i want to post content to wordpress from other php app. i am using rest api plugin for posting and for authentication i am using oath plugin.i just want to know how to get the access token .i am referring
https://github.com/WebDevStudios/WDS-WP-JSON-API-Connect
for the json_url in the code i use
eg(http://myproject.info/wpsingle/wp-content/plugins/my_plugin/json-rest-api/lib/wp-json.php)
ends up in error.
[errors] => Array ( [wp_json_api_connection_failed_error] => Array (
[0] => There was a problem connecting to the API URL specified. ) )
[error_data] => Array ( )
I used this for the same thing. I used basic authentication. i.e. admin panel username and password for authentication. Because I was the only person who was going to post to wordpress. And the correct URL to access end point was like below
http://domain.com/wp-json/posts?filter[s]=awesome
this is the link to how to create a post. I used Guzzle to call api like below to get a posts from particular category.
$client = new \GuzzleHttp\Client();
$response = $client->get("http://domain.com/wp-json/posts?filter[category_name]=test", array('auth' => ['username','password']));
$posts = $response->json();
But, If you are going to let other people post than you must use OAuth. Because you can not share admin panel username and password with everyone.
How can I retrieve a specific post/discussion from a open group through LinkedIn API using PHP.
I was trying with the following API request as shown in here http://developer.linkedin.com/documents/groups-api#post :
https://api.linkedin.com/v1/posts/5835685921059532803:(id,type,category,creator,title,summary,creation-timestamp,relation-to-viewer:(is-following,is-liked,available-actions),likes,comments,attachment,site-group-post-url)
But this returns the following error:
Array
(
[status_code] => 400
[data] => stdClass Object
(
[errorCode] => 0
[message] => Invalid Post.id String {5835685921059532803}
[requestId] => XW2XMPBNKY
[status] => 400
[timestamp] => 1391441328953
)
)
Now, what's the error I have made with this request? What should I do to get a specific discussion?
Thanks.
I just solved the problem. The problem was while making the request. The discussion id (5835685921059532803) I was sending with URL was in wrong format. It should be like: g-GROUP_ID-S-DISCUSSION/POST_ID, for example: g-24405-S-5835685921059532803.
So the URL should be:
https://api.linkedin.com/v1/posts/g-24405-S-5835685921059532803:(id,type,category,creator,title,summary,creation-timestamp,relation-to-viewer:(is-following,is-liked,available-actions),likes,comments,attachment,site-group-post-url)
Hope this would save someone's valuable time.
You need An Api key and Secret key,to get an AUTHORIZATION_CODE,using that AUTHORIZATION_CODE,you will get an Access Token,and with that Access Token if you hit the url,then you will get the proper data,
details http://developer.linkedin.com/documents/authentication