Return Meta Ad Account Remaining balance (account limit) - facebook

I would like to return the "Remaining amount: xx" on Meta ad accounts by inputting the ad account ID. In Meta's documentation, there are multiple fields that could work for this, but none do fully. The fields that COULD work are spend_cap, balance and amount_spent. The error occurs when the spending limit is reset (e.g. account has a limit of 500, spends 100, then the limit is reset. The logic would show a remaining balance of 400, while it is actually 500, because the balance was reset).
Any help is appreciated :)

Related

What is the best possible user multi-currency wallet database design?

I'm using mongodb/mongoose, my app new requirements is to have multiple currencies, and each user can have a different balance for each currency.
ex: A user can have 30 USD, 100 EUR, 200 EGP.
No exchange from one currency to another, just a bunch of currencies.
At the moment we don't have any currencies, just a field called "balance" which contains user's balance.
My solution is to create a table for currencies, each with an _id and a name.
but when it comes to user balance I can't determine what is the best solution to make increasing and decreasing user balance easy, the only solution that crosses my mind is making balance field an array of object
balance: [{ currency: "CurrenyId", amount: 50 }, { currency: "CurrenyId", amount: 100 }]
But the problem with this approach is updating balance would be troublesome, Would you suggest a better solution ?
thanks

Why follower_count insight metric returns the number of new followers of a given day, instead of Total number of unique users following?

It seems there is a bug in the definition of folower_count insight metric in Facebook graph API for Instagram Business Accounts.
your_instagram_business_account/insights?metric=follower_count&period=day
https://developers.facebook.com/docs/instagram-api/reference/user/insights
They wrote that this is "Total number of unique users following the Business Account", but we observed that this metric give us the number of new followers of a given day. Also, there is no information about the number of unfollows, so if on the same day it would be 2 new followers and 2 unfollows, the follower_count will be 0.
According to the documentation you provided, follower_count is defined as
Total number of new followers each day within the specified range
so this lines up with expectations. Admittedly I'm answering this a bit late so that definition may have changed since you posted this.
the followers_count (note the 's') may be what you're looking for. https://developers.facebook.com/docs/instagram-api/business-discovery

PayPal gateway has rejected request. Item amount is invalid (#10630: Item amount is invalid)

When i generate invoice selecting option "online capture" option from magento admin then i am getting error please read below:
"PayPal gateway has rejected request. Item amount is invalid (#10630: Item amount is invalid)."
Order detail is
Subtotal = $349.00
You Redeemed(0 Reward points ($0.00))= $0.00
Grand Total = $349.00
Please help me, Having this issue since many days.

Need to Display Information that Has Been Sorted Out

I am still rather new to Crystal Reports and have what feels like a pretty basic question. I work at a school, and part of my duties are to help with donation reporting. My boss wants a report that gives her biographical(irrelevant to this) information about donors that gave 500 or more to our Booster fund(relevant).
The kicker is this: After using record select to sort for donors who have given more than 500 to this fund, I need to show how much they have given to other funds as well. The way I've tried to do it has given Crystal parameters to only display the data if giving exceeds 500 to booster fund. Here's the record select:
{gift.fiscal_yr} = 2015 and
{gift.campaign} = "Booster" and
{gift.amount} >= 500
After it runs through that, when I put {gift.campaign} on the actual report, it only shows "Booster", and not any others. I want it to show me the giving amount of all funds only if the donor has given 500 or more to Booster.
Thanks in advance for your help! This community is a life saver!
Off the top of my head try this:
Take booster out of selection formula as suggested.
I assume you are grouped on donor?
Create a formula #findboosterdonor
if {gift.campaign} = "Booster" then 1 else 0
Go to Report-Selection-Formula-Group
enter this with your field names
sum(#findboosterdonor,{donor}) > 0

How do I call more than 100 statuses with Facebook API?

I'm building a Facebook application and I want it to be able to read all the user's statuses from the past year. When I make the API call, I can only retrieve the first 100 statuses no matter what I set the limit to.
Here's the URL I'm using to make the call:
https://graph.facebook.com/me/statuses?limit=100&access_token=...
When I set the limit lower, it shows fewer statuses (proving that the limit argument works). When I set the limit higher, it only gives me the first 100. When I use 'since', it still only gives me 100.
When I use the 'next' url it gives me, I see no data past the first 100 statuses.
I know it's possible to get much more than that because of applications such as My Year In Status
It does work. You must use both the limit and offset query parameters. The limit parameter sets the batch size. The offset parameter sets the position in the user's all-time status collection. Without specifying the offset parameter, Facebook defaults it to zero, which is why you keep seeing the same dataset.
For the 1st batch of 100 statuses, set limit to 100 and offset to 0.
For the 2nd batch of 100 statuses, set limit to 100 and offset to 100.
For the 3rd batch of 100 statuses, set limit to 100 and offset to 200.
For the 4th batch of 100 statuses, set limit to 100 and offset to 300.
And so on...
Keep iterating until you get an empty dataset:
{
"data": []
}
I've verified using the Graph API explorer that the pagination is not working as you have described. Log it as a bug with Facebook at: https://developers.facebook.com/bugs and post the bug # here.
EDIT
Per the bug closure, the 100 limit is By Design and you won't get more than that, meaning that Facebook has made a conscious business decision to limit the amount of data it has to store, process, and serve from the Graph API. It costs money to do so and since the API is free to use, I can't argue with them. However, if I was paying for it, then hell yes I kick and scream all the way down the road.
Paging and Since, Until parameters not working for me too.
But I found out, that I'm able get more then 100 statuses using Offset parameter.
Here is my code using Facebook C# SDK:
var fb = new FacebookClient(accessToken);
string connection = "statuses";
string urltemplate = "https://graph.facebook.com/me/{0}?limit={1}&offset={2}";
int limit = 25; //items on one page (Max is value 100)
int offset = 0;
var statuses = (IDictionary<string, object>)fb.Get(string.Format(urltemplate, connection, limit, offset));
while (statuses != null && statuses.ContainsKey("data") && ((Facebook.JsonArray)statuses["data"]).Count > 0)
{
var dataItems = (Facebook.JsonArray)statuses["data"];
foreach (Facebook.JsonObject item in dataItems)
{
//TODO: process item data
System.Diagnostics.Debug.WriteLine(item["message"]);
}
offset += limit;
statuses = (IDictionary<string, object>)fb.Get(string.Format(urltemplate, connection, limit, offset));
}
This worked as of a week ago, our best bet to get this fixed is to post on http://developers.facebook.com/bugs/155458081230560 so the facebook developers know how big of an issue this is.
Facebook closed the previous bug without really testing to see that it didn't work. I've made a new bug here: https://developers.facebook.com/bugs/242235199184053