{"_id":"5632a5ec49e16d0d001224c1","project":"55b933b3146ef121002158d3","__v":0,"githubsync":"","category":{"_id":"5632a5e749e16d0d00122444","pages":["5632a5ec49e16d0d001224bd","5632a5ec49e16d0d001224be","5632a5ec49e16d0d001224bf","5632a5ec49e16d0d001224c0","5632a5ec49e16d0d001224c1","5632a5ec49e16d0d001224c2","5632a5ec49e16d0d001224c3","5632a5ec49e16d0d001224c4","5632a5ec49e16d0d001224c5","5632a5ec49e16d0d001224c6","5632a5ec49e16d0d001224c7","5632a5ec49e16d0d001224c8","5632a5ec49e16d0d001224c9","5632a5ec49e16d0d001224ca","5632a5ec49e16d0d001224cb","5633bab59c607719001b86a1","5633bcbac49a7c19001fd0a6","5633befcc49a7c19001fd0a9","5633c585b904a10d0032f864","5633d7547b56ae0d0025a062","5633d7e87b56ae0d0025a066","5633d85435355017003ca3c8","5633da507e9e880d00af1a28","5633daa3fa71f30d00ba74ab","5633e1f87e9e880d00af1a3f","5633e323fa71f30d00ba74b9","5633e3aa7b56ae0d0025a072","5633e4c6737ea01700ea3276"],"project":"55b933b3146ef121002158d3","version":"5632a5e549e16d0d00122443","__v":14,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-31T23:12:47.262Z","from_sync":false,"order":0,"slug":"epayment-form","title":"ePayment Form"},"user":"55b932ba8fd1a02b00f496c8","version":{"_id":"5632a5e549e16d0d00122443","__v":6,"project":"55b933b3146ef121002158d3","createdAt":"2015-10-29T23:04:05.701Z","releaseDate":"2015-10-29T23:04:05.701Z","categories":["5632a5e749e16d0d00122444","5632a5e749e16d0d00122445","5632a5e749e16d0d00122446","5632a5e749e16d0d00122447","5632a5e749e16d0d00122448","5632a5e749e16d0d00122449","5632a5e749e16d0d0012244a","5632a5e749e16d0d0012244b","5632a5e749e16d0d0012244c","5632a5e749e16d0d0012244d","5632a5e749e16d0d0012244e","5632a5e749e16d0d0012244f","5632a5e749e16d0d00122450","5632b179df556c0d00cd095b","564e13053b2b4a19000cd69b","59caa9df65accc001a489c95","59cab50965accc001a489d28","59cadd464ab7b70024378e74"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-03T18:34:02.405Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"##  Generating a unique invoice number with Javascript \n\n## On your web page \n\nYou can generate a unique invoice number for each transaction by adding a small script above the code you use to link to the payment form. It's not visible to your client. Providing an invoice number with every transaction may also give you a better qualifying transaction rate - ask your merchant service provider for information about transaction rates and fees.\nSource Code\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<form action=\\\"https://www.ebizcharge.com/interface/epayform/\\\" name=\\\"form\\\">  \\n<input type=\\\"hidden\\\" name=\\\"UMkey\\\" value=\\\"SOURCE_KEY_GOES_HERE\\\">  \\n<input type=\\\"hidden\\\" name=\\\"UMcommand\\\" value=\\\"sale\\\">  \\n<input type=\\\"hidden\\\" name=\\\"UMamount\\\" value=\\\"10.99\\\">  \\n<input type=\\\"hidden\\\" name=\\\"UMinvoice\\\" value=\\\"\\\">     \\n<input type=\\\"hidden\\\" name=\\\"UMdescription\\\" value=\\\"Thank you for your payment\\\">  \\n<input type=\\\"submit\\\" value=\\\"Continue to Payment Form\\\">  \\n</form>\\n\\n<script language=\\\"JavaScript\\\">\\nvar d = new Date();\\nfunction f(n) {        return n < 10 ? '0' + n : n; }        \\nvar random_num = Math.floor(Math.random() * (99999999999 -  10000000000)) + 10000000000;\\nrandom_num = d.getFullYear() + f(d.getMonth()+1) + f(d.getDate()) + random_num; \\ndocument.form.UMinvoice.value = random_num;\\n</script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\n**Where it goes**\nThis code would go on your site, not on the actual payment form itself. This will generate a value that appears on your form with any other data you've posted to it.\n\n**What it looks like**\nThe Order Number is the resulting unique invoice number for your transaction.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Y6XLKbHS96wra0ERbwej_random_invoice2.png\",\n        \"random_invoice2.png\",\n        \"415\",\n        \"161\",\n        \"#619bca\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n## On the payment form \n\nIn the header of the document, add the following code:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script>\\nfunction addInvoice() {\\nvar d = new Date();\\nfunction f(n) {        return n < 10 ? '0' + n : n; }        \\nvar random_num = Math.floor(Math.random() * (99999999999 -  10000000000)) + 10000000000;\\ndocument.epayform.UMinvoice.value = random_num;\\ndocument.getElementById('invoice').innerHTML = random_num ;\\n}\\n</script>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nLocate the below command in the list of hidden values, and delete it:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<input type=\\\"hidden\\\" name=\\\"UMinvoice\\\" value=\\\"[UMinvoice]\\\">\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nFind the following code in your form:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"  <tr>\\n     <td bgcolor=\\\"#F0F0F0\\\" width=\\\"234\\\" align=\\\"right\\\"><font size=\\\"2\\\" face=\\\"Verdana\\\">Order Amount:</font></td>\\n     <td bgcolor=\\\"#F0F0F0\\\" width=\\\"450\\\">[UMamount]\\n     </td>\\n     </tr>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nAnd replace it with this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<tr>\\n                       <td bgcolor=\\\"#F0F0F0\\\" width=\\\"234\\\" align=\\\"right\\\"><font face=\\\"Verdana\\\" size=\\\"2\\\">Order Amount:\\n                       </font></td>\\n                       <td bgcolor=\\\"#F0F0F0\\\" width=\\\"450\\\">\\n                       <input type=\\\"text\\\" name=\\\"UMamount\\\" onClick=\\\"addInvoice()\\\" size=\\\"25\\\" value=\\\"[UMamount]\\\"></td>\\n               </tr>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nFind the following code in your form:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"   <tr>\\n     <td bgcolor=\\\"#F0F0F0\\\" width=\\\"234\\\" align=\\\"right\\\"><font size=\\\"2\\\" face=\\\"Verdana\\\">Order Number:</font></td>\\n     <td bgcolor=\\\"#F0F0F0\\\" width=\\\"450\\\">[UMinvoice]\\n     </td>\\n     </tr>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nand replace with the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<tr>\\n                       <td bgcolor=\\\"#F0F0F0\\\" width=\\\"234\\\" align=\\\"right\\\"><font size=\\\"2\\\" face=\\\"Verdana\\\">Order Number:</font></td>\\n                       <td bgcolor=\\\"#F0F0F0\\\" width=\\\"450\\\"><input type=\\\"hidden\\\" name=\\\"UMinvoice\\\"><div id=\\\"invoice\\\"></div></td>\\n               </tr>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nSave the changes to your form. Once the form is saved, the customer will be able to type in the amount they are paying and automatically have an invoice number.\n\n**What it looks like**\nThe Order Number is the resulting unique invoice number for your transaction.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/HE6RkDsjQEeZorP8zCW0_random_invoice3.png\",\n        \"random_invoice3.png\",\n        \"444\",\n        \"226\",\n        \"#5195cd\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"invoice-number","type":"basic","title":"Invoice Number"}
## Generating a unique invoice number with Javascript ## On your web page You can generate a unique invoice number for each transaction by adding a small script above the code you use to link to the payment form. It's not visible to your client. Providing an invoice number with every transaction may also give you a better qualifying transaction rate - ask your merchant service provider for information about transaction rates and fees. Source Code [block:code] { "codes": [ { "code": "<form action=\"https://www.ebizcharge.com/interface/epayform/\" name=\"form\"> \n<input type=\"hidden\" name=\"UMkey\" value=\"SOURCE_KEY_GOES_HERE\"> \n<input type=\"hidden\" name=\"UMcommand\" value=\"sale\"> \n<input type=\"hidden\" name=\"UMamount\" value=\"10.99\"> \n<input type=\"hidden\" name=\"UMinvoice\" value=\"\"> \n<input type=\"hidden\" name=\"UMdescription\" value=\"Thank you for your payment\"> \n<input type=\"submit\" value=\"Continue to Payment Form\"> \n</form>\n\n<script language=\"JavaScript\">\nvar d = new Date();\nfunction f(n) { return n < 10 ? '0' + n : n; } \nvar random_num = Math.floor(Math.random() * (99999999999 - 10000000000)) + 10000000000;\nrandom_num = d.getFullYear() + f(d.getMonth()+1) + f(d.getDate()) + random_num; \ndocument.form.UMinvoice.value = random_num;\n</script>", "language": "html" } ] } [/block] **Where it goes** This code would go on your site, not on the actual payment form itself. This will generate a value that appears on your form with any other data you've posted to it. **What it looks like** The Order Number is the resulting unique invoice number for your transaction. [block:image] { "images": [ { "image": [ "https://files.readme.io/Y6XLKbHS96wra0ERbwej_random_invoice2.png", "random_invoice2.png", "415", "161", "#619bca", "" ] } ] } [/block] ## On the payment form In the header of the document, add the following code: [block:code] { "codes": [ { "code": "<script>\nfunction addInvoice() {\nvar d = new Date();\nfunction f(n) { return n < 10 ? '0' + n : n; } \nvar random_num = Math.floor(Math.random() * (99999999999 - 10000000000)) + 10000000000;\ndocument.epayform.UMinvoice.value = random_num;\ndocument.getElementById('invoice').innerHTML = random_num ;\n}\n</script>", "language": "javascript" } ] } [/block] Locate the below command in the list of hidden values, and delete it: [block:code] { "codes": [ { "code": "<input type=\"hidden\" name=\"UMinvoice\" value=\"[UMinvoice]\">", "language": "html" } ] } [/block] Find the following code in your form: [block:code] { "codes": [ { "code": " <tr>\n <td bgcolor=\"#F0F0F0\" width=\"234\" align=\"right\"><font size=\"2\" face=\"Verdana\">Order Amount:</font></td>\n <td bgcolor=\"#F0F0F0\" width=\"450\">[UMamount]\n </td>\n </tr>", "language": "html" } ] } [/block] And replace it with this: [block:code] { "codes": [ { "code": "<tr>\n <td bgcolor=\"#F0F0F0\" width=\"234\" align=\"right\"><font face=\"Verdana\" size=\"2\">Order Amount:\n </font></td>\n <td bgcolor=\"#F0F0F0\" width=\"450\">\n <input type=\"text\" name=\"UMamount\" onClick=\"addInvoice()\" size=\"25\" value=\"[UMamount]\"></td>\n </tr>", "language": "html" } ] } [/block] Find the following code in your form: [block:code] { "codes": [ { "code": " <tr>\n <td bgcolor=\"#F0F0F0\" width=\"234\" align=\"right\"><font size=\"2\" face=\"Verdana\">Order Number:</font></td>\n <td bgcolor=\"#F0F0F0\" width=\"450\">[UMinvoice]\n </td>\n </tr>", "language": "html" } ] } [/block] and replace with the following: [block:code] { "codes": [ { "code": "<tr>\n <td bgcolor=\"#F0F0F0\" width=\"234\" align=\"right\"><font size=\"2\" face=\"Verdana\">Order Number:</font></td>\n <td bgcolor=\"#F0F0F0\" width=\"450\"><input type=\"hidden\" name=\"UMinvoice\"><div id=\"invoice\"></div></td>\n </tr>", "language": "html" } ] } [/block] Save the changes to your form. Once the form is saved, the customer will be able to type in the amount they are paying and automatically have an invoice number. **What it looks like** The Order Number is the resulting unique invoice number for your transaction. [block:image] { "images": [ { "image": [ "https://files.readme.io/HE6RkDsjQEeZorP8zCW0_random_invoice3.png", "random_invoice3.png", "444", "226", "#5195cd", "" ] } ] } [/block]