Pat*_*cow 6 javascript php facebook credits
我从facebook Cred实现了这个例子,并创建了一个测试应用,callback.php在Callback Url中添加了正确的键.但我得到这个错误:
Sorry, but we're having trouble processing your payment. You have not been charged for this transaction. Please try again.
Run Code Online (Sandbox Code Playgroud)
我正在尝试创建一些具有不同货币价值的按钮.喜欢:
Click to get 100 credits
Click to get 1000 credits
Run Code Online (Sandbox Code Playgroud)
如果我使用这个通用代码,我得到支付窗口就好了,但我看不到我的产品,我只能从已经制作的预设中选择:
function buyMore(){
// calling the API ...
var obj = {
app_id: 'xxxxxxxxxxxxxxxxxxxxx',
method: 'pay',
order_info: n,
purchase_type: 'item',
credits_purchase: true
};
Run Code Online (Sandbox Code Playgroud)
向用户显示我的货币预设我认为我需要将不同的值传递给函数:
<p><a onclick="buyMore('100'); return false;">Buy More Credits 100</a></p>
<p><a onclick="buyMore('1000'); return false;">Buy More Credits 1000</a></p>
function buyMore(price) {
var order_info = {
"title":'title',
"description":'description',
"price":price,
"image_url":'http://....img_url',
"product_url":'http://....product_url'
};
// calling the API ...
var obj = {
app_id: '153230661424821',
method: 'pay',
order_info: order_info,
purchase_type: 'item'
};
}
Run Code Online (Sandbox Code Playgroud)
不确定我是否做对了.
任何人都可以把我推向正确的方向吗?
是的,您必须让用户选择他们想要购买的商品,然后调用 buyMore 函数让他们通过 Credits 对话框确认购买(就像您在第二个示例中所做的那样)。
我要做的第一件事就是检查开发者应用程序中的积分设置。我之前在新应用程序上遇到过这个错误,然后才意识到我忘记设置我的积分回调 URL 或将我的用户设置为积分测试用户。
| 归档时间: |
|
| 查看次数: |
5574 次 |
| 最近记录: |