export async function charge(order) { const total = sum(order.items); if (total <= 0) return null; const paid = await pay(total, order.currency); // keep the receipt with the order await save(order.id, paid.id); return paid; }