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

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

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

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

หัวข้อสำคัญ

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

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

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

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

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

ตัวอย่างคำขอเพื่อเปิดใช้ส่วนเสริมโปรแกรมสะสมคะแนนโดยใช้ Programs sub-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}

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

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