0

我正在我的应用程序中实现 Facebook 画布支付。但我找不到我应该在它的回调 url 中提到什么。我也没有找到任何关于此的文件。在我的图片下面我指出了我不知道该写什么的位置。所以如果有人能帮助我,那将是我最大的荣幸。

在此处输入图像描述

4

1 回答 1

1

动态定价回调 URL 用于获取您尝试通过动态付款销售的商品的价格。例如,如果您为您的商品创建了一个 OG 对象,并且您没有将价格和货币设置为该对象的元标签,Facebook 将调用该端点来获取该商品的价格。如果您在 OG 对象中设置价格,则不需要这样做:

<html>

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
  <meta property="og:type" content="og:product" />
  <meta property="og:locale" content="en_US" />
  <meta property="og:title" content="Coin" />
  <meta property="og:plural_title" content="Coins" />
  <meta property="og:image" content="http://ancient-savannah-6416.herokuapp.com/images/coin64.png" />
  <meta property="og:url" content="http://ancient-savannah-6416.herokuapp.com/opengraph/coin.html" />
  <meta property="og:description" content="Test Coins!" />
  <meta property="product:price:amount" content="0.10"/>
  <meta property="product:price:currency" content="USD"/>
  <meta property="product:price:amount" content="0.12"/>
  <meta property="product:price:currency" content="CAD"/>
  <meta property="product:price:amount" content="0.08"/>
  <meta property="product:price:currency" content="EUR"/>
  <meta property="product:price:amount" content="0.06"/>
  <meta property="product:price:currency" content="GBP"/>
  <meta property="product:price:amount" content="1.2"/>
  <meta property="product:price:currency" content="MXN"/>
  <meta property="product:price:amount" content="0.50"/>
  <meta property="product:price:currency" content="BRL"/>
  <meta property="product:price:amount" content="0.64"/>
  <meta property="product:price:currency" content="SEK"/>
</head>

</html>

您可以在此处阅读更多相关信息:

https://developers.facebook.com/docs/howtos/payments/definingproducts#pricing_dynamic

使用实时订阅回调 URL,以便 Facebook 可以通知您新的付款、争议、退款等。这是必需的,因为某些付款方式是异步的,您将无法完成付款,直到付款状态更改为完成。你可以在这里阅读更多:

https://developers.facebook.com/docs/payments/realtimeupdates/

这是一个示例实现:

<?php

$verify_token = "nv,mczjhiofewnakfld831nm";

$method = $_SERVER['REQUEST_METHOD'];

if ($method == 'GET' && $_GET['hub_verify_token'] === $verify_token) {
  echo $_GET['hub_challenge'];
  exit();
}
else if( $method == 'GET') {
  echo "<h1>REAL TIME UPDATES</h1>";
}

if ($method == 'POST') {
  $time_now = date("Y-m-d H:i:s"); 
  $updates = json_decode(file_get_contents("php://input"), true);

  log($time_now . " " . json_encode($updates) ."\n\n\n", 3, "rtudata.txt");
  log($time_now . " " . json_encode($_REQUEST) ."\n", 3, "rtudata.txt");
  log($time_now . " " . json_encode($_SERVER) ."\n", 3, "rtudata.txt");
}

?>
于 2014-06-18T16:50:56.773 回答