Mistok
Documentation

Prepayment, rules, failover

Quick start newArchitectureGatewaysHTTP APIPrepayment and rulesFiscal receiptsNotifications and CRMPayment linksAnalytics newPolandNative Shopify gatewaySecurity new

Payment method map

The name of the manual payment method in Shopify (case-insensitive) determines the gateway and the prepayment rule:

GATEWAY_MAP={
  "plata by mono": {"provider":"mono"},
  "покупка частинами mono": {"provider":"monoparts"},
  "оплата частинами приватбанк": {"provider":"privatparts"},
  "przelewy24": {"provider":"p24"}, "payu": {"provider":"payu"}, "stripe": {"provider":"stripe"},
  "накладений платіж + передоплата 200 грн": {"provider":"mono","prepay":20000},
  "накладений платіж + 30 %": {"provider":"mono","prepayPercent":30}
}

The prepayment is recorded in Shopify as a partial payment named “plata by mono (передоплата)” (“prepayment”); the order becomes Partially paid, and the buyer pays the rest on delivery.

Prepayment rules

PREPAY_RULES is an array of rules; the strictest one applies. Conditions: minTotal/maxTotal (kopiykas), firstOrder, country, customerTag, phoneMode, onlyCod.

PREPAY_RULES=[
  {"when":{"minTotal":500000,"onlyCod":true},"prepayPercent":50,"note":"COD over 5000 UAH"},
  {"when":{"firstOrder":true,"country":"PL"},"prepayPercent":100,"note":"first order from Poland"},
  {"when":{"customerTag":"vip"},"prepayPercent":0,"note":"no prepayment"}
]

Phone rules

A phone number that refused a parcel is added with the Telegram command /cod_off 380501234567 reason or in the admin. Modes: prepay — full prepayment only; block — the same plus a tag; trusted — rules are not applied. Pure cash-on-delivery orders from such a number get the cod-risk tag and an alert — you call the buyer before dispatch.

Failover

PROVIDER_FALLBACK={"mono":"liqpay","p24":"payu"}

If the primary gateway’s API responds with a 5xx or is unreachable, the invoice is created in the backup gateway with the same amount; the buyer does not notice, and you get an alert.

Hold

PAYMENT_TYPE=hold — authorisation without capture; capture on orders/fulfilled (mono, LiqPay, WayForPay, NovaPay, PayU, Stripe). For mono installments the store’s confirmation happens immediately or on fulfilment (MONOPARTS_CONFIRM).