ภาพรวมของโปรแกรมสะสมคะแนน

แสดงสิทธิประโยชน์ของร้านค้าใน Google โดยใช้โปรแกรมสะสมคะแนน คุณสามารถส่งสิทธิประโยชน์ต่างๆ เช่น การจัดส่งฟรี คะแนนที่แลกสิทธิ์ได้ และราคาพิเศษสำหรับสมาชิก สิทธิประโยชน์ของโปรแกรมสะสมคะแนนจะปรากฏในข้อมูลที่แสดงฟรี โฆษณา Shopping และโฆษณาสินค้าคงคลังในร้านบนแพลตฟอร์มต่างๆ ของ Google ซึ่งรวมถึง Google Search, แท็บ Shopping และ Google Wallet

Merchant API ช่วยให้ผู้ขายและผู้ให้บริการโปรแกรมสะสมคะแนนบุคคลที่สามที่ดำเนินการในนามของผู้ขายสามารถกำหนดค่าและดูแลโปรแกรมสะสมคะแนนแบบเป็นโปรแกรมได้โดยใช้ LoyaltyProgramService บริการนี้ช่วยให้คุณสร้าง ดึงข้อมูล แสดงรายการ อัปเดต และลบโปรแกรมสะสมคะแนนได้

ดูข้อมูลเพิ่มเติมเกี่ยวกับข้อกำหนดทางธุรกิจและหลักเกณฑ์ด้านนโยบายได้ที่เกี่ยวกับโปรแกรมสะสมคะแนนของผู้ขายในศูนย์ช่วยเหลือของ Merchant Center

แนวคิดสำคัญ

โปรดคำนึงถึงแนวคิดและข้อจำกัดต่อไปนี้เมื่อทำงานกับโปรแกรมสะสมคะแนน

  • ตัวระบุระดับบัญชี: Merchant API จะระบุโปรแกรมสะสมคะแนนตามรหัสบัญชี Merchant Center ที่เป็นเจ้าของ
  • ขีดจำกัดของโปรแกรมเดียว: Merchant API รองรับโปรแกรมสะสมคะแนนเพียง 1 โปรแกรมต่อบัญชีผู้ขาย
  • การเป็นเจ้าของบัญชีโดยตรง: ต้องกำหนดค่าโปรแกรมสะสมคะแนนโดยตรงในบัญชีผู้ขายเป้าหมาย (accounts/{ACCOUNT_ID}) บริการนี้ไม่รองรับการจัดการโปรแกรมสะสมคะแนนในระดับบัญชีขั้นสูงสำหรับบัญชีย่อย ผู้ให้บริการสะสมคะแนนบุคคลที่สามที่มีสิทธิ์เข้าถึงบัญชีของผู้ขายสามารถจัดการโปรแกรมในนามของผู้ขายได้
  • การตรวจสอบด้านบรรณาธิการ: หลังจากสร้างหรืออัปเดตโปรแกรมสะสมคะแนนแล้ว โปรแกรมจะได้รับการตรวจสอบ ฟิลด์ review_result.review_status จะระบุว่าโปรแกรมเป็น UNDER_REVIEW, APPROVED หรือ REJECTED
  • ภูมิภาคที่รองรับ: โปรแกรมสะสมคะแนนของผู้ขายพร้อมให้บริการในประเทศที่รองรับ ซึ่งรวมถึงออสเตรเลีย บราซิล แคนาดา ฝรั่งเศส เยอรมนี อินเดีย อิตาลี เม็กซิโก เนเธอร์แลนด์ เกาหลีใต้ สเปน สหราชอาณาจักร และสหรัฐอเมริกา
  • ข้อกำหนดของระดับขั้น: ระดับขั้นอาจไม่มีค่าใช้จ่ายในการเข้าร่วม กำหนดให้ต้องชำระค่าธรรมเนียมการเป็นสมาชิก กำหนดให้ต้องมีเกณฑ์การใช้จ่าย หรือกำหนดให้ต้องมีบัตรเครดิตที่มีแบรนด์ของผู้ขาย ระบบไม่รองรับระดับขั้นตามอาชีพ (เช่น ระดับขั้นสำหรับนักเรียนนักศึกษาหรือทหาร)
  • สิทธิพิเศษและสิทธิประโยชน์: โปรแกรมรองรับการจัดส่งฟรี คะแนนที่แลกสิทธิ์ได้ และราคาสมาชิก ในโฆษณา ราคาสมาชิกต้องมีส่วนลดอย่างน้อย 5% หรือ 5 หน่วยสกุลเงินต่ำกว่าราคาปกติหรือราคาลด

ข้อกำหนดเบื้องต้น

ก่อนจัดการโปรแกรมสะสมคะแนนด้วย Merchant API โปรดตรวจสอบว่าคุณมีคุณสมบัติตรงตามข้อกำหนดต่อไปนี้

  • คุณต้องมีบัญชี Merchant Center ที่ใช้งานอยู่ (หรือสิทธิ์เข้าถึงที่ได้รับอนุญาตในบัญชีของผู้ขายหากคุณเป็นผู้ให้บริการโปรแกรมสะสมคะแนนบุคคลที่สาม)
  • เปิดใช้ส่วนเสริมโปรแกรมสะสมคะแนนสำหรับบัญชี คุณสามารถเปิดใช้ส่วนเสริมได้โดยใช้ตัวเลือกใดตัวเลือกหนึ่งต่อไปนี้

ตัวอย่างคำขอเปิดใช้ส่วนเสริมโปรแกรมสะสมคะแนนโดยใช้ API ย่อยของโปรแกรมมีดังนี้

HTTP

POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/loyalty:enable

cURL

curl --request POST \
  'https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/loyalty:enable?key={YOUR_API_KEY}' \
  --header 'Authorization: Bearer {YOUR_ACCESS_TOKEN}' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{}' \
  --compressed

เมธอด

จัดการโปรแกรมสะสมคะแนนโดยใช้วิธีการต่อไปนี้

สร้างโปรแกรมสะสมคะแนน

หากต้องการสร้างโปรแกรมสะสมคะแนนใหม่สำหรับบัญชี ให้ใช้เมธอด loyaltyPrograms.create ระบุรายละเอียด เช่น คำอธิบายโปรแกรม, URL การลงชื่อสมัครใช้ และระดับขั้นของโปรแกรมพร้อมสิทธิประโยชน์และข้อกำหนดเฉพาะ

program_label ที่จำเป็นจะกำหนดตัวระบุที่ไม่ซ้ำกันสำหรับโปรแกรมสะสมคะแนน เช่น การระบุป้ายกำกับ my-rewards จะส่งผลให้ทรัพยากร name มีค่าเป็น accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/my-rewards

ตัวอย่างคำขอมีดังนี้

HTTP

POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms

{
  "programLabel": "my-rewards",
  "loyaltyProgram": {
    "programName": "my rewards",
    "tiers": [
      {
        "tierName": "gold",
        "tierLabel": "gold",
        "tierBenefits": [
          {
            "otherBenefit": "free gift on your birthday"
          },
          {
            "structuredBenefit": {
              "pointsEarningBenefit": {
                "minimumMoneySpent": {
                  "currencyCode": "USD",
                  "units": "25"
                },
                "pointsEarningBenefitAnnotation": {
                  "pointsEarned": 1.0,
                  "amountSpent": {
                    "currencyCode": "USD",
                    "units": "1"
                  }
                }
              }
            }
          }
        ],
        "requirements": {
          "freeToJoin": true
        }
      }
    ],
    "programDescriptions": [
      "earn rewards buying products you love"
    ],
    "signupUrl": "https://www.example.com/my_rewards_signup",
    "regionCodes": [
      "US"
    ]
  }
}

แทนที่ {ACCOUNT_ID} ด้วยตัวระบุที่ไม่ซ้ำกันของบัญชี Merchant Center

ต่อไปนี้เป็นตัวอย่างการตอบกลับคำขอที่สำเร็จ

{
  "name": "accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/my-rewards",
  "programName": "my rewards",
  "tiers": [
    {
      "tierName": "gold",
      "tierLabel": "gold",
      "tierBenefits": [
        {
          "otherBenefit": "free gift on your birthday"
        },
        {
          "structuredBenefit": {
            "pointsEarningBenefit": {
              "minimumMoneySpent": {
                "currencyCode": "USD",
                "units": "25"
              },
              "pointsEarningBenefitAnnotation": {
                "pointsEarned": 1.0,
                "amountSpent": {
                  "currencyCode": "USD",
                  "units": "1"
                }
              }
            }
          }
        }
      ],
      "requirements": {
        "freeToJoin": true
      },
      "signupUrl": "https://www.example.com/my-rewards/gold"
    }
  ],
  "programDescriptions": [
    "earn rewards buying products you love"
  ],
  "signupUrl": "https://www.example.com/my_rewards_signup",
  "reviewResult": {
    "reviewStatus": "UNDER_REVIEW"
  },
  "regionCodes": [
    "US"
  ]
}

ดึงข้อมูลโปรแกรมสะสมคะแนน

หากต้องการดึงรายละเอียดของโปรแกรมสะสมคะแนนที่ตนเองเป็นเจ้าของ ให้ใช้เมธอด loyaltyPrograms.get

ตัวอย่างคำขอมีดังนี้

HTTP

GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/{PROGRAM_LABEL}

แทนที่ {ACCOUNT_ID} ด้วยรหัสบัญชี และ {PROGRAM_LABEL} ด้วยป้ายกำกับที่ไม่ซ้ำกันของโปรแกรมสะสมคะแนน (เช่น my-rewards)

ตัวอย่างการตอบกลับคำขอที่สำเร็จมีดังนี้

{
  "name": "accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/my-rewards",
  "programName": "my rewards",
  "tiers": [
    {
      "tierName": "gold",
      "tierLabel": "gold",
      "tierBenefits": [
        {
          "otherBenefit": "free gift on your birthday"
        },
        {
          "structuredBenefit": {
            "pointsEarningBenefit": {
              "minimumMoneySpent": {
                "currencyCode": "USD",
                "units": "25"
              },
              "pointsEarningBenefitAnnotation": {
                "pointsEarned": 1.0,
                "amountSpent": {
                  "currencyCode": "USD",
                  "units": "1"
                }
              }
            }
          }
        }
      ],
      "requirements": {
        "freeToJoin": true
      },
      "signupUrl": "https://www.example.com/my-rewards/gold"
    }
  ],
  "programDescriptions": [
    "earn rewards buying products you love"
  ],
  "signupUrl": "https://www.example.com/my_rewards_signup",
  "reviewResult": {
    "reviewStatus": "UNDER_REVIEW"
  },
  "regionCodes": [
    "US"
  ]
}

แสดงโปรแกรมสะสมคะแนน

หากต้องการแสดงรายการโปรแกรมสะสมคะแนนทั้งหมดที่คุณเป็นเจ้าของซึ่งเชื่อมโยงกับบัญชีของคุณ ให้ใช้เมธอด loyaltyPrograms.list

ตัวอย่างคำขอมีดังนี้

HTTP

GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms

ต่อไปนี้เป็นตัวอย่างการตอบกลับคำขอที่สำเร็จ

{
  "loyaltyPrograms": [
    {
      "name": "accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/my-rewards",
      "programName": "my rewards",
      "tiers": [
        {
          "tierName": "gold",
          "tierLabel": "gold",
          "tierBenefits": [
            {
              "otherBenefit": "free gift on your birthday"
            },
            {
              "structuredBenefit": {
                "pointsEarningBenefit": {
                  "minimumMoneySpent": {
                    "currencyCode": "USD",
                    "units": "25"
                  },
                  "pointsEarningBenefitAnnotation": {
                    "pointsEarned": 1.0,
                    "amountSpent": {
                      "currencyCode": "USD",
                      "units": "1"
                    }
                  }
                }
              }
            }
          ],
          "requirements": {
            "freeToJoin": true
          },
          "signupUrl": "https://www.example.com/my-rewards/gold"
        }
      ],
      "programDescriptions": [
        "earn rewards buying products you love"
      ],
      "signupUrl": "https://www.example.com/my_rewards_signup",
      "reviewResult": {
        "reviewStatus": "UNDER_REVIEW"
      },
      "regionCodes": [
        "US"
      ]
    }
  ]
}

อัปเดตโปรแกรมสะสมคะแนน

หากต้องการอัปเดตโปรแกรมสะสมคะแนนที่มีอยู่ ให้ใช้เมธอด loyaltyPrograms.update ทำการอัปเดตบางส่วนโดยใช้ update_mask หรือทำการแทนที่ทั้งหมดโดยละเว้นมาสก์

การอัปเดตบางส่วนด้วยมาสก์การอัปเดต

update_mask ช่วยให้คุณระบุช่องที่ต้องการอัปเดตได้อย่างเจาะจง ระบบจะแก้ไขเฉพาะช่องที่แสดงในมาสก์ ส่วนช่องที่ไม่ได้แสดงจะยังคงเหมือนเดิม ระบบจะไม่สนใจช่องที่ละเว้นจากมาสก์การอัปเดต แม้ว่าจะระบุไว้ในเนื้อหาคำขอก็ตาม

ตัวอย่างคำขอต่อไปนี้จะอัปเดตเฉพาะ programDescriptions และ advancedSettings

HTTP

PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/{PROGRAM_LABEL}?update_mask=program_descriptions,advanced_settings

{
  "programDescriptions": [
    "a new description of the program"
  ],
  "advancedSettings": {
    "hideDisplayFromNonMembers": true
  },
  "signupUrl": "https://www.example.com"
}

ในตัวอย่างนี้ บริการจะละเว้น signupUrl เนื่องจากไม่ได้รวมอยู่ใน update_mask ช่อง programDescriptions จะแทนที่คำอธิบายที่กำหนดค่าไว้ก่อนหน้านี้ทั้งหมด

ตัวอย่างการตอบกลับจากคำขอที่สำเร็จมีดังนี้

{
  "name": "accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/my-rewards",
  "programName": "my rewards",
  "tiers": [
    {
      "tierName": "gold",
      "tierLabel": "gold",
      "tierBenefits": [
        {
          "otherBenefit": "free gift on your birthday"
        },
        {
          "structuredBenefit": {
            "pointsEarningBenefit": {
              "minimumMoneySpent": {
                "currencyCode": "USD",
                "units": "25"
              },
              "pointsEarningBenefitAnnotation": {
                "pointsEarned": 1.0,
                "amountSpent": {
                  "currencyCode": "USD",
                  "units": "1"
                }
              }
            }
          }
        }
      ],
      "requirements": {
        "freeToJoin": true
      },
      "signupUrl": "https://www.example.com/my-rewards/gold"
    }
  ],
  "programDescriptions": [
    "a new description of the program"
  ],
  "signupUrl": "https://www.example.com/my_rewards_signup",
  "reviewResult": {
    "reviewStatus": "UNDER_REVIEW"
  },
  "regionCodes": [
    "US"
  ],
  "advancedSettings": {
    "hideDisplayFromNonMembers": true
  }
}

การแทนที่ทั้งหมดโดยไม่มีมาสก์การอัปเดต

เมื่อคุณละเว้นพารามิเตอร์ update_mask คำขอจะแทนที่การกำหนดค่าโปรแกรมสะสมคะแนนทั้งหมด

ตัวอย่างคำขอมีดังนี้

HTTP

PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/{PROGRAM_LABEL}

{
  "programName": "Updated Program",
  "signupUrl": "https://example.com/updated",
  "programDescriptions": [
    "Updated description"
  ],
  "regionCodes": [
    "US"
  ],
  "tiers": [
    {
      "tierName": "Gold Tier",
      "tierLabel": "gold",
      "tierBenefits": [
        {
          "otherBenefit": "Free shipping"
        }
      ],
      "requirements": {
        "freeToJoin": true
      }
    }
  ]
}

ตัวอย่างการตอบกลับจากคำขอที่สำเร็จมีดังนี้

{
  "name": "accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/my-rewards",
  "programName": "Updated Program",
  "tiers": [
    {
      "tierName": "Gold Tier",
      "tierLabel": "gold",
      "tierBenefits": [
        {
          "otherBenefit": "Free shipping"
        }
      ],
      "requirements": {
        "freeToJoin": true
      }
    }
  ],
  "programDescriptions": [
    "Updated description"
  ],
  "signupUrl": "https://example.com/updated",
  "reviewResult": {
    "reviewStatus": "UNDER_REVIEW"
  },
  "regionCodes": [
    "US"
  ]
}

ลบโปรแกรมสะสมคะแนน

หากต้องการลบโปรแกรมสะสมคะแนนออกจากบัญชี ให้ใช้เมธอด loyaltyPrograms.delete

ตัวอย่างคำขอมีดังนี้

HTTP

DELETE https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs/loyalty/loyaltyPrograms/{PROGRAM_LABEL}

หากทำสำเร็จ เนื้อหาการตอบกลับจะว่างเปล่า

ขั้นตอนถัดไป