您如何知道礼品卡已用于 Shopify 订单

How do you know a Gift Card was used with a Shopify Order

如果客户使用礼品卡支付订单的全部或部分款项,我们如何从订单详情中获知金额?有没有办法汇总订单中使用的礼品卡总金额?

您可以通过交易 API 接收此信息。 Shopify 上的每个订单可能有多个交易。在交易对象中,您可以找到有关礼品卡 ID 和金额的信息

例如

GET /admin/orders/#{id}/transactions.json 方法在订单 已支付 使用礼品卡和货到付款时的响应:

{
    "transactions": [{
        "id": 89999999999,
        "order_id": 9999999999,
        "amount": "25.00",
        "kind": "sale",
        "gateway": "gift_card",
        "status": "success",
        "message": null,
        "created_at": "2017-09-28T16:34:41+04:00",
        "test": false,
        "authorization": null,
        "currency": "AED",
        "location_id": null,
        "user_id": null,
        "parent_id": null,
        "device_id": null,
        "receipt": {
            "gift_card_id": 999999,
            "gift_card_last_characters": "98h8"
        },
        "error_code": null,
        "source_name": "web"
    }, {
        "id": 89999999999,
        "order_id": 9999999999,
        "amount": "875.00",
        "kind": "sale",
        "gateway": "Cash on Delivery (COD)",
        "status": "pending",
        "message": "Pending the Cash on Delivery (COD) payment from the buyer",
        "created_at": "2017-09-28T16:34:41+04:00",
        "test": false,
        "authorization": null,
        "currency": "AED",
        "location_id": null,
        "user_id": null,
        "parent_id": null,
        "device_id": null,
        "receipt": {},
        "error_code": null,
        "source_name": "web"
    }, {
        "id": 89999999999,
        "order_id": 9999999999,
        "amount": "875.00",
        "kind": "sale",
        "gateway": "Cash on Delivery (COD)",
        "status": "success",
        "message": "Marked the Cash on Delivery (COD) payment as received",
        "created_at": "2017-10-02T19:13:35+04:00",
        "test": false,
        "authorization": null,
        "currency": "AED",
        "location_id": null,
        "user_id": null,
        "parent_id": 777777777,
        "device_id": null,
        "receipt": {},
        "error_code": null,
        "source_name": "web"
    }]
}