Facebook Messenger 机器人购买按钮

Facebook Messenger bot Buy button

我正在尝试在我的 Messenger 机器人中实现购买按钮,但出现以下 2 个错误:

{"error":{"message":"(#-1) Send API unexpected internal error","type":"OAuthException","code":-1,"error_subcode":2018012,"fbtrace_id":"BN47MpNqWNN"}} 

{"error":{"message":"(#100) Invalid button type","type":"OAuthException","code":100,"error_subcode":2018037,"fbtrace_id":"Agfk\/h+cEta"}}

知道问题出在哪里吗?我在哪里可以查看这些错误代码? 这是我发送给 Facebook 信使的消息 API:

{'message': {'attachment': {'type': 'template', 'payload': {'text': 'Please checkout.', 'template_type': 'button', 'buttons': [{'payment_summary': {'merchant_name': "Peter's Apparel", 'currency': 'USD', 'payment_type': 'FIXED_AMOUNT', 'price_list': [{'amount': '29.99', 'label': 'Subtotal'}, {'amount': '2.47', 'label': 'Taxes'}], 'requested_user_info': ['contact_name'], 'is_test_payment': True}, 'type': 'payment', 'payload': 'DEVELOPER_DEFINED_PAYLOAD', 'title': 'buy'}, {'type': 'postback', 'payload': '{"title": "Confirm Order", "event_value": "", "event_name": "confirm_order"}', 'title': 'Confirm Order'}, {'type': 'postback', 'payload': '{"title": "Add Coupon Code", "event_value": "", "event_name": "add_coupon"}', 'title': 'Add Coupon Code'}]}}}, 'recipient': {'id': '1232211580183568'}}

"The Buy Button only works with the Generic Template and List Template and it must be the first button."

您的模板类型是'button'。尝试将您的 template_type 更改为通用或列表。另外,请确保您可以访问付款测试程序。

参考:https://developers.facebook.com/docs/messenger-platform/send-api-reference/buy-button