跳转到主要内容

如何使用结账按钮模板 API

一周前更新

概述

想要简化 WhatsApp 的支付流程?Facebook 的 Checkout Button 板使企业可以直接在聊天中收集支付。该指南将为您提供有关如何使用 WhatsApp Cloud API 使用这些模板的快速概述,以便您可以为客户提供无的结账体验。

注意: 广播 现在称为 活动 – 同样的强大功能,名称已更新!

说明

Checkout Button 板是 WhatsApp Cloud API 的一个功能,允许您直接将 立即支付或立即购买 钮入到消息中。当点击按钮时,它会打开一个安全的支付体验,以便客户只需几次点击即可完成购买。

开始前需要准备的内容

在使用结账按钮模板之前,请确保您拥有:

  • 已验证的 WhatsApp 商业户 (WABA)

  • Meta 支付户(通过 Meta 商务经理设置)

  • 托管商店或支付体验(通过 Meta 或第三方提供商)

结账按钮模板的工作原理

结账按钮使用包含以下内容的消息模板发送:

  • 头部: 可选,可以包含文本或媒体

  • 正文: 述产品或支付请求

  • 按钮: 点击时触发结账流程

一旦客户点击按钮,他们将被引导到预配置的支付体验。这可以是一个一次性结账页面或链接到特定产品或购物车。

主要优点

  • 更快的购买: 客户无需离开 WhatsApp 即可支付

  • 更好的参与度: 少结账过程中的放弃

  • 安全交易: 支付通过 Meta 的验证基础设施处理

示例用例

  • 在订单确认后分享“立即支付”消息

  • 发送预购或订阅的支付链接

  • 为回头客启用快速重新订购

端点

POST https://{your-account-endpoint}/api/v1/checkout_button_template

checkout_button_template 点允许您直接将 立即支付或立即购买 钮入到消息中。当点击按钮时,它会打开一个安全的支付体验,以便客户只需几次点击即可完成购买。

步 1:找到您的 API 点

您可以在 Wati 户的 /api-docs 部分找到您的特定 API 点。它看起来像这样:https://live-server-xxxx.wati.io

您的最终端点将用于发送订单:

POST https://{your-account-endpoint}/api/v1/checkout_button_template

以下是此端点的参数列表:

phone_number:这是消息接收者的电话号码。

template_name:这是您创建的模板的名称。

custom_params:这取决于模板中的变量。

order_details:订单详细信息的数量应与模板中的轮播卡数量相同。

reference_id:这是每个订单的唯一 ID。

步 2:如何使用 API 点发送结账按钮模板

以下是具有 3 个轮播卡的 checkout_button_template 的示例有效负载:

示例有效负载

curl --location 'https://mt-dev-gke-server.watiapp.io/103128/api/v1/checkout_' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"phone_number": "918606328257",
"template_name": "checkout_button_template_yzn_1",
"custom_params": [
{
"name": "name",
"value": "TEST_NAME"
}
],
"order_details": [
{
"reference_id": "yzn-test-7",
"type": "physical-goods",
"currency": "INR",
"payment_settings": [
{
"type": "payment_gateway",
"payment_gateway": {
"type": "razorpay",
"configuration_name": "razorpay_test_payment_2"
}
}
],
"shipping_info": {
"country": "IN",
"addresses": [
{
"name": "Nidhi Tripathi",
"phone_number": "919000090000",
"address": "Bandra Kurla Complex",
"city": "Mumbai",
"state": "Maharastra",
"in_pin_code": "400051",
"house_number": "12",
"tower_number": "5",
"building_name": "One BKC",
"landmark_area": "Near BKC Circle"
}
]
},
"order": {
"items": [
{
"name": "Blue Elf Aloe",
"quantity": 1,
"country_of_origin": "India",
"importer_name": "Lucky Shrub Imports and Exports",
"amount": {
"offset": 100,
"value": 200
},
"sale_amount": {
"offset": 100,
"value": 150
},
"importer_address": {
"address_line1": "One BKC",
"address_line2": "Bandra Kurla Complex",
"city": "Mumbai",
"zone_code": "MH",
"postal_code": "400051",
"country_code": "IN"
}
}
],
"subtotal": {
"offset": 100,
"value": 150
},
"shipping": {
"offset": 100,
"value": 20
},
"tax": {
"offset": 100,
"value": 10
},
"discount": {
"offset": 100,
"value": 15,
"description": "Additional 10% off"
},
"status": "pending",
"expiration": {
"timestamp": "1726627150",
"description": "description"
}
},
"total_amount": {
"offset": 100,
"value": 165
}
},

{
"reference_id": "yzn-test-8",
"type": "physical-goods",
"currency": "INR",
"payment_settings": [
{
"type": "payment_gateway",
"payment_gateway": {
"type": "razorpay",
"configuration_name": "razorpay_test_payment_2"
}
}
],
"shipping_info": {
"country": "IN",
"addresses": [
{
"name": "Nidhi Tripathi",
"phone_number": "919000090000",
"address": "Bandra Kurla Complex",
"city": "Mumbai",
"state": "Maharastra",
"in_pin_code": "400051",
"house_number": "12",
"tower_number": "5",
"building_name": "One BKC",
"landmark_area": "Near BKC Circle"
}
]
},
"order": {
"items": [
{
"name": "Blue Elf Aloe",
"quantity": 1,
"country_of_origin": "India",
"importer_name": "Lucky Shrub Imports and Exports",
"amount": {
"offset": 100,
"value": 200
},
"sale_amount": {
"offset": 100,
"value": 150
},
"importer_address": {
"address_line1": "One BKC",
"address_line2": "Bandra Kurla Complex",
"city": "Mumbai",
"zone_code": "MH",
"postal_code": "400051",
"country_code": "IN"
}
}
],
"subtotal": {
"offset": 100,
"value": 150
},
"shipping": {
"offset": 100,
"value": 20
},
"tax": {
"offset": 100,
"value": 10
},
"discount": {
"offset": 100,
"value": 15,
"description": "Additional 10% off"
},
"status": "pending",
"expiration": {
"timestamp": "1726627150",
"description": "description"
}
},
"total_amount": {
"offset": 100,
"value": 165
}
},

{
"reference_id": "yzn-test-9",
"type": "physical-goods",
"currency": "INR",
"payment_settings": [
{
"type": "payment_gateway",
"payment_gateway": {
"type": "razorpay",
"configuration_name": "razorpay_test_payment_2"
}
}
],
"shipping_info": {
"country": "IN",
"addresses": [
{
"name": "Nidhi Tripathi",
"phone_number": "919000090000",
"address": "Bandra Kurla Complex",
"city": "Mumbai",
"state": "Maharastra",
"in_pin_code": "400051",
"house_number": "12",
"tower_number": "5",
"building_name": "One BKC",
"landmark_area": "Near BKC Circle"
}
]
},
"order": {
"items": [
{
"name": "Blue Elf Aloe",
"quantity": 1,
"country_of_origin": "India",
"importer_name": "Lucky Shrub Imports and Exports",
"amount": {
"offset": 100,
"value": 200
},
"sale_amount": {
"offset": 100,
"value": 150
},
"importer_address": {
"address_line1": "One BKC",
"address_line2": "Bandra Kurla Complex",
"city": "Mumbai",
"zone_code": "MH",
"postal_code": "400051",
"country_code": "IN"
}
}
],
"subtotal": {
"offset": 100,
"value": 150
},
"shipping": {
"offset": 100,
"value": 20
},
"tax": {
"offset": 100,
"value": 10
},
"discount": {
"offset": 100,
"value": 15,
"description": "Additional 10% off"
},
"status": "pending",
"expiration": {
"timestamp": "1726627150",
"description": "description"
}
},
"total_amount": {
"offset": 100,
"value": 165
}
}
]
}'

如何在 Wati 中创建结账按钮模板

本指南将指导您完成在 Wati 中创建结账按钮模板的步:

1. 登录您的 Wati 户。

2. 前往 活动 并选择 模板消息

3. 点击 新建模板消息

4. 为您的模板输入 名称,以便您可以轻松找到它。

5. 在 类别 下,选择 营销

6. 选择您要使用的 语言

7. 在 选择营销模板 下,选择 结账模板

8. 输入 正文内容 - 这是客户将要看到的主要消息。

9. 根据需要添加轮播卡。

注意

  • 您最多可以添加 5 张卡片。

  • 对于每张卡片,您可以添加图像或视频。

  • 您可以为每张卡片插入按钮,以便客户可以采取行动并参与。

这是否解答了您的问题?