Generate unique ID in hook_redirect_form I'm trying to write custom payment method for a custom bank gateway (off-site method). bank service expect me to send unique ID for each pay request per bpPayRequest() call.

currently I sending $order-&gt;order_id, but its wrong because: if first request fails this orderId is not unique for second bpPayRequest() call. so I should create unique ID which is related to $orders. Is there any commerce way for this question?

$parameters = array(
  ...
  'orderId' =&gt; $order-&gt;order_id,
  ...
);
$result = $client-&gt;call('bpPayRequest', $parameters, $namespace);
$unique_id = $order-&gt;order_id . '-' . microtime();


The advantage of this is you can explode on the - later and get the order id back again.