ภาพรวมของ API โปรโมชันจากผู้ขาย

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

เมื่อคุณเพิ่มโปรโมชันไปยังผลิตภัณฑ์ ผู้เลือกซื้อจะเห็นลิงก์ข้อเสนอพิเศษ เช่น "ลด 15%" หรือ "จัดส่งฟรี" ลิงก์ข้อเสนอจะช่วยเพิ่มความน่าสนใจให้กับผลิตภัณฑ์และกระตุ้นให้ผู้เลือกซื้อทำการซื้อ โดยโปรโมชันทั้งหมดจะนำไปใช้ที่จุดชำระเงินหรือจุดขาย

ดูข้อมูลเพิ่มเติมได้ที่ข้อมูลเบื้องต้นเกี่ยวกับโปรโมชัน

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

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

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

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

ดูข้อมูลเพิ่มเติมได้ที่เกณฑ์และนโยบายการเข้าร่วม

สร้างแหล่งข้อมูล

คุณสามารถใช้เมธอด accounts.dataSources.create เพื่อสร้างแหล่งข้อมูลโปรโมชัน หากมีแหล่งข้อมูลโปรโมชันที่มีอยู่ ให้ใช้วิธี accounts.dataSources.list เพื่อเรียกข้อมูลแหล่งที่มาทั้งหมด จากนั้นคุณใช้ช่อง name ของแหล่งข้อมูลโปรโมชันเพื่อสร้างโปรโมชันได้

คําขอต่อไปนี้แสดงวิธีสร้างแหล่งข้อมูลสําหรับเพิ่มโปรโมชัน

POST https://merchantapi.googleapis.com/datasources/v1beta/accounts/{ACCOUNT_ID}/dataSources

{
  "displayName": "{DISPLAY_NAME}",
  "promotionDataSource": {
    "contentLanguage": "{CONTENT_LANGUAGE}",
    "targetCountry": "{TARGET_COUNTRY}"
  }
}

แทนที่ค่าต่อไปนี้

  • {ACCOUNT_ID}: ตัวระบุที่ไม่ซ้ำกันของบัญชีดังที่ปรากฏใน UI ของ Merchant Center
  • {DISPLAY_NAME}: ชื่อที่แสดงของแหล่งข้อมูล
  • {CONTENT_LANGUAGE}: รหัสภาษา 2 ตัวอักษรตามมาตรฐาน ISO 639-1 ของผลิตภัณฑ์ในแหล่งข้อมูล
  • {TARGET_COUNTRY}: รหัสเขตแดน CLDR ของประเทศเป้าหมายที่คุณต้องการให้โปรโมชันแสดง

หลังจากคําขอทํางานสําเร็จแล้ว คุณจะเห็นคําตอบต่อไปนี้ซึ่งมีรายละเอียดเกี่ยวกับแหล่งข้อมูลโปรโมชันที่สร้างขึ้นใหม่

{
  "name": "accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}",
  "dataSourceId": "{DATASOURCE_ID}",
  "displayName": "{DISPLAY_NAME}",
  "promotionDataSource": {
    "targetCountry": "{TARGET_COUNTRY}",
    "contentLanguage": "{CONTENT_LANGUAGE}"
  },
  "input": "API"
}

สร้างโปรโมชัน

คุณสามารถใช้วิธี accounts.promotions.insert เพื่อสร้างหรืออัปเดตโปรโมชัน เมธอด accounts.promotions.insert จะรับแหล่งข้อมูล promotions และชื่อแหล่งข้อมูลเป็นอินพุต ซึ่งจะแสดงโปรโมชันใหม่หรือที่อัปเดตแล้ว หากดำเนินการสำเร็จ

การสร้างโปรโมชันต้องใช้ชื่อแหล่งข้อมูล นอกจากนี้ คุณยังต้องระบุค่าสำหรับฟิลด์ต่อไปนี้ในคำขอด้วย

  • contentLanguage
  • redemptionChannel
  • promotionId
  • targetCountry
  • attributes.offerType
  • attributes.genericRedemptionCode
  • attributes.couponValueType
  • attributes.productApplicability
  • attributes.promotionEffectiveTimePeriod.endTime
  • attributes.promotionEffectiveTimePeriod.startTime
  • attributes.longTitle

Google จะตรวจสอบและอนุมัติโปรโมชันของคุณก่อนเผยแพร่ ดูข้อมูลเพิ่มเติมได้ที่กระบวนการอนุมัติโปรโมชัน

เราขอแนะนําให้คุณอ่านนโยบายโปรโมชันเพื่อให้มั่นใจว่าโปรโมชันที่คุณสร้างจะเพิ่มมูลค่าและเป็นไปตามนโยบายโฆษณา Shopping

คำขอต่อไปนี้แสดงวิธีสร้างโปรโมชันออนไลน์

POST https://merchantapi.googleapis.com/promotions/v1beta/accounts/{ACCOUNT_ID}/promotions:insert

{
  "promotion": {
    "name": "{PROMOTION_NAME}",
    "promotionId": "{PROMOTION_ID}",
    "targetCountry": "{TARGET_COUNTRY}",
    "redemptionChannel": [
      "ONLINE"
    ],
    "contentLanguage": "{CONTENT_LANGUAGE}",
    "attributes": {
      "promotionDisplayTimePeriod": {
        "endTime": "{PROMOTION_END_TIME}",
        "startTime": "{PROMOTION_START_TIME}"
      },
      "offerType": "{OFFER_TYPE}",
      "longTitle": "{LONG_TITLE}"
    }
  },
  "dataSource": "accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}"
}

ดูข้อมูลเกี่ยวกับกฎที่เกี่ยวข้องกับการตั้งค่ารหัสโปรโมชันได้ที่ข้อกำหนดขั้นต่ำสำหรับแอตทริบิวต์รหัสโปรโมชัน

ค่าที่ใช้ได้สำหรับช่อง offerType ที่ต้องกรอกคือ NO_CODE และ GENERIC_CODE หากไม่ได้ระบุค่าใดค่าหนึ่งเหล่านี้ คำขอ API จะดำเนินการไม่สำเร็จพร้อมคำตอบ HTTP 400 [offer_type] validation/missing_required: Invalid or missing required attribute: offer_type ระบบจะแสดงข้อความแสดงข้อผิดพลาดที่คล้ายกันหากคุณไม่ได้กรอกข้อมูลในช่องที่ต้องกรอก

หากไม่ได้ระบุค่าสำหรับฟิลด์ attributes.genericRedemptionCode คำขอจะดำเนินการไม่สำเร็จพร้อมการตอบกลับ HTTP 400 [genericRedemptionCode] No redemption code provided

ค่าของช่อง promotion.attributes.promotionDisplayTimePeriod.startTime และ promotion.attributes.promotionDisplayTimePeriod.endTime ต้องอยู่ในรูปแบบ yyyy-mm-ddThh:mm:ssZ โปรดตรวจสอบว่าได้แทนที่ค่าของฟิลด์เหล่านี้ด้วยวันที่ในอนาคต

ดูข้อมูลเพิ่มเติมได้ที่ข้อกำหนดในการจัดทำข้อมูลโปรโมชัน

ดูแนวทางปฏิบัติแนะนำเกี่ยวกับการสร้างโปรโมชันได้ที่แนวทางปฏิบัติแนะนำสำหรับโปรโมชัน

ดูรายการแอตทริบิวต์ที่เกี่ยวข้องกับโปรโมชันได้ที่เพิ่มแอตทริบิวต์ Structured Data

หลังจากคําขอสร้างโปรโมชันทํางานสําเร็จแล้ว ระบบอาจใช้เวลา 2-3 นาทีในการดึงข้อมูลโปรโมชันโดยใช้ API หรือเพื่อให้โปรโมชันปรากฏใน Merchant Center

ต่อไปนี้คือตัวอย่างที่คุณสามารถใช้เพื่อแทรกโปรโมชันหลายรายการแบบไม่พร้อมกัน

Java

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutureCallback;
import com.google.api.core.ApiFutures;
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.Timestamp;
import com.google.shopping.merchant.promotions.v1beta.Attributes;
import com.google.shopping.merchant.promotions.v1beta.CouponValueType;
import com.google.shopping.merchant.promotions.v1beta.InsertPromotionRequest;
import com.google.shopping.merchant.promotions.v1beta.OfferType;
import com.google.shopping.merchant.promotions.v1beta.ProductApplicability;
import com.google.shopping.merchant.promotions.v1beta.Promotion;
import com.google.shopping.merchant.promotions.v1beta.PromotionsServiceClient;
import com.google.shopping.merchant.promotions.v1beta.PromotionsServiceSettings;
import com.google.shopping.merchant.promotions.v1beta.RedemptionChannel;
import com.google.shopping.type.CustomAttribute;
import com.google.shopping.type.Destination.DestinationEnum;
import com.google.type.Interval;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/** This class demonstrates how to insert multiple promotions asynchronously. */
public class InsertPromotionsAsyncSample {

  private static String generateRandomString() {
    String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    Random random = new Random();
    StringBuilder sb = new StringBuilder(8);
    for (int i = 0; i < 8; i++) {
      sb.append(characters.charAt(random.nextInt(characters.length())));
    }
    return sb.toString();
  }

  private static Promotion createPromotion(String accountId) {
    String merchantPromotionId = generateRandomString();

    Attributes attributes =
        Attributes.newBuilder()
            .setProductApplicability(ProductApplicability.ALL_PRODUCTS)
            .setOfferType(OfferType.GENERIC_CODE)
            .setGenericRedemptionCode("ABCD1234")
            .setLongTitle("My promotion")
            .setCouponValueType(CouponValueType.PERCENT_OFF)
            .addPromotionDestinations(DestinationEnum.SHOPPING_ADS)
            .setPercentOff(10)
            // Note that promotions have a 6-month limit.
            // For more information, read here: https://support.google.com/merchants/answer/2906014
            // Also note that only promotions valid within the past 365 days are shown in the UI.
            .setPromotionEffectiveTimePeriod(
                Interval.newBuilder()
                    .setStartTime(Timestamp.newBuilder().setSeconds(1726842472))
                    .setEndTime(Timestamp.newBuilder().setSeconds(1726842473))
                    .build())
            .build();

    return Promotion.newBuilder()
        .setName(String.format("accounts/%s/merchantPromotions/%s", accountId, merchantPromotionId))
        .setPromotionId(merchantPromotionId)
        .setContentLanguage("fr")
        .setTargetCountry("CH")
        .addRedemptionChannel(RedemptionChannel.ONLINE)
        .setAttributes(attributes)
        // Custom attributes allow you to add additional information which is not available in
        // Attributes. For example, you might want to pilot experimental functionality.
        .addCustomAttributes(
            CustomAttribute.newBuilder()
                .setName("another example name")
                .setValue("another example value")
                .build())
        .build();
  }

  public static void asyncInsertPromotions(String accountId, String dataSourceId) throws Exception {
    GoogleCredentials credential = new Authenticator().authenticate();

    PromotionsServiceSettings merchantPromotionsServiceSettings =
        PromotionsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    try (PromotionsServiceClient merchantPromotionsServiceClient =
        PromotionsServiceClient.create(merchantPromotionsServiceSettings)) {

      // Arbitrarily creates five merchant promotions with random IDs.
      List<InsertPromotionRequest> requests = new ArrayList<>();
      for (int i = 0; i < 5; i++) {
        InsertPromotionRequest request =
            InsertPromotionRequest.newBuilder()
                .setParent(String.format("accounts/%s", accountId))
                .setPromotion(createPromotion(accountId))
                .setDataSource(String.format("accounts/%s/dataSources/%s", accountId, dataSourceId))
                .build();
        requests.add(request);
      }

      // Inserts the merchant promotions.
      List<ApiFuture<Promotion>> futures =
          requests.stream()
              .map(
                  request ->
                      merchantPromotionsServiceClient.insertPromotionCallable().futureCall(request))
              .collect(Collectors.toList());

      // Creates callback to handle the responses when all are ready.
      ApiFuture<List<Promotion>> responses = ApiFutures.allAsList(futures);
      ApiFutures.addCallback(
          responses,
          new ApiFutureCallback<List<Promotion>>() {
            @Override
            public void onSuccess(List<Promotion> results) {
              System.out.println("Inserted merchant promotions below:");
              System.out.println(results);
            }

            @Override
            public void onFailure(Throwable throwable) {
              System.out.println(throwable);
            }
          },
          MoreExecutors.directExecutor());
    } catch (Exception e) {
      System.out.println(e);
    }
  }


  public static void main(String[] args) throws Exception {
    Config config = Config.load();
    asyncInsertPromotions(config.getAccountId().toString(), "<YOUR_DATA_SOURCE_ID>");
  }
}

ต่อไปนี้คือตัวอย่างโปรโมชันที่คุณสามารถใช้เพื่อเริ่มต้นใช้งาน

โปรโมชันในพื้นที่ที่ใช้กับผลิตภัณฑ์และร้านค้าทั้งหมด

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

POST https://merchantapi.googleapis.com/promotions/v1beta/accounts/{ACCOUNT_ID}/promotions:insert

{
  "promotion": {
    "promotionId": "buy_2_get_10_off",
    "contentLanguage": "en",
    "targetCountry": "US",
    "redemptionChannel": [
      "IN_STORE"
    ],
    "attributes": {
      "longTitle": "Buy 2 and get 10$ OFF purchase",
      "productApplicability": "ALL_PRODUCTS",
      "offerType": "NO_CODE",
      "couponValueType": "BUY_M_GET_MONEY_OFF",
      "promotionDisplayTimePeriod": {
        "startTime": "2024-2-06T00:47:44Z",
        "endTime": "2024-5-06T00:47:44Z"
      },
      "promotionEffectiveTimePeriod": {
        "startTime": "2024-2-06T00:47:44Z",
        "endTime": "2024-5-06T00:47:44Z"
      },
      "moneyOffAmount": {
        "amountMicros": "1000000",
        "currencyCode": "USD"
      },
      "minimumPurchaseQuantity": 2,
      "storeApplicability": "ALL_STORES",
      "promotionUrl": "http://promotionnew4url.com/",
      "promotionDestinations": [
        "LOCAL_INVENTORY_ADS"
      ],
    }
  },
  "dataSource": "accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}"
}

ต้องกรอกข้อมูลในช่อง productApplicability ซึ่งจะบ่งบอกว่าโปรโมชันใช้ได้กับผลิตภัณฑ์ทั้งหมดหรือเฉพาะบางผลิตภัณฑ์ ค่าที่รองรับคือ ALL_PRODUCTS และ SPECIFIC_PRODUCTS ดูข้อมูลเพิ่มเติมได้ที่เลือกผลิตภัณฑ์สำหรับโปรโมชัน

ต้องกรอกข้อมูลในช่อง couponValueType ซึ่งจะเป็นสัญญาณบ่งบอกประเภทโปรโมชันที่คุณใช้งานอยู่ โปรดดูรายการค่าที่รองรับที่หัวข้อประเภทมูลค่าของคูปอง คุณจำเป็นต้องระบุแอตทริบิวต์บางอย่าง ทั้งนี้ขึ้นอยู่กับประเภทมูลค่าของคูปองที่เลือก

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

ในทํานองเดียวกัน คุณสามารถใช้ช่อง minimumPurchaseAmount เพื่อกําหนดยอดสั่งซื้อขั้นต่ำที่จําเป็นต่อการแลกรับโปรโมชัน ดูข้อมูลเพิ่มเติมได้ที่จำนวนเงินขั้นต่ำที่ซื้อ

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

โปรโมชันออนไลน์ที่ใช้กับผลิตภัณฑ์ที่เลือกซึ่งมีรหัสแลกรับข้อเสนอ

คําขอตัวอย่างต่อไปนี้แสดงวิธีสร้างโปรโมชันออนไลน์ที่ใช้กับผลิตภัณฑ์ที่เลือกซึ่งมีรหัสแลกรับข้อเสนอ

POST https://merchantapi.googleapis.com/promotions/v1beta/accounts/{ACCOUNT_ID}/promotions:insert

{
 "promotion": {
   "promotionId": "25_pct_off",
   "contentLanguage": "en",
   "targetCountry": "US",
   "redemptionChannel": [
     "ONLINE"
   ],
   "attributes": {
     "longTitle": "10% off on selected items",
     "productApplicability": "SPECIFIC_PRODUCTS",
     "offerType": "GENERIC_CODE",
     "genericRedemptionCode": "SPRINGSALE",
     "couponValueType": "PERCENT_OFF",
     "promotionDisplayTimePeriod": {
       "startTime": "2024-2-06T00:47:44Z",
       "endTime": "2024-5-06T00:47:44Z"
     },
     "promotionEffectiveTimePeriod": {
       "startTime": "2024-2-06T00:47:44Z",
       "endTime": "2024-5-06T00:47:44Z"
     },
     "percentOff": 25,
     "promotionDestinations": [
       "FREE_LISTINGS"
     ],
     "itemIdInclusion": [
       "1499860100",
       "1499860101",
       "1499860102",
       "1499860103",
       "1499860104"
     ],
   }
 },
 "dataSource": "accounts/{ACCOUNT_ID}/dataSources/1000000573361824"
}

ดูโปรโมชัน

หากต้องการดูโปรโมชัน ให้ใช้ accounts.promotions.get คำขอ GET นี้เป็นแบบอ่านอย่างเดียว โดยต้องใช้ merchantId และรหัสของโปรโมชัน เมธอด GET จะแสดงผลแหล่งข้อมูลโปรโมชันที่เกี่ยวข้อง

เช่น

GET https://merchantapi.googleapis.com/promotions/v1beta/accounts/{ACCOUNT_ID}/promotions/{PROMOTION_ID}

แทนที่ค่าต่อไปนี้

  • {ACCOUNT_ID}: ตัวระบุที่ไม่ซ้ำกันของบัญชี Merchant Center
  • {PROMOTION_ID}: ตัวระบุที่ไม่ซ้ำของโปรโมชันที่ต้องการเรียกข้อมูล รูปแบบคือ {CHANNEL}~{CONTENT_LANGUAGE}~{TARGET_COUNTRY}~{PROMOTION_ID}

โปรดทราบว่าระบบจะใช้เวลา 2-3 นาทีในการดึงข้อมูลโปรโมชันที่สร้างขึ้นใหม่โดยใช้ API

ดูโปรโมชันในพื้นที่

คําขอตัวอย่างต่อไปนี้จะดึงข้อมูลโปรโมชันในร้านที่มีรหัสโปรโมชันเป็น in_store~en~US~buy_2_get_10_off

GET https://merchantapi.googleapis.com/promotions/v1beta/accounts/{ACCOUNT_ID}/promotions/in_store~en~US~buy_2_get_10_off

หลังจากส่งคำขอสำเร็จแล้ว คุณจะเห็นการตอบกลับต่อไปนี้

{
 "name": "accounts/{ACCOUNT_ID}/promotions/in_store~en~US~buy_2_get_10_off",
 "promotionId": "buy_2_get_10_off",
 "contentLanguage": "en",
 "targetCountry": "US",
 "redemptionChannel": [
   "IN_STORE"
 ],
 "attributes": {
   "longTitle": "Buy 2 and get 10$ OFF purchase",
   "productApplicability": "ALL_PRODUCTS",
   "offerType": "NO_CODE",
   "couponValueType": "BUY_M_GET_MONEY_OFF",
   "promotionDisplayTimePeriod": {
     "startTime": "2024-2-06T00:47:44Z",
     "endTime": "2024-5-06T00:47:44Z"
   },
   "promotionEffectiveTimePeriod": {
     "startTime": "2024-2-06T00:47:44Z",
     "endTime": "2024-5-06T00:47:44Z"
   },
   "moneyOffAmount": {
     "amountMicros": "1000000",
     "currencyCode": "USD"
   },
   "minimumPurchaseQuantity": 2,
   "storeApplicability": "ALL_STORES",
   "promotionUrl": "http://promotionnew4url.com/",
   "promotionDestinations": [
     "LOCAL_INVENTORY_ADS"
   ],
 }
 "dataSource": "accounts/{ACCOUNT_ID}/dataSources/1000000573361824"
}

ฟิลด์ moneyOffAmount ในตัวอย่างนี้จะระบุส่วนลดที่มีให้ในโปรโมชัน ดูข้อมูลเพิ่มเติมได้ที่จำนวนเงินส่วนลดของโปรโมชัน

ช่อง promotionUrl ในตัวอย่างนี้จะแสดงลิงก์ไปยังเว็บไซต์ของร้านค้าเพื่อให้ผู้เลือกซื้อดูข้อมูลเพิ่มเติมเกี่ยวกับโปรโมชันได้ โปรโมชันโฆษณาสินค้าคงคลังในร้านจะแสดงข้อผิดพลาดหากคุณไม่ได้ใส่ช่อง promotionUrl

ดูโปรโมชันออนไลน์

คําขอตัวอย่างต่อไปนี้จะดึงข้อมูลโปรโมชันออนไลน์ที่มีรหัสโปรโมชันเป็น online~en~US~25_pct_off

GET https://merchantapi.googleapis.com/promotions/v1beta/accounts/{ACCOUNT_ID}/promotions/online~en~US~25_pct_off
{
 "name": "accounts/{ACCOUNT_ID}/promotions/online~en~US~25_pct_off",
 "promotionId": "25_pct_off",
 "contentLanguage": "en",
 "targetCountry": "US",
 "redemptionChannel": [
   "ONLINE"
 ],
 "attributes": {
   "longTitle": "10% off on selected items",
   "productApplicability": "SPECIFIC_PRODUCTS",
   "offerType": "GENERIC_CODE",
   "genericRedemptionCode": "WINTERGIFT",
   "couponValueType": "PERCENT_OFF",
   "promotionDisplayTimePeriod": {
     "startTime": "2024-2-06T00:47:44Z",
     "endTime": "2024-5-06T00:47:44Z"
   },
   "promotionEffectiveTimePeriod": {
     "startTime": "2024-2-06T00:47:44Z",
     "endTime": "2024-5-06T00:47:44Z"
   },
   "percentOff": 25,
   "promotionDestinations": [
     "FREE_LISTINGS"
   ],
   "itemIdInclusion": [
     "1499860100",
     "1499860101",
     "1499860102",
     "1499860103",
     "1499860104"
   ],
 }
 "dataSource": "accounts/{ACCOUNT_ID}/dataSources/{dataSource}"
}

ช่อง itemIdInclusion ที่ใช้ในตัวอย่างนี้กล่าวถึงผลิตภัณฑ์ที่มีสิทธิ์รับโปรโมชัน ดูข้อมูลเพิ่มเติมได้ที่รหัสผลิตภัณฑ์สำหรับโปรโมชัน

แสดงโปรโมชัน

คุณใช้วิธีนี้ promotions.list เพื่อดูโปรโมชันที่สร้างขึ้นทั้งหมดได้

GET https://merchantapi.googleapis.com/promotions/v1beta/{ACCOUNT_ID}/promotions

การตอบกลับจะมีรายการโปรโมชันทั้งหมดในบัญชี คุณสามารถดูรายละเอียดต่างๆ ของโปรโมชันแต่ละรายการได้ เช่น promotionId, redemptionChannel, dataSource, promotionStatus และอื่นๆ

ดูสถานะโปรโมชัน

หากต้องการดูสถานะโปรโมชัน ให้ดูแอตทริบิวต์ promotionStatus ที่แสดงผลโดยเมธอด promotions.get หรือ promotions.list

ช่อง promotionStatus อาจมีค่าต่อไปนี้

  • IN_REVIEW: โปรโมชันยังอยู่ระหว่างการตรวจสอบ
  • REJECTED: โปรโมชันไม่ได้รับอนุมัติ
  • LIVE: โปรโมชันได้รับอนุมัติและใช้งานอยู่
  • STOPPED: บัญชีหยุดโปรโมชัน
  • EXPIRED: โปรโมชันไม่มีการใช้งานแล้ว
  • PENDING: โปรโมชันไม่ได้หยุดลง และการตรวจสอบทั้งหมดได้รับอนุมัติแล้ว แต่วันที่ที่ใช้งานอยู่คือวันที่ในอนาคต
  • STATE_UNSPECIFIED: สถานะโปรโมชันที่ไม่รู้จัก

หากต้องการทำความเข้าใจกระบวนการอนุมัติโปรโมชันที่คุณสร้างขึ้น โปรดดูกระบวนการอนุมัติโปรโมชัน

ตัวอย่างสถานะโปรโมชัน

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

ไม่มีการแมปผลิตภัณฑ์

เนื้อความการตอบกลับต่อไปนี้แสดงโปรโมชันออนไลน์ที่ไม่ได้รับอนุมัติเนื่องจากไม่มีการแมปผลิตภัณฑ์

  "promotionStatus": {
    "destinationStatuses": [
      {
        "reportingContext": "FREE_LISTINGS",
        "status": "REJECTED"
      }
    ],
    "itemLevelIssues": [
      {
        "code": "promotion_sku_unmapped",
        "severity": "DISAPPROVED",
        "resolution": "merchant_action",
        "reportingContext": "FREE_LISTINGS",
        "description": "Unmapped",
        "detail": "This promotion couldn't be tested during review because it doesn't apply to any products that are currently in your Products feed",
        "documentation": "https://support.google.com/merchants/answer/2906014",
        "applicableCountries": [
          "US"
        ]
      },
      {
        "code": "promotion_sku_additional_requirements",
        "severity": "DISAPPROVED",
        "resolution": "merchant_action",
        "reportingContext": "FREE_LISTINGS",
        "description": "Promotion conditions not allowed",
        "detail": "This promotion has additional requirements that are not allowed such as requiring customers to verify additional details like phone number or ID before showing the promotion details",
        "documentation": "https://support.google.com/merchants/answer/2906014",
        "applicableCountries": [
          "US"
        ]
      }
    ]
  }

หากต้องการแก้ปัญหาเกี่ยวกับโปรโมชันที่ไม่ได้รับอนุมัติและดูวิธีหลีกเลี่ยงการไม่อนุมัติในอนาคต โปรดดูแก้ไขปัญหาเกี่ยวกับโปรโมชันที่ไม่ได้รับอนุมัติ

หากโปรโมชันที่คุณสร้างไม่ได้รับอนุมัติ คุณจะได้รับอีเมลที่ระบุเหตุผลของการปฏิเสธและวิธีการแก้ไขปัญหา

โปรโมชันอยู่ระหว่างการประเมิน

เนื้อหาการตอบกลับต่อไปนี้แสดงโปรโมชันที่อยู่ระหว่างการประเมิน

  "promotionStatus": {
    "destinationStatuses": [
      {
        "reportingContext": "FREE_LISTINGS",
        "status": "PENDING"
      },
      {
        "destination": "SHOPPING_ADS",
        "status": "PENDING"
      }
    ],
    "itemLevelIssues": []
  }

โปรโมชันที่ได้รับอนุมัติและเผยแพร่อยู่

เนื้อความการตอบกลับต่อไปนี้แสดงโปรโมชันที่ผู้เลือกซื้อเห็น

  "promotionStatus": {
    "destinationStatuses": [
      {
        "reportingContext": "FREE_LISTINGS",
        "status": "LIVE"
      },
      {
        "destination": "SHOPPING_ADS",
        "status": "LIVE"
 }  ],
    "itemLevelIssues": []
  }

ดูข้อมูลเพิ่มเติมได้ที่คำถามที่พบบ่อยเกี่ยวกับสถานะโปรโมชัน

ดูข้อมูลเพิ่มเติม