We use _ZapietID to generate rates for a checkout method. To use the rates feature in custom implementations of Zapiet - Pickup + Delivery, you will need to get a valid _ZapietId.
Getting the _ZapietId
Note
This code will work only on versions 7.0.4 and above.
function encodeZapietId(params) { const ret = []; for (let d in params) { if (params[d]) { ret.push(d + '=' + params[d]); } } return ret.join('&'); }function getZapietId(params) { var fomatted_date = ''; if (params.date && !params.time) { var fomatted_date = params.date.replace(/\//g, "-"); fomatted_date = fomatted_date + 'T00:00:00Z'; } else if (params.date && params.start_time) { var fomatted_date = params.date.replace(/\//g, "-"); fomatted_date = fomatted_date + 'T' + params.start_time + ':00Z'; } return this.encodeZapietId({ M: this.getMethodKey(params.method), L: (params.location_id) ? params.location_id : "", D: fomatted_date, P: "" }); }function getMethodKey(method) { if (method == 'delivery') { return 'D'; } else if (method == 'pickup') { return 'P'; } else { return 'S'; } }