📌[SCRIPT-EN] - Ecommerce order recording

The partner needs to place the above script on the appropriate page (for example, the order success page) so that the correct order number and order value can be recorded.

Here MasOffer is leaving sample data, partners please edit the information accordingly.

<script type="text/javascript">
masoffer_order_info = {
  "offer_id": {{offer_id}},
  "signature": {{signature}},
  "transaction_id": "ABC123",
  "transaction_time": 1557388224436,
  "transaction_discount": 0,
  "traffic_id": {{mo_traffic_id}},
  "products": [
    {
      "sku": "SKU001",
      "url": "https://test.com/...",
      "price": 10000,
      "name": "product name 1",
      "category": "product category 1",
      "category_id": "123",
      "status_code": 0,
      "quantity": 1,
      "shop_id": "SHOP1"
    },
    {
      "sku": "SKU002",
      "url": "https://test.com/...",
      "price": 10000,
      "name": "product name 2",
      "category": "product category 2",
      "category_id": "456",
      "status_code": 0,
      "quantity": 2,
      "shop_id": "SHOP2"
    }
  ]
};
</script>
<script type="text/javascript" src="https://static.masoffer.net/php/tracking_js.php?type=dev" async></script>

To put it on production, partners please change the last script to:

<script type="text/javascript" src="https://static.masoffer.net/php/tracking_js.php?type=cps" async></script>

Explain the meaning of the parameters

Parameters
Description
Type
Require

offer_id

Partner id provided by MasOffer.

String

signature

Signature of the partner provided by MasOffer.

String

transaction_id

MPartner order number.

String

transaction_time

Order generation time - milliseconds. Partners can see how to convert time to milliseconds here: https://currentmillis.com/

Number

transaction_discount

The amount is reduced when there is a promotion.

Number

traffic_id

The ID of the traffic provided by MasOffer via Tracking Link (stored in a cookie).

String

products.sku

SKU of the product

String

products.url

Product page URL.

String

products.price

Price (after promotion if any) of the product.

Number

products.name

Product's name.

String

products.category

Product’s category.

String

products.category_id

Product category ID:

  • Set value to “1” if the partner does not divide the commission by product category.

  • Set value follows the agreement between the two parties if the partner divides the commission according to the product category.

String

products.status_code

Order processing status:

  • 0: processing

  • 1: successfully purchased

  • -1: canceled

Here MasOffer is defaulting set it to 0.

Number

products.quantity

The number of products

Number

products.shop_id

ID of partner merchant/shop

String

In the case of order status update, the partner fires a postback like https://app.gitbook.com/s/qtj4PNLH8KFAqZbV8NM3/~/changes/NmgVd056sLZD65lTma6d/webhook-api-ghi-nhan-don-hang-ecommerce but changes the status_code field value.

Response

Success

{
  "meta": {
    "status_code": 1,
    "status": "success",
    "external_message": "Success",
    "internal_message": "Success"
  }
}

Failure

{
  "meta": {
    "status_code": -1,
    "status": "failed",
    "external_message": "Message",
    "internal_message": "Message",
    "trace_id": "${trace_id}"
  }
}

Explain the meaning of response

Fields
Description

status/status_code

Trạng thái request:

success/1: Thành công

failed/-1: Lỗi

external_message/

internal_message

Thông báo thành công hoặc thông tin về lỗi

trace_id

The ID of the error is used to check the details of the error when necessary (When there is an error to check, please attach the trace_id)

Last updated