{"_id":"56cd591224f28913009575c4","version":{"_id":"56cacb1cc675f50b00a4b61c","project":"56cacb1bc675f50b00a4b619","__v":14,"createdAt":"2016-02-22T08:47:24.528Z","releaseDate":"2016-02-22T08:47:24.528Z","categories":["56cacb1dc675f50b00a4b61d","56cc10aaca43550b0028125a","56cc10b7b4cbcf0b004a5df9","56cc1bb2272aa4130002ccd2","56cc5834b4cbcf0b004a5f8b","56cda18bface161300dae13b","56d51f2873dcd20b00fb87bb","56fbe0610023171700b96105","57658310c176520e00ea9076","5772bdd48c48e00e00503638","577c1dfe87acf617003c3fcd","579525172979790e00771a15","582b4661cdfdc125000c8684","586365cedfe6cc3700a7be63"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"parentDoc":null,"project":"56cacb1bc675f50b00a4b619","user":"56caca84245b841300806def","__v":26,"category":{"_id":"56cc10b7b4cbcf0b004a5df9","project":"56cacb1bc675f50b00a4b619","__v":5,"pages":["56cd503649abf10b0036a1f0","56cd585aa2a95b0b00c6ec0b","56cd591224f28913009575c4","56cd772dd98d851d00c0c447","56d5267b1c4de4130005d804"],"version":"56cacb1cc675f50b00a4b61c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-02-23T07:56:39.448Z","from_sync":false,"order":2,"slug":"sdk","title":"PHP SDK"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-24T07:17:38.299Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"Wallet service, like a literal wallet, keeps track of the credits / debits / balance. It is a raw service which can be used directly or in combination with other services like Loyalty Service\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Usage\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"require\\\": {\\n    \\\"codemojo/startkit\\\": \\\"0.1.*\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Composer plugin\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(AuthenticationService authenticationService)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\n  use CodeMojo\\\\Client\\\\Endpoints;\\n  use CodeMojo\\\\Client\\\\Exceptions\\\\Exceptions;\\n  use CodeMojo\\\\Client\\\\Services\\\\AuthenticationService;\\n\\tuse CodeMojo\\\\Client\\\\Services\\\\WalletService;\\n\\n\\n  const CLIENT_ID     = 'YOUR_CLIENT_ID';\\n  const CLIENT_SECRET = 'YOUR_CLIENT_SECRET';\\n\\n  $authService = new AuthenticationService(CLIENT_ID, CLIENT_SECRET, Endpoints::ENV_SANDBOX, function($type){\\n      // Handle the exceptions appropriately\\n  });\\n\\n\\t$walletService = new WalletService($authService);\\n\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"addBalance\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String user_id, float value_to_add, int transaction_type, int expires_in_days, String transaction_id, String meta_data, String tag, Boolean frozen)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n**Returns** Boolean **Throws** Exception, InvalidArgumentException, QuotaExceededException\n\nAdd balance to a particular user's wallet\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"user_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"User ID to which the balance has to be added\",\n    \"1-0\": \"value_to_add\",\n    \"1-1\": \"Float\",\n    \"1-2\": \"Value/Points to be added to the user's wallet\",\n    \"3-0\": \"expires_in_days\",\n    \"3-1\": \"Integer\",\n    \"3-2\": \"How many days is the new credit valid\",\n    \"4-0\": \"transaction_id\",\n    \"4-1\": \"String\",\n    \"4-2\": \"Any transaction id for your internal reference. This could be a order id or so\",\n    \"5-0\": \"meta_data\",\n    \"6-0\": \"tag\",\n    \"7-0\": \"frozen\",\n    \"5-1\": \"String\",\n    \"6-1\": \"String\",\n    \"7-1\": \"Boolean\",\n    \"5-2\": \"Any meta data to associate with this transaction\",\n    \"6-2\": \"Similar to meta data. Additional field for associating extra information\",\n    \"7-2\": \"Whether the credit should be immediately reflected or should it be kept on hold till some future point. This is usually associated with the transaction_id. For example, you may want to provide cashback for a particular order but want to wait till it has been delivered. You can use the order id as the transaction id in this case and unfreeze the transaction once the delivery has been confirmed\",\n    \"2-0\": \"transaction_type\",\n    \"2-1\": \"int\",\n    \"2-2\": \"Type of credit in this transaction. By default `1` is transactional, `2` is loyalty promotional and `3` is gamification promotional\"\n  },\n  \"cols\": 3,\n  \"rows\": 8\n}\n[/block]\n**Transaction types** \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Type\",\n    \"h-1\": \"Meaning\",\n    \"0-0\": \"-1\",\n    \"0-1\": \"All Credits\",\n    \"2-0\": \"1\",\n    \"2-1\": \"Loyalty Credits\",\n    \"1-0\": \"0\",\n    \"1-1\": \"Transactional\",\n    \"3-0\": \"2\",\n    \"3-1\": \"Gamification Credits\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"addFrozenBalance\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String user_id, float value_to_add, int transaction_value, int expires_in_days, String transaction_id, String meta_data, String tag)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n**Returns** Boolean **Throws** Exception, InvalidArgumentException\n\nThis is similar to addBalance with the frozen parameter set to true\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"deductBalance\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String user_id, float value_to_remove, int transaction_type, String transaction_id, String meta_data, String tag)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n**Returns** Boolean **Throws** BalanceExhaustedException, Exception, InvalidArgumentException\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Error handling required\",\n  \"body\": \"This method throws a BalanceExhaustedException. Please be sure to handle the error appropriately\"\n}\n[/block]\nDebit balance from user's wallet\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"user_id\",\n    \"0-1\": \"String\",\n    \"1-0\": \"value_to_remove\",\n    \"1-1\": \"Float\",\n    \"3-0\": \"transaction_id\",\n    \"3-1\": \"String\",\n    \"4-0\": \"meta_data\",\n    \"4-1\": \"String\",\n    \"5-0\": \"tag\",\n    \"5-1\": \"String\",\n    \"0-2\": \"User ID to which the balance has to be added\",\n    \"1-2\": \"Value/Points to be added to the user's wallet\",\n    \"3-2\": \"Any transaction id for your internal reference. This could be a order id or so..\",\n    \"4-2\": \"Any meta data to associate with this transaction\",\n    \"5-2\": \"Similar to meta data. Additional field for associating extra information\",\n    \"2-0\": \"transaction_type\",\n    \"2-1\": \"int\",\n    \"2-2\": \"Type of credit in this transaction. Default value is -1 which is both promotional & transactional. `2`, `3` are promotional and `1` is transactional\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"getBalance\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String user_id, int transaction_type)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n**Returns** Array Object **Throws** Exception, InvalidArgumentException\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"user_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"User ID to which the balance has to be calculated\",\n    \"1-0\": \"transaction_type\",\n    \"1-1\": \"int\",\n    \"1-2\": \"Balance for particular transaction type. `-1` gives the full balance\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nGet the balance credits available from a user's wallet in the below format\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[code] => 200\\n[total] => total_balance\\n[slot1] => [\\n \\t\\t\\t\\t\\t\\t [raw] => raw_balance,\\n\\t\\t\\t\\t\\t  [conversion] => conversion_funnel_applied_balance\\n\\t\\t\\t\\t\\t ]\\n[slot2] => [\\n \\t\\t\\t\\t\\t\\t [raw] => raw_balance,\\n\\t\\t\\t\\t\\t  [conversion] => conversion_funnel_applied_balance\\n\\t\\t\\t\\t\\t ]\\n[slot3] => [\\n \\t\\t\\t\\t\\t\\t [raw] => raw_balance,\\n\\t\\t\\t\\t\\t  [conversion] => conversion_funnel_applied_balance\\n\\t\\t\\t\\t\\t ]\",\n      \"language\": \"json\",\n      \"name\": \"Array Object\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"cancelTransaction\"\n}\n[/block]\nCancel / undo the transaction\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String transaction_id)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"transaction_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Transaction ID of the transaction to be cancelled\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"refund\"\n}\n[/block]\nRefund the complete or the remaining balance of the transaction\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String transaction_id)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"transaction_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Transaction ID of the transaction to be refunded\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"refundPartial\"\n}\n[/block]\nRefund a partial amount of the transaction\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String transaction_id, float refund_value)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"transaction_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Transaction ID of the transaction to be refunded\",\n    \"1-0\": \"refund_value\",\n    \"1-1\": \"float\",\n    \"1-2\": \"Value to be refunded\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"unFreezeTransaction\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String transaction_id)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n**Returns** Boolean **Throws** Exception, InvalidArgumentException\n\nUnfreeze a frozen transaction\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"transaction_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Transaction id associated with the frozen order. This could be a order id or so..\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"getTransactionDetail\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String transaction_id)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n**Returns** Array **Throws** Exception, InvalidArgumentException\n\n Get the transaction detail for a particular transaction id\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"transaction_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Transaction id associated with the transaction\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"getAllTransactions\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(int count)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n**Returns** PaginatedResults **Throws** Exception, InvalidArgumentException\n\nGet the balance credits available from a user's wallet\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"count\",\n    \"0-1\": \"Integer\",\n    \"0-2\": \"Number of results per page\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  'customer_id' => sample:::at:::codemojo.io\\n  'value' => 50\\n  'expiry' => null\\n  'meta' => Cashback \\n  'tag' => Loyalty points credited\\n  'timestamp' => 2016-01-22 05:49:42\\n  'id' => loyalty_3_1453441781\\n  'frozen' => 0\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Paginated Result\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"getTransactionDetailsForUser\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"(String user_id, int count)\",\n      \"language\": \"java\",\n      \"name\": \"Signature\"\n    }\n  ]\n}\n[/block]\n**Returns** PaginatedResults **Throws** Exception, InvalidArgumentException\n\nGet the transaction history for a user\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"user_id\",\n    \"0-1\": \"String\",\n    \"0-2\": \"User ID to which the balance has to be added\",\n    \"1-0\": \"count\",\n    \"1-1\": \"Integer\",\n    \"1-2\": \"Number of results per page\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]","excerpt":"","slug":"wallet-service","type":"basic","title":"Wallet Service"}

Wallet Service


Wallet service, like a literal wallet, keeps track of the credits / debits / balance. It is a raw service which can be used directly or in combination with other services like Loyalty Service [block:api-header] { "type": "basic", "title": "Usage" } [/block] [block:code] { "codes": [ { "code": "{\n \"require\": {\n \"codemojo/startkit\": \"0.1.*\"\n }\n}", "language": "json", "name": "Composer plugin" } ] } [/block] [block:code] { "codes": [ { "code": "(AuthenticationService authenticationService)", "language": "java", "name": "Signature" } ] } [/block] [block:code] { "codes": [ { "code": "<?php\n\n use CodeMojo\\Client\\Endpoints;\n use CodeMojo\\Client\\Exceptions\\Exceptions;\n use CodeMojo\\Client\\Services\\AuthenticationService;\n\tuse CodeMojo\\Client\\Services\\WalletService;\n\n\n const CLIENT_ID = 'YOUR_CLIENT_ID';\n const CLIENT_SECRET = 'YOUR_CLIENT_SECRET';\n\n $authService = new AuthenticationService(CLIENT_ID, CLIENT_SECRET, Endpoints::ENV_SANDBOX, function($type){\n // Handle the exceptions appropriately\n });\n\n\t$walletService = new WalletService($authService);\n", "language": "php" } ] } [/block] [block:api-header] { "type": "fn", "title": "addBalance" } [/block] [block:code] { "codes": [ { "code": "(String user_id, float value_to_add, int transaction_type, int expires_in_days, String transaction_id, String meta_data, String tag, Boolean frozen)", "language": "java", "name": "Signature" } ] } [/block] **Returns** Boolean **Throws** Exception, InvalidArgumentException, QuotaExceededException Add balance to a particular user's wallet [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "user_id", "0-1": "String", "0-2": "User ID to which the balance has to be added", "1-0": "value_to_add", "1-1": "Float", "1-2": "Value/Points to be added to the user's wallet", "3-0": "expires_in_days", "3-1": "Integer", "3-2": "How many days is the new credit valid", "4-0": "transaction_id", "4-1": "String", "4-2": "Any transaction id for your internal reference. This could be a order id or so", "5-0": "meta_data", "6-0": "tag", "7-0": "frozen", "5-1": "String", "6-1": "String", "7-1": "Boolean", "5-2": "Any meta data to associate with this transaction", "6-2": "Similar to meta data. Additional field for associating extra information", "7-2": "Whether the credit should be immediately reflected or should it be kept on hold till some future point. This is usually associated with the transaction_id. For example, you may want to provide cashback for a particular order but want to wait till it has been delivered. You can use the order id as the transaction id in this case and unfreeze the transaction once the delivery has been confirmed", "2-0": "transaction_type", "2-1": "int", "2-2": "Type of credit in this transaction. By default `1` is transactional, `2` is loyalty promotional and `3` is gamification promotional" }, "cols": 3, "rows": 8 } [/block] **Transaction types** [block:parameters] { "data": { "h-0": "Type", "h-1": "Meaning", "0-0": "-1", "0-1": "All Credits", "2-0": "1", "2-1": "Loyalty Credits", "1-0": "0", "1-1": "Transactional", "3-0": "2", "3-1": "Gamification Credits" }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "fn", "title": "addFrozenBalance" } [/block] [block:code] { "codes": [ { "code": "(String user_id, float value_to_add, int transaction_value, int expires_in_days, String transaction_id, String meta_data, String tag)", "language": "java", "name": "Signature" } ] } [/block] **Returns** Boolean **Throws** Exception, InvalidArgumentException This is similar to addBalance with the frozen parameter set to true [block:api-header] { "type": "fn", "title": "deductBalance" } [/block] [block:code] { "codes": [ { "code": "(String user_id, float value_to_remove, int transaction_type, String transaction_id, String meta_data, String tag)", "language": "java", "name": "Signature" } ] } [/block] **Returns** Boolean **Throws** BalanceExhaustedException, Exception, InvalidArgumentException [block:callout] { "type": "danger", "title": "Error handling required", "body": "This method throws a BalanceExhaustedException. Please be sure to handle the error appropriately" } [/block] Debit balance from user's wallet [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "user_id", "0-1": "String", "1-0": "value_to_remove", "1-1": "Float", "3-0": "transaction_id", "3-1": "String", "4-0": "meta_data", "4-1": "String", "5-0": "tag", "5-1": "String", "0-2": "User ID to which the balance has to be added", "1-2": "Value/Points to be added to the user's wallet", "3-2": "Any transaction id for your internal reference. This could be a order id or so..", "4-2": "Any meta data to associate with this transaction", "5-2": "Similar to meta data. Additional field for associating extra information", "2-0": "transaction_type", "2-1": "int", "2-2": "Type of credit in this transaction. Default value is -1 which is both promotional & transactional. `2`, `3` are promotional and `1` is transactional" }, "cols": 3, "rows": 6 } [/block] [block:api-header] { "type": "fn", "title": "getBalance" } [/block] [block:code] { "codes": [ { "code": "(String user_id, int transaction_type)", "language": "java", "name": "Signature" } ] } [/block] **Returns** Array Object **Throws** Exception, InvalidArgumentException [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "user_id", "0-1": "String", "0-2": "User ID to which the balance has to be calculated", "1-0": "transaction_type", "1-1": "int", "1-2": "Balance for particular transaction type. `-1` gives the full balance" }, "cols": 3, "rows": 2 } [/block] Get the balance credits available from a user's wallet in the below format [block:code] { "codes": [ { "code": "[code] => 200\n[total] => total_balance\n[slot1] => [\n \t\t\t\t\t\t [raw] => raw_balance,\n\t\t\t\t\t [conversion] => conversion_funnel_applied_balance\n\t\t\t\t\t ]\n[slot2] => [\n \t\t\t\t\t\t [raw] => raw_balance,\n\t\t\t\t\t [conversion] => conversion_funnel_applied_balance\n\t\t\t\t\t ]\n[slot3] => [\n \t\t\t\t\t\t [raw] => raw_balance,\n\t\t\t\t\t [conversion] => conversion_funnel_applied_balance\n\t\t\t\t\t ]", "language": "json", "name": "Array Object" } ] } [/block] [block:api-header] { "type": "fn", "title": "cancelTransaction" } [/block] Cancel / undo the transaction [block:code] { "codes": [ { "code": "(String transaction_id)", "language": "java", "name": "Signature" } ] } [/block] [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "transaction_id", "0-1": "String", "0-2": "Transaction ID of the transaction to be cancelled" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "fn", "title": "refund" } [/block] Refund the complete or the remaining balance of the transaction [block:code] { "codes": [ { "code": "(String transaction_id)", "language": "java", "name": "Signature" } ] } [/block] [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "transaction_id", "0-1": "String", "0-2": "Transaction ID of the transaction to be refunded" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "fn", "title": "refundPartial" } [/block] Refund a partial amount of the transaction [block:code] { "codes": [ { "code": "(String transaction_id, float refund_value)", "language": "java", "name": "Signature" } ] } [/block] [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "transaction_id", "0-1": "String", "0-2": "Transaction ID of the transaction to be refunded", "1-0": "refund_value", "1-1": "float", "1-2": "Value to be refunded" }, "cols": 3, "rows": 2 } [/block] [block:api-header] { "type": "fn", "title": "unFreezeTransaction" } [/block] [block:code] { "codes": [ { "code": "(String transaction_id)", "language": "java", "name": "Signature" } ] } [/block] **Returns** Boolean **Throws** Exception, InvalidArgumentException Unfreeze a frozen transaction [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "transaction_id", "0-1": "String", "0-2": "Transaction id associated with the frozen order. This could be a order id or so.." }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "fn", "title": "getTransactionDetail" } [/block] [block:code] { "codes": [ { "code": "(String transaction_id)", "language": "java", "name": "Signature" } ] } [/block] **Returns** Array **Throws** Exception, InvalidArgumentException Get the transaction detail for a particular transaction id [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "transaction_id", "0-1": "String", "0-2": "Transaction id associated with the transaction" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "fn", "title": "getAllTransactions" } [/block] [block:code] { "codes": [ { "code": "(int count)", "language": "java", "name": "Signature" } ] } [/block] **Returns** PaginatedResults **Throws** Exception, InvalidArgumentException Get the balance credits available from a user's wallet [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "count", "0-1": "Integer", "0-2": "Number of results per page" }, "cols": 3, "rows": 1 } [/block] [block:code] { "codes": [ { "code": "{\n 'customer_id' => [email protected]\n 'value' => 50\n 'expiry' => null\n 'meta' => Cashback \n 'tag' => Loyalty points credited\n 'timestamp' => 2016-01-22 05:49:42\n 'id' => loyalty_3_1453441781\n 'frozen' => 0\n}", "language": "json", "name": "Paginated Result" } ] } [/block] [block:api-header] { "type": "fn", "title": "getTransactionDetailsForUser" } [/block] [block:code] { "codes": [ { "code": "(String user_id, int count)", "language": "java", "name": "Signature" } ] } [/block] **Returns** PaginatedResults **Throws** Exception, InvalidArgumentException Get the transaction history for a user [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "user_id", "0-1": "String", "0-2": "User ID to which the balance has to be added", "1-0": "count", "1-1": "Integer", "1-2": "Number of results per page" }, "cols": 3, "rows": 2 } [/block]