Edit this page Backlinks Share on ... Google+ Twitter LinkedIn Facebook Pinterest Telegram Table of Contents Generate a random payment ID sample codes PHP Groovy Generate a random payment ID sample codes PHP <?php $payment_id = bin2hex(random_bytes(32)); echo($payment_id); ?> Groovy private static String generatePaymentId() { def r = new Random() def result = (0..<64).collect { r.nextInt(16) } .collect { Integer.toString(it, 16) } .join() return result }