HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Get Customer Membership Tier History

GET <<api_domain>>/customers/:id/membership_tier/action_logs

Get recent membership tier action logs (not all logs) related to a customer in descending order.
可以透過此 API 拿到會員的近期會員等級異動紀錄。

Request Example

curl --request GET \
     --url '<<api_domain>>/v1/customers/:id/membership_tier/action_logs' \
     --header 'Accept: application/json'

Request Parameters

id Required string Customer Id of the customer
page integer Page number
per_page integer Numbers of action logs per page
每頁顯示 n 筆資料

Response Example

{
    "items": [
      {
            "key": "system_upgrade_tier",
            "data": {
                "previous_user_membership_tier": null,
                "updated_user_membership_tier": {
                    "_id": "6dc86eb9f2efc00030141c20",
                    "name_translations": {
                        "en": "Tester",
                        "zh-hant": "測試者 Tester"
                    }
                },
                "changes": {
                    "membership_tier_id": [
                        null,
                        "5dc86eb9f2efc00030141c20"
                    ],
                    "tier_expires_at": [
                        null,
                        "2024-04-09T15:59:59.999Z"
                    ]
                },
                "fulfilled_rule": null,
                "start_at": "2023-04-09T16:00:00.000Z",
                "end_at": "2024-04-09T15:59:59.999Z"
            },
            "status": "active",
            "merchant_id": "5ceb666ffea1260001377cda",
            "target_ids": [
                "643291e77d59c90029db48c1"
            ],
            "target_type": "User",
            "performer_name": null,
            "performer_type": "System",
            "performer_id": null,
            "created_at": "2023-04-10T16:12:35.342Z"
        }, 
      {
            "key": "manual_upgrade_tier",
            "data": {
                "previous_user_membership_tier": {
                    "_id": "6035da238ecf97003990638d",
                    "name_translations": {
                        "en": "VIP",
                        "zh-hant": "普卡會員"
                    }
                },
                "updated_user_membership_tier": {
                    "_id": "6035da888ecf970033906389",
                    "name_translations": {
                        "en": "VVIP",
                        "zh-hant": "金卡會員"
                    }
                },
                "changes": {
                    "membership_tier_id": [
                        "6035da238ecf97003990638d",
                        "6035da888ecf970033906389"
                    ],
                    "tier_expires_at": [
                        null,
                        null
                    ]
                },
                "fulfilled_rule": {
                    "_id": "641d109302452f0014776615",
                    "condition_interval": {
                        "type": "within_interval",
                        "time_value": "12",
                        "time_unit": "month"
                    },
                    "created_at": null,
                    "effect_interval": {
                        "type": "unlimited",
                        "time_value": "12",
                        "time_unit": "month"
                    },
                    "effect_type": "upgrade",
                    "total_spending": {
                        "cents": 5000,
                        "currency_iso": "TWD"
                    },
                    "updated_at": null
                },
                "start_at": "2023-04-09T07:17:33.718Z",
                "end_at": null
            },
            "status": "active",
            "merchant_id": "5fd719ea92248a0018024420",
            "target_ids": [
                "627cd071bee2ef0014519842"
            ],
            "target_type": "User",
            "performer_name": "Custom Services Team",
            "performer_type": "User",
            "performer_id": "5ce27dc58e54e700299a0b18",
            "created_at": "2023-04-10T07:17:33.729Z"
        }
    ],
    "pagination": {
        "current_page": 1,
        "per_page": 24,
        "total_count": 2,
        "total_pages": 1
    }
}
{
  "items": [
    {
      "key": "updated_user_membership_tier",
      "data": {
        "previous_user_membership_tier": {
          "_id": "6156c6da27e412004a2bff36",
          "name_translations": {
            "zh-hant": "VIP 1"
          }
        },
        "updated_user_membership_tier": {
          "_id": "6156c6bf27e41200442bff58",
          "name_translations": {
            "zh-hant": "VIP 2"
          }
        },
        "changes": {
          "membership_tier_id": [
            "6156c6da27e412004a2bff36",
            "6156c6bf27e41200442bff58"
          ],
          "tier_expires_at": [
            null,
            null
          ]
        },
        "fulfilled_rule": {
          "_id": "6156c6bf27e41200442bff59",
          "condition_interval": {
            "type": "single_purchase",
            "time_unit": "month"
          },
          "created_at": null,
          "effect_interval": {
            "type": "unlimited",
            "time_unit": "month"
          },
          "effect_type": "upgrade",
          "total_spending": {
            "cents": 5000,
            "currency_iso": "TWD"
          },
          "updated_at": null
        }
      },
      "status": "active",
      "merchant_id": "612c9dbda6e4e8001fdf4705",
      "target_ids": [
        "6169018fc253c9001b2e60ce"
      ],
      "target_type": "User",
      "performer_name": "dennyhuang",
      "performer_type": "User",
      "performer_id": "5e323edce3880921a8aaab13",
      "created_at": "2021-12-16T08:28:12.409Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 1,
    "total_count": 2,
    "total_pages": 2
  }
}
items Array of Action logs
items[].key String action type
items[].data String
items[].created_at Datetime
items[].performer_name String name of the performer
items[].performer_type String e.g. User
items[].performer_id String the id of the person who perform it
items[].performing_application_id String the application id of the application perform it

特殊參數說明

items[].key
system_upgrade_tier系統升級
expire_extend_tier到期續會
expire_downgrade_tier到期降級
order_cancelled_downgrade_tier訂單取消降級
manual_upgrade_tier手動升級
manual_downgrade_tier手動降級