Buy Button Reference

The buy button enables you to build a checkout experience in Messenger. This button opens a native checkout dialog that enables people to make payments using their information stored in Messenger.

For more information on using the buy button, see Buy Button.

Contents

Example

...

  "buttons":[
    {
      "type":"payment",
      "title":"buy",
      "payload":"DEVELOPER_DEFINED_PAYLOAD",
      "payment_summary":{
        "currency":"USD",
        "payment_type":"FIXED_AMOUNT",
        "is_test_payment" : true, 
        "merchant_name":"Peter's Apparel",
        "requested_user_info":[
          "shipping_address",
          "contact_name",
          "contact_phone",
          "contact_email"
        ],
        "price_list":[
          {
            "label":"Subtotal",
            "amount":"29.99"
          },
          {
            "label":"Taxes",
            "amount":"2.47"
          }
        ]
      }
    }
  ]

...

Example Response

{
  "recipient_id": "1254477777772919",
  "message_id": "mid.$cAAJsujCd2ORj_1qmrFdzhVa-4cvO"
}  

Properties

Property Type Description

type

String

Must be payment.

title

String

Title of Buy Button. Must be "buy".

payload

String

Developer defined metadata about the purchase.

payment_summary

Object

Fields used in the checkout dialog.

payment_summary

Property Type Description

currency

String

Currency for price.

is_test_payment

Boolean

Optional. Whether this is a test payment. Once set to true, the charge will be a dummy charge.

payment_type

Enum

Must be FIXED_AMOUNT or FLEXIBLE_AMOUNT.

merchant_name

String

Name of merchant.

requested_user_info

Array

Information requested from person that will render in the dialog. Valid values: shipping_address, contact_name, contact_phone, contact_email. You can config these based on your product need.

price_list

Array

List of objects used to calculate total price. Each label is rendered as a line item in the checkout dialog.

price_list

Property Type Description

label

String

Label for line item.

amount

String

Amount of line item.

Error Response

{
  "error":{"message":"(#200) The user is not eligible to receive payment messages.",
  "type":"OAuthException",
  "code":200,
  "error_subcode":2018112,
  "fbtrace_id":"DdAqW91SO+K"
}