Facebook payment object returns wrong price

111 Views Asked by At

Our Unity web-hosted WebGL app implements Facebook payments API. Since the 13th of July 2017 we noticed that the prices of some products have changed and are now different than those stated in the product htmls. Nothing changed on our side.

Sample product object:

<!DOCTYPE html>
  <html>
     <head prefix=
        "og: http://ogp.me/ns# 
         fb: http://
         ogp.me/ns/fb# 
         product: https://ogp.me/ns/product#">
      <meta property="og:type"                   content="og:product" />
      <meta property="og:title"                  content="10000 Gold Coins" />
      <meta property="og:image"                  content="https://[HOST_URL]/Icon.png" />
      <meta property="og:description"            content="10000 Gold Coins!" />
      <meta property="og:url"                    content="https://[HOST_URL]/Coins10000.html" />
      <meta property="product:price:amount"      content="2.99"/>
      <meta property="product:price:currency"    content="USD"/>    
      <meta property="product:price:amount"      content="2.99"/>
      <meta property="product:price:currency"    content="EUR"/>
      <meta property="product:price:amount"      content="2.49"/>
      <meta property="product:price:currency"    content="GBP"/>
      <meta property="product:price:amount"      content="3.99"/>
      <meta property="product:price:currency"    content="AUD"/>
      <meta property="product:price:amount"      content="3490"/>
      <meta property="product:price:currency"    content="KRW"/>
      <meta property="product:price:amount"      content="11.9"/>
      <meta property="product:price:currency"    content="ILS"/>
      <meta property="product:price:amount"      content="3.99"/>
      <meta property="product:price:currency"    content="CAD"/>
      <meta property="product:price:amount"      content="314.9"/>
      <meta property="product:price:currency"    content="JPY"/>
      <meta property="product:price:amount"      content="189.9"/>
      <meta property="product:price:currency"    content="RUB"/>
      <meta property="product:price:amount"      content="23.9"/>
      <meta property="product:price:currency"    content="HKD"/>
      <meta property="product:price:amount"      content="2.99"/>
      <meta property="product:price:currency"    content="CHF"/>
      <meta property="product:price:amount"      content="11.9"/>
      <meta property="product:price:currency"    content="PLN"/>
    </head>
  </html>

The Unity code calling this object:

FB.Canvas.Pay("http://[HOST_URL]/Coins10000.html", callback: FBProductCallback);

The above product appears for users as costing only 1.99 USD (instead of 2.99).

My question is as follows: Has something changed on the Facebook side? Has anyone else seen these changes? And most importantly, how do we fix this?

As a side note: We also tested the payments lite (payment products directly "hosted" on Facebook) but they do not support multiple currencies.

1

There are 1 best solutions below

0
On BEST ANSWER

Well I managed to find the problem after opening a bug report with Facebook.

Our code simply called the files URL with the http protocol and not https. This, for some reason unbeknownst to me, returned a cached version of the products resulting in different pricing than that which we configured.

Bonus helpful tool to anyone that needs to debug Facebook product issues:

  1. Open the Developer Tools window in your browser and go to console.
  2. Navigate to the iframe in which the game is running: enter image description here

  3. Enter the following code into the console:

    var obj = {
        method:'pay',
        action:'purchaseitem',
        product:'YOUR_PRODUCT_URL'
    };
    
    FB.ui(obj, function(data) {
        console.log(data);
    });
    

This way you can see what different URLs contain in the Facebook canvas.

Good luck!