跳转到主要内容

如何使用结帐按钮模板API

更新于昨天

摘要

想要简化WhatsApp上的支付流程?Facebook的结账按钮模板可以轻松帮助企业直接在聊天中收款。这份指南将为您快速介绍如何通过WhatsApp Cloud API使用这些模板提供无缝结账体验的方法。

说明

结账按钮模板是WhatsApp Cloud API的一个功能,允许您将立即支付或立即购买按钮直接嵌入到信息中。点击按钮时,可以打开一个安全的支付体验,让客户只需几次点击即可完成购买。

入门所需

在使用结账按钮模板之前,请确保您已具备以下条件:

  • 验证后的WhatsApp商业账户(WABA)

  • Meta支付账户(通过Meta Commerce Manager设置)

  • 托管商店或支付体验(通过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端点发送结账按钮模板

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

示例有效负载

curl --location 'https://mt-dev-gke-server.watiapp.io/103128/api/v1/checkout_
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqd
--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": [
{
"amount": {
"offset": 100,
"value": 200
},
"sale_amount": {
"offset": 100,
"value": 150
},
"name": "Blue Elf Aloe"
,
"quantity": 1,
"country_of_origin": "India",
"importer_name": "Lucky Shrub Imports and Exports",
"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": [
{
"amount": {
"offset": 100,
"value": 200
},
"sale_amount": {
"offset": 100,
"value": 150
},
"name": "Blue Elf Aloe"
,
"quantity": 1,
"country_of_origin": "India",
"importer_name": "Lucky Shrub Imports and Exports",
"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": [
{
"amount": {
"offset": 100,
"value": 200
},
"sale_amount": {
"offset": 100,
"value": 150
},
"name": "Blue Elf Aloe"
,
"quantity": 1,
"country_of_origin": "India",
"importer_name": "Lucky Shrub Imports and Exports",
"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中创建结账按钮模板

本指南将引导您在几个步骤中创建结账按钮模板:

1. 登录您的Wati账户。

2. 进入传播并选择您的模板

3. 点击新建模板消息

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

5. 在类别下,选择营销

6. 选择要使用的语言

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

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

9. 根据您的需求添加轮播卡片。

注意:

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

  • 每张卡片可以添加一张图片或一个视频。

  • 您可以为每张卡片插入按钮,让客户采取行动并进行互动。

这是否解答了您的问题?