8. Create&Update Template

POST POST /api/open/v1/alipayhk/merchant/template/sync

Merchants can use this API to synchronize the display template of the bill account binding page to AlipayHK. The template can define account binding forms and one-time payment forms that are rendered in the AlipayHK Bills & Utilities experience.


Request

Header

NameTypeRequiredMax LengthDescriptionSample
versionStringY8API version1.0.0
functionStringY128API interfacealipay.intl.merchant.account.bind.template.manage
clientIdStringY8Client ID2110200000000044
reqTimeStringY-Request time2001-07-04T12:08:56+05:30
reqMsgIdStringY64Request message IDfj398457jd8iue98d8w7w93j
reserveStringN256Reserved for future implementation{}

Body

NameTypeRequiredDescriptionSample
operationTypeStringYOperation type. Supported values: CREATE, UPDATE.CREATE
outTemplateIdStringYMerchant-side template ID. clientId + outTemplateId is used as the idempotency key.20250815xxxxxxxx
statusStringCTemplate status. Required when operationType is UPDATE. Supported values: VALID, INVALID.VALID
merchantNameObjectYMerchant display name in multiple languages.{"en_US":"SmarTone","zh_HK":"數碼通","zh-CN":"数码通"}
iconStringYMerchant icon URL.https://example.com/icon.png
supportAutoDebitBooleanYIndicates whether the template supports auto-debit.true
noticeObjectNNotice text shown at the bottom of the page, in multiple languages.{"en_US":"Tips: xxxx","zh_HK":"提示:xxxx","zh-CN":"提示:xxxx"}
sectionsStringYTemplate section definition. This field must be provided as a JSON string.See the Section definition and examples below.
extendInfoStringNExtended information in JSON string format.{"key":"value"}

Notes:

  1. C means conditional.
  2. To update template content, send the full latest template payload with operationType=UPDATE.
  3. To deactivate a template, send operationType=UPDATE with status=INVALID.

Section

NameTypeRequiredDescriptionSample
sectionCodeStringYSection code. Supported values: BIND, SINGLE_PAYMENT.BIND
menuLayoutStringY

Selector layout of the form menu. Supported values:

  • PICKER

image.png

  • RADIO

image.png

  • NONE

image.png

PICKER
menuTitleObjectYTitle shown above the form selector, in multiple languages.{"en_US":"Type","zh_HK":"類型","zh-CN":"类型"}
formsArray\YForm definitions under the section.See Form.

Form

NameTypeRequiredDescriptionSample
formCodeStringYMerchant-defined form code.aaa
formNameObjectY

Form display name in multiple languages.

{"en_US":"Residential customers","zh_HK":"住宅客戶","zh-CN":"住宅客户"}
merchantIdStringYMerchant ID associated with the form.2160400000002012
subMerchantIdStringNSub-merchant ID associated with the form.12345
billTypeStringYBill type.TELECOM
subBillTypeStringYBill sub-type.MOBILE_SERVICE
fieldsArray\YInput field definitions under the form.See Field.

Field

NameTypeRequiredDescriptionSample
fieldCodeStringYMerchant-defined field code.billNo
displayNameObjectY

Field display name in multiple languages.

image.png

{"en_US":"Bill Number","zh_HK":"賬單號碼","zh-CN":"账单号码"}
formatStringYField format. Supported values: NUMBER, STRING, PICKER, DATE, OTP.NUMBER
pickerListArray\COption list for PICKER fields only.See Picker.
validateRuleStringNValidation rule. For NUMBER, use min,max. For STRING, use a regular expression.1,100

Picker

NameDescriptionTypeRequiredSample
nameOption display name in multiple languages.ObjectY{"en_US":"Bill Number","zh_HK":"賬單號碼","zh-CN":"账单号码"}
codeOption code.StringYBJ

Localized Text

Use a JSON object to provide multilingual text. The following structure is recommended:

copy
{
  "en_US": "Sample English Text",
  "zh_HK": "示例繁體文本",
  "zh-CN": "示例简体文本"
}

OTP Field Behavior

When format is OTP, AlipayHK performs the verification step before the form is submitted. For example, if fieldCode is phoneNo, the value returned later in the binding or single payment submission payload is already verified by AlipayHK.

Sections Format

The sections field must be sent as a JSON string. The unescaped structure is as follows:

copy
[
  {
    "sectionCode": "BIND",
    "menuLayout": "PICKER",
    "menuTitle": {
      "en_US": "Bill Type",
      "zh_HK": "帳單類型",
      "zh-CN": "账单类型"
    },
    "forms": [
      {
        "formCode": "aaa",
        "formName": {
          "en_US": "Home Customer",
          "zh_HK": "住宅客戶",
          "zh-CN": "住宅客户"
        },
        "merchantId": "2160400000002012",
        "subMerchantId": "12345",
        "billType": "TELECOM",
        "subBillType": "MOBILE_SERVICE",
        "fields": [
          {
            "fieldCode": "billNo",
            "displayName": {
              "en_US": "Bill Number",
              "zh_HK": "賬單號碼",
              "zh-CN": "账单号码"
            },
            "format": "NUMBER",
            "validateRule": "1,100"
          },
          {
            "fieldCode": "name",
            "displayName": {
              "en_US": "Registered Customer Name",
              "zh_HK": "註冊客戶姓名",
              "zh-CN": "注册客户姓名"
            },
            "format": "STRING",
            "validateRule": "^[A-Za-z ]{1,100}$"
          }
        ]
      },
      {
        "formCode": "bbb",
        "formName": {
          "en_US": "IDDD1666 Customer",
          "zh_HK": "IDDD1666客戶",
          "zh-CN": "IDDD1666客户"
        },
        "merchantId": "2160400000002014",
        "subMerchantId": "67890",
        "billType": "TELECOM",
        "subBillType": "MOBILE_SERVICE",
        "fields": [
          {
            "fieldCode": "billNo",
            "displayName": {
              "en_US": "Bill Number",
              "zh_HK": "賬單號碼",
              "zh-CN": "账单号码"
            },
            "format": "NUMBER",
            "validateRule": "1,100"
          },
          {
            "fieldCode": "name",
            "displayName": {
              "en_US": "Registered Customer Name",
              "zh_HK": "註冊客戶姓名",
              "zh-CN": "注册客户姓名"
            },
            "format": "STRING",
            "validateRule": "^[A-Za-z ]{1,100}$"
          }
        ]
      }
    ]
  }
]

Response

Header

NameDescriptionTypeRequiredMax LengthSample
versionAPI versionStringM81.0.0
functionAPI interfaceStringM128alipay.intl.merchant.account.bind.template.manage
clientIdClient IDStringM82110200000000044
respTimeResponse timeStringM-2001-07-04T12:08:56+05:30
reqMsgIdRequest message IDStringM64fj398457jd8iue98d8w7w93j
reserveReserved for future implementationStringO256{}

Body

NameDescriptionTypeRequiredSample
resultResult object.ObjectMSee Result.
statusCurrent template status. Supported values: VALID, INVALID.StringMVALID

Result

NameDescriptionTypeSample
resultCodeResult code.StringSUCCESS
resultStatusResult status. S for success, F for failure.StringS
resultMessageResult description.Stringsuccess

Example

Request

Create template

copy
{
  "operationType": "CREATE",
  "outTemplateId": "20250815xxxxxxxx",
  "merchantName": {
    "en_US": "SmarTone",
    "zh_HK": "數碼通",
    "zh-CN": "数码通"
  },
  "icon": "https://example.com/icon.png",
  "supportAutoDebit": true,
  "notice": {
    "en_US": "Tips: Link your bill to receive bill reminders and make payment more easily.",
    "zh_HK": "提示:連結賬單後可接收繳費提醒,繳費更方便。",
    "zh-CN": "提示:绑定账单后可接收缴费提醒,缴费更方便。"
  },
  "sections": "[{\"sectionCode\":\"BIND\",\"menuLayout\":\"PICKER\",\"menuTitle\":{\"en_US\":\"Bill Type\",\"zh_HK\":\"帳單類型\",\"zh-CN\":\"账单类型\"},\"forms\":[{\"formCode\":\"aaa\",\"formName\":{\"en_US\":\"Home Customer\",\"zh_HK\":\"住宅客戶\",\"zh-CN\":\"住宅客户\"},\"merchantId\":\"2160400000002012\",\"subMerchantId\":\"12345\",\"billType\":\"TELECOM\",\"subBillType\":\"MOBILE_SERVICE\",\"fields\":[{\"fieldCode\":\"billNo\",\"displayName\":{\"en_US\":\"Bill Number\",\"zh_HK\":\"賬單號碼\",\"zh-CN\":\"账单号码\"},\"format\":\"NUMBER\",\"validateRule\":\"1,100\"},{\"fieldCode\":\"name\",\"displayName\":{\"en_US\":\"Registered Customer Name\",\"zh_HK\":\"註冊客戶姓名\",\"zh-CN\":\"注册客户姓名\"},\"format\":\"STRING\",\"validateRule\":\"^[A-Za-z ]{1,100}$\"}]}]}]"
}

Update template

When updating the template content, submit the full latest template payload.

copy
{
  "operationType": "UPDATE",
  "outTemplateId": "20250818xxxxxxxx",
  "status": "VALID",
  "merchantName": {
    "en_US": "SmarTone",
    "zh_HK": "數碼通",
    "zh-CN": "数码通"
  },
  "icon": "https://example.com/icon.png",
  "supportAutoDebit": true,
  "sections": "[{\"sectionCode\":\"BIND\",\"menuLayout\":\"PICKER\",\"menuTitle\":{\"en_US\":\"Bill Type\",\"zh_HK\":\"帳單類型\",\"zh-CN\":\"账单类型\"},\"forms\":[{\"formCode\":\"aaa\",\"formName\":{\"en_US\":\"Home Customer\",\"zh_HK\":\"住宅客戶\",\"zh-CN\":\"住宅客户\"},\"merchantId\":\"2160400000002012\",\"subMerchantId\":\"12345\",\"billType\":\"TELECOM\",\"subBillType\":\"MOBILE_SERVICE\",\"fields\":[{\"fieldCode\":\"billNo\",\"displayName\":{\"en_US\":\"Bill Number\",\"zh_HK\":\"賬單號碼\",\"zh-CN\":\"账单号码\"},\"format\":\"NUMBER\",\"validateRule\":\"1,100\"},{\"fieldCode\":\"name\",\"displayName\":{\"en_US\":\"Registered Customer Name\",\"zh_HK\":\"註冊客戶姓名\",\"zh-CN\":\"注册客户姓名\"},\"format\":\"STRING\",\"validateRule\":\"^[A-Za-z ]{1,100}$\"}]}]}]"
}

Deactivate template

copy
{
  "operationType": "UPDATE",
  "outTemplateId": "20250818xxxxxxxx",
  "status": "INVALID"
}

Response

copy
{
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "success"
  },
  "status": "VALID"
}