1

I'm trying to integrate Payer Promotions for our facebook game. I put a link to initiate payer promotion with js-sdk and created a callback function. using this sample:

<!-- Simple unit for Payer Promotion (payer_promotion)
     Determine visibility of the unit from the above eligibility API -->
<button onclick="payer_promotion();">Payer Promotion</button>

<script>
  // On load, the user hasn't clicked on the payer_promotion unit
  var has_clicked = false;
  var dialog_window;

  function payer_promotion() {
    if (!has_clicked) {
      // If first click, open payer_promotion dialog
      var obj = {
        method: 'fbpromotion',
        display: 'popup',
        quantity: 10,
        product: 'http://currency.object.url'
      };

      FB.ui(obj, function(){
        // call back to your server to see if user's balance changed
      });

      // Mark unit as clicked by user
      has_clicked = true;
    } else {
      // For subsequent clicks, alert user
      alert("Payer Promotion already clicked!");
    }
  }
</script>

So everything works expected with my payment tester account and i claimed my free promotion... or so facebook says. once the transactions is completed and user closes the new popup facebook opened, I'm left with just a callback with no arguments and no idea whatever happened between facebook and the user. callback function has "// call back to your server to see if user's balance changed" comment but since facebook changed to local currency I'm doing payment processing locally with order_id (not facebook->my server it used to be). So if I don't get order_id I have no means to figure out if I should process the promotion or not. The question is, am I missing something? is there a way to figure out if the promotion succeeded or not?

Volkan Ulukut
  • 4,230
  • 1
  • 20
  • 38
  • _“just a callback with no arguments”_ – well your callback function isn’t _asking_ for any arguments … if you make that `function(data) { console.log(data); }`, then what do you get? – CBroe Oct 23 '13 at 15:20
  • the documentation states: "The Javascript callback will fire once the dialog is closed, with no arguments. " – Volkan Ulukut Oct 23 '13 at 15:27
  • 1
    And what does is say [directly after that](https://developers.facebook.com/docs/concepts/payerpromotions/#pay_dialog) …? _“In addition, you will also receive __a realtime update__ once the order has been fulfilled upon which you should award the user with the corresponding amount of your in-game currency or item.”_ – CBroe Oct 23 '13 at 15:30
  • i just realized realtime update is another service of facebook. i thought they mean payment callback. thanks. – Volkan Ulukut Oct 24 '13 at 10:17

0 Answers0