{"_id":"5632a5e849e16d0d0012247b","githubsync":"","project":"55b933b3146ef121002158d3","category":{"_id":"5632a5e749e16d0d00122448","version":"5632a5e549e16d0d00122443","__v":1,"pages":["5632a5e849e16d0d00122478","5632a5e849e16d0d00122479","5632a5e849e16d0d0012247a","5632a5e849e16d0d0012247b","5632a5e849e16d0d0012247c"],"project":"55b933b3146ef121002158d3","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-03T18:10:18.431Z","from_sync":false,"order":6,"slug":"credit-card-batches","title":"Credit Card Batches"},"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"},"__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-03T18:11:25.532Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"Close a batch specified by BatchRefNum.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Description\"\n}\n[/block]\nThis method will close or settle an open batch. Upon settlement the funds will be transferred to the merchant's bank account.\nTo check the status of a batch and determine whether it has already been settled, is still open, or awaiting settlement, use the [getBatchStatus](/docs/getbatchstatus) method.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Arguments\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Type\",\n    \"h-1\": \"Name\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"[ueSecurityToken](/docs/uesecuritytoken)\",\n    \"0-1\": \"Token\",\n    \"0-2\": \"Merchant security token: used to identify merchant and validate transaction.\",\n    \"1-0\": \"integer\",\n    \"1-1\": \"BatchRefNum\",\n    \"1-2\": \"A unique batch reference number assigned by the gateway.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Return Value\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"boolean\",\n    \"0-1\": \"Returns confirmation of the close batch request only if successful. If request fails, an exception will be thrown.\"\n  },\n  \"cols\": 2,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Examples\"\n}\n[/block]\n## PHP \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\ntry {\\n // To close a specific batch use the gateway assigned batchrefnum:\\n $batchrefnum='1234567';\\n // To close the current batch use '0':\\n $batchrefnum='0';\\n $res=$tran->closeBatch($sourcekey,$batchrefnum);\\n}\\ncatch(SoapFault $e) {\\n echo $e->getMessage();\\n echo \\\"\\\\n\\\\nRequest: \\\" . $tran->__getLastRequest();\\n echo \\\"\\\\n\\\\nResponse: \\\" . $tran->__getLastResponse();\\n}\\n?>\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n## Visual Basic (.Net) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Try\\n           client.closeBatch(token, \\\"0\\\")\\n           MsgBox(\\\"Your batch has closed.\\\")\\n       Catch ex As Exception\\n           MsgBox(ex.Message)\\n       End Try\",\n      \"language\": \"c\"\n    }\n  ]\n}\n[/block]\n## C Sharp (.Net)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Boolean result;\\n// close current batch\\ntry\\n{\\n   result = client.closeBatch(token, \\\"0\\\");\\n   if (result) MessageBox.Show(\\\"Batch closed successfully\\\");\\n   else MessageBox.Show(\\\"Batch failed to close\\\");\\n}\\ncatch (Exception err)\\n{\\n   MessageBox.Show(err.Message);\\n}\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n## XML \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\\\"http://schemas.xmlsoap.org/soap/envelope/\\\"\\nxmlns:ns1=\\\"urn:eBizCharge\\\" xmlns:xsd=\\\"http://www.w3.org/2001/XMLSchema\\\"\\nxmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\"\\nxmlns:SOAP-ENC=\\\"http://schemas.xmlsoap.org/soap/encoding/\\\"\\nSOAP-ENV:encodingStyle=\\\"http://schemas.xmlsoap.org/soap/encoding/\\\">\\n<SOAP-ENV:Body>\\n<ns1:closeBatch>\\n<Token xsi:type=\\\"ns1:ueSecurityToken\\\">\\n<ClientIP xsi:type=\\\"xsd:string\\\">192.168.0.1</ClientIP>\\n<PinHash xsi:type=\\\"ns1:ueHash\\\">\\n<HashValue xsi:type=\\\"xsd:string\\\">11ac55b0a0b59f8f028dbf85bc32266fa973dd0e</HashValue>\\n<Seed xsi:type=\\\"xsd:string\\\">12678150211876663375</Seed>\\n<Type xsi:type=\\\"xsd:string\\\">sha1</Type>\\n</PinHash>\\n<SourceKey xsi:type=\\\"xsd:string\\\">HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>\\n</Token>\\n<BatchRefNum xsi:type=\\\"xsd:integer\\\">0</BatchRefNum>\\n</ns1:closeBatch>\\n</SOAP-ENV:Body>\\n</SOAP-ENV:Envelope>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n## Java \n\nThis example uses the eBizCharge Java library. For directions on how to install the library and create the token/client objects, go to either the Java JAX-RPC Howto or the Java JAX-WS Howto.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"try {\\n//Creating Close Batch Request object\\nCloseBatchRequest Request = new CloseBatchRequest();\\nRequest.setToken(token);\\n//Setting batchRefNum to 0 for current batch, for a different batch set to the Batch Ref Num\\nRequest.setBatchRefNum(BigInteger.ZERO);\\nCloseBatchResponse Result = client.closeBatch(Request);\\n} catch (Exception e) {\\n       System.out.println(\\\"Soap Exception: \\\" + e.getMessage());\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"closebatch","type":"basic","title":"closeBatch"}
Close a batch specified by BatchRefNum. [block:api-header] { "type": "basic", "title": "Description" } [/block] This method will close or settle an open batch. Upon settlement the funds will be transferred to the merchant's bank account. To check the status of a batch and determine whether it has already been settled, is still open, or awaiting settlement, use the [getBatchStatus](/docs/getbatchstatus) method. [block:api-header] { "type": "basic", "title": "Arguments" } [/block] [block:parameters] { "data": { "h-0": "Type", "h-1": "Name", "h-2": "Description", "0-0": "[ueSecurityToken](/docs/uesecuritytoken)", "0-1": "Token", "0-2": "Merchant security token: used to identify merchant and validate transaction.", "1-0": "integer", "1-1": "BatchRefNum", "1-2": "A unique batch reference number assigned by the gateway." }, "cols": 3, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Return Value" } [/block] [block:parameters] { "data": { "0-0": "boolean", "0-1": "Returns confirmation of the close batch request only if successful. If request fails, an exception will be thrown." }, "cols": 2, "rows": 1 } [/block] [block:api-header] { "type": "basic", "title": "Examples" } [/block] ## PHP [block:code] { "codes": [ { "code": "<?php\ntry {\n // To close a specific batch use the gateway assigned batchrefnum:\n $batchrefnum='1234567';\n // To close the current batch use '0':\n $batchrefnum='0';\n $res=$tran->closeBatch($sourcekey,$batchrefnum);\n}\ncatch(SoapFault $e) {\n echo $e->getMessage();\n echo \"\\n\\nRequest: \" . $tran->__getLastRequest();\n echo \"\\n\\nResponse: \" . $tran->__getLastResponse();\n}\n?>", "language": "php" } ] } [/block] ## Visual Basic (.Net) [block:code] { "codes": [ { "code": "Try\n client.closeBatch(token, \"0\")\n MsgBox(\"Your batch has closed.\")\n Catch ex As Exception\n MsgBox(ex.Message)\n End Try", "language": "c" } ] } [/block] ## C Sharp (.Net) [block:code] { "codes": [ { "code": "Boolean result;\n// close current batch\ntry\n{\n result = client.closeBatch(token, \"0\");\n if (result) MessageBox.Show(\"Batch closed successfully\");\n else MessageBox.Show(\"Batch failed to close\");\n}\ncatch (Exception err)\n{\n MessageBox.Show(err.Message);\n}", "language": "csharp" } ] } [/block] ## XML [block:code] { "codes": [ { "code": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\nxmlns:ns1=\"urn:eBizCharge\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"\nSOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n<SOAP-ENV:Body>\n<ns1:closeBatch>\n<Token xsi:type=\"ns1:ueSecurityToken\">\n<ClientIP xsi:type=\"xsd:string\">192.168.0.1</ClientIP>\n<PinHash xsi:type=\"ns1:ueHash\">\n<HashValue xsi:type=\"xsd:string\">11ac55b0a0b59f8f028dbf85bc32266fa973dd0e</HashValue>\n<Seed xsi:type=\"xsd:string\">12678150211876663375</Seed>\n<Type xsi:type=\"xsd:string\">sha1</Type>\n</PinHash>\n<SourceKey xsi:type=\"xsd:string\">HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>\n</Token>\n<BatchRefNum xsi:type=\"xsd:integer\">0</BatchRefNum>\n</ns1:closeBatch>\n</SOAP-ENV:Body>\n</SOAP-ENV:Envelope>", "language": "xml" } ] } [/block] ## Java This example uses the eBizCharge Java library. For directions on how to install the library and create the token/client objects, go to either the Java JAX-RPC Howto or the Java JAX-WS Howto. [block:code] { "codes": [ { "code": "try {\n//Creating Close Batch Request object\nCloseBatchRequest Request = new CloseBatchRequest();\nRequest.setToken(token);\n//Setting batchRefNum to 0 for current batch, for a different batch set to the Batch Ref Num\nRequest.setBatchRefNum(BigInteger.ZERO);\nCloseBatchResponse Result = client.closeBatch(Request);\n} catch (Exception e) {\n System.out.println(\"Soap Exception: \" + e.getMessage());\n}", "language": "java" } ] } [/block]