Why does Facebook Credits callback payments_get_items occasionally not pass user ID? - facebook

Our facebook canvas app is having this problem where now, several times a day, the credits callback is passing a signed_request with the following contents:
Array
(
[algorithm] => HMAC-SHA256
[credits] => Array
(
[order_id] => 9005967273834
[order_info] => "item104"
)
[issued_at] => 1319329443
[user] => Array
(
[country] => do
[locale] => es_LA
[age] => Array
(
[min] => 0
[max] => 12
)
)
)
Notice anything missing? That's right! No user_id, buyer, or receiver is given!
We can't tell facebook what the price or description of an item is without knowing who is receiving the item.
This seems like a bad bug! This problem started happening on Oct 11, 2011

This is definitely an intermittent bug, so the only work-around is to pass the user ID from your own code into the order_info field of the item. Then use that instead of the credits receiver if the user information is missing.
I don't like that I have to do this, but it seems necessary.

I noticed this as well on my app and from what I can see the missing user IDs happen when Facebook indicates an age bracket of min 0 and max 12 years for the user. I assume that this might be the result of under 13 year olds being prevented from making purchases with Facebook credits.
Which makes me wonder what they are doing on Facebook to start with...

Related

PayPal PDT not returning Custom Message url parameter "cm" properly

I have multiple websites that use PayPal Buy Now buttons and have PDT enabled.
All of the existing customer websites are working, in that after the user makes a purchase, they are redirected back to their site by PayPal with a return URL that includes the 'cm' parameter as specified here.
I have a new client with a brand new Merchant Account who has their PDT configured correctly (I have checked it multiple times to be sure). However, upon return from PayPal payment, we are missing the 'cm' parameter that is necessary to do validation/updates on our website.
I have never seen this before where some of the variables are getting sent back, but not all as defined in the PayPal documentation above.
Here is an example of a working return URL - (some values edited for privacy purposes only)
.../paypal/pdt?redirect=https://journals.myclient.com/view/journals/cssm/4/1/article-p14.xml?PFTxId=4435&offerProvider=DEFAULT&amt=9.95&cc=USD&cm=mJ5v4sm1PUcD0E9vbii0pm6e1ql5GRs/lv+aQuNuves=%7CaccountId=XXXXX%7COffer ID=7|mc_gross=9.95&item_name=ITEM NAME Dilemma&item_number=/journals/cssm/4/1/article-p14.xml&st=Completed&tx=XXXXXXXXXXXX
Here is the example of the newly created Merchant Account where this is not working
.../paypal/pdt?redirect=https://www.nonworkingclient.org/view/journals/tpmd/s1-1/6/article-p331.xml?PFTxId=40&offerProvider=DEFAULT&PayerID=RPUJELM94HEYU&st=Completed&tx=XXXXXXXXXX&cc=USD&amt=0.01
Here you can see in the comparison, PayPal is returning the 'tx' and 'cc' variables in both examples, but 'cm' is missing from the bottom example.
Has anyone else experienced this lately?
Does anyone know of anything more than the PDT setup that needs to be checked to see why this is failing in the Merchant Account?
Thank you for any assistance.
I have an account that has been set up and working for 3+ years. PDT always returned a "cm" parameter which I pass in as "custom". In the last couple weeks it is hit or miss whether I get "cm" back (can't say exactly when it stopped working as the site has not been used since Spring 2020). About 10% of the time it works but the other 90% no "cm". The response is a bit different in the success and failure cases. Here is an example of a successful return with "cm" (the output is the GET array parameters and values)
(
[feepaid] => Y
[amt] => 75.00
[cc] => USD
[cm] => 586
[item_name] => IW***** Fee
[item_number] => g**5
[st] => Completed
[tx] => 9J5******81R
)
and an example of a failure case (no "cm")
(
[feepaid] => Y
[PayerID] => 9J*******YG
[st] => Completed
[tx] => 3D2*****2457
[cc] => USD
[amt] => 75.00
)
The failure has "PayerID" which does not appear as a valid variable in PDT or IPN spec. Success case has no PayerID but has item_name and item_number (which are fixed in the button definition on PayPal merchant account).
Same here! Paypal no longer return cm paramater for some users

Facebook ads api - get stats by day

I can successfully get campaign stats between particular dates via the API however I need that broken down day by date rather than a total.
I can see it works for the page insights API but there doesn't seem to be documentation on the ad insights API.
I'm using the following call to get the total between dates.
https://graph.facebook.com/v2.2/act_/stats?access_token=&start_time=&end_time=
However I cannot find the documentation to break it down into day by day for one query.
This answer had a solution but didn't work.
Downloading Facebook ads statistics in background (no web browser)
Thanks!
===================================================
New info:
So I can use time_increment=1 to get a break down by day however this only works with 'date_preset' however I want to set a date range. I am using the latest API
https://graph.facebook.com/v2.2/act_{$this->accountID}/reportstats
Using 'time_ranges' will merge the data regardless of using time_increment=1
Using 'date_preset' eg last_28_days does work with time_increment.
Using 'time_interval' with midnight timestamps of my timezone (as the documentation suggested) throws the following error:
[error] => stdClass Object
(
[message] => (#100) The "time_start" and "time_stop" must be integer.
[type] => OAuthException
[code] => 100
)
They are integers! Here's my complete post data
$postData = array(
'async'=>'true',
'data_columns'=>$data_columns,
/*
'time_ranges'=>array(
array(
'day_start'=>array(
'day'=>$startDate->format("d"),
'month'=>$startDate->format("m"),
'year'=>$startDate->format("Y"),
),
'day_stop'=>array(
'day'=>$endDate->format("d"),
'month'=>$endDate->format("m"),
'year'=>$endDate->format("Y"),
),
),
),
*/
'actions_group_by'=>array('action_type'),
'time_interval'=>array(
'time_start'=>$startDate->getTimestamp() ,
'time_stop'=>$endDate->getTimestamp(),
),
//'date_preset' => 'last_28_days',
'time_increment'=>'1',
'filters'=>$filters,
'access_token'=>$this->access_token
);
Ok I had to change the format time_interval to the time_range format and it worked! The documentation says timestamps will work but it doesn't, this worked:
'time_interval'=>array(
'day_start'=>array(
'day'=>$startDate->format("d"),
'month'=>$startDate->format("m"),
'year'=>$startDate->format("Y"),
),
'day_stop'=>array(
'day'=>$endDate->format("d"),
'month'=>$endDate->format("m"),
'year'=>$endDate->format("Y"),
),
),

How Do I Integrate Paypal, Gravity Forms And Wishlist?

First off, I'm by no means a programmer so this might be a very simple issue but I'm about to pull my hair out soon.
So, I have a site where I'm selling a book + access to a membership through Wishlist Member. It sells for $99 and now I want to give them a $9 trial for 30 days and then bill them the remaining $90 over 2 installments of $45 each with a month apart.
Now, integrating Wishlist with PP is easy to setup when I'm only sending people straight to PayPal.
It basically only requires 3 steps besides activating IPN and pasting in the PDT.
Add the item/subscription ID of my Wishlist Membership Level to the PayPal button I'm creating.
Make sure the thank you page URL after purchase is:
site.com/members/index.php/register/AOKmfa
Paste the code below in the "Add advanced variables" field:
rm=2
bn=WishListProducts_SP
notify_url=site.com/members/index.php/register/AOKmfa
return=site.com/members/index.php/register/AOKmfa
Now I'm looking to increase the sign up rate so I am creating my own order page with Gravity Forms Paypal-Add on.
In there you have an option to set the thank you page, so in my case I would add "site.com/members/index.php/register/AOKmfa" and then I can also tick a box that says:
"Pass Field Data Via Query String" where I'm apparently suppose to paste in the code:
rm=2
bn=WishListProducts_SP
notify_url=site.com/members/index.php/register/AOKmfa
return=site.com/members/index.php/register/AOKmfa
But, my question is... how can I get this subscription ID involved?!
After speaking to Gravity Form support they said:
To pass additional info to PayPal you can use gform_paypal_query filter. You adapt this code to suit your needs.
add_filter('gform_paypal_query', 'add_more_information', 10, 3);
function add_more_information($query_string, $form, $entry) {
// break the query string into an array
// after removing the initial '&' character
parse_str(ltrim($query_string, '&'), $query);
// add information to query string. These currently exist
/*
[METHOD]
[VERSION]
[PWD]
[USER]
[SIGNATURE]
[BUTTONSOURCE]
[CREDITCARDTYPE]
[ACCT]
[EXPDATE]
[CVV2]
[STREET]
[STREET2]
[CITY]
[STATE]
[ZIP]
[COUNTRYCODE]
[CURRENCYCODE]
[FIRSTNAME]
[LASTNAME]
[EMAIL]
[DESC]
[L_NAME0]
[L_DESC0]
[L_AMT0]
[L_NUMBER0]
[L_QTY0]
[PAYMENTACTION]
[IPADDRESS]
[RETURNFMFDETAILS]
[AMT]
[NOTIFYURL]
*/
// change SHIPTONAME to whatever query string parameter you want to set
// and change the inputs here to whatever field holds your item title.
$query['L_DESC0'] = rgpost("input_6_13");
// put it all back together again
$query_string = '&' . http_build_query($query);
return $query_string;
}
So my question is, how can I adapt that code to actually get this integration to work? They are clearly not interested in pinpointing exactly how I would go about doing it so maybe one of you can?
Do I only need to adapt the code so it somehow adds in that subscription ID? (If so, how?) Or do I also need to add in the redirect url and the advanced variable field?
I truly appreciate any kind of help you can give me and if this should be posted elsewhere please let me know.
Thanks,
Tony

PayPal NVP API - BMUpdateButton

I have a hosted subscribe button with PayPal, which I want to have an unlimited number of billing cycles. This is easy enough to set up through the PayPal web interface, by setting 'After how many cycles should billing stop?' to 'Never'. However, when I then update that button through the PayPal NVP API BMUpdateButton, the number of billing cycles shows to the user as '$25.00 AUD for one month' instead of '$25.00 AUD for each month'. The button still shows 'Never' as the value in the web interface, but when it is used, the button is set to complete after 1 month.
I have tried variations of L_OPTIONnTOTALBILLINGCYCLESx API parameter, but with no success. Any help or thoughts would be appreciated. For all I know, this is a subtle bug in PayPal itself. If anyone has reason to believe that if I switch from NVP to SOAP it will work, then that would also count as a solution.
Here is a sample of the parameters that I send through. I don't get any API errors, and the button updates correctly except for the total billing cycles.
'METHOD' => BMUpdateButton
'VERSION' => 117
'USER' => ...
'PWD' => ...
'SIGNATURE' => ...
'L_OPTION0SELECT0' => First Tier
'L_OPTION0PRICE0' => 25.00
'L_OPTION0BILLINGPERIOD0' => Month
'L_OPTION0BILLINGFREQUENCY0' => 1
'L_OPTION0TOTALBILLINGCYCLES0' => 0
'L_OPTION0SELECT1' => Second Tier
'L_OPTION0PRICE1' => 30.00
'L_OPTION0BILLINGPERIOD1' => Month
'L_OPTION0BILLINGFREQUENCY1' => 1
'L_OPTION0TOTALBILLINGCYCLES1' => 0
'HOSTEDBUTTONID' => ...
'BUTTONTYPE' => SUBSCRIBE
'OPTION0NAME' => Payment Scheme
'L_BUTTONVAR0' => currency_code=AUD
'L_BUTTONVAR1' => no_shipping=1
'L_BUTTONVAR2' => cancel_return=...
'L_BUTTONVAR3' => return=...
Thanks very much for any thoughts.
The below two parameters in your API call is related to the installment buttons and if you pass them with the subscription type button they will be ignored.
L_OPTION0BILLINGFREQUENCY0
L_OPTION0TOTALBILLINGCYCLES0
If you are looking to update the subscription billing cycles you need to pass these two parameters :
L_BUTTONVARn="src=1"
L_BUTTONVARn="srt=12"
If the above src=1 means profile is set to be recurring and srt=12 will set the billing cycle to 12 .
If you don't pass any of the parameter in the API call then by default "src" will be set to "0" meaning no recurrence which is similar to your case .

Stream FQL shows blank messages (which are my posts on other's walls) - but only with 1 App

I've been struggling with this one for a few days.
I use a query like this to get my posts on my wall:
select post_id, viewer_id, app_id, source_id, updated_time, created_time, filter_key, attribution, actor_id, target_id, message, attachment, permalink from stream where source_id = 100003203496908 and updated_time >'1362480430'
This is behaving differently, depending on the App ID. The apps appear to have identical settings, and the users appear to have identical permissions.
With the App that is working properly, it returns only my posts on my wall.
With the app that is not working properly, it returns my posts on my wall. But it also returns some rows that have empty message and permalink, like this:
(
[post_id] => 100003203496908_367088630074584
[viewer_id] => 100003203496908
[app_id] =>
[source_id] => 100003203496908
[updated_time] => 1362487503
[created_time] => 1362487503
[filter_key] =>
[attribution] =>
[actor_id] => 100003203496908
[target_id] =>
[message] =>
[attachment] => Array
(
[description] =>
)
[permalink] =>
)
From some testing, I've been able to determine that these are posts I have made on others' walls. Which I don't think should be returned here. The Post_id also looks to be bogus.
Any ideas? Where should I look? Anything with App settings or permissions that would cause something like this in one app but not another?