{"__v":28,"_id":"5732563a9ef0fa0e0083f0d8","category":{"__v":0,"_id":"573255b9ee92510e00087821","project":"573243608b55962900f063c0","version":"573243608b55962900f063c1","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-10T21:42:17.582Z","from_sync":false,"order":4,"slug":"refunds","title":"Request Refunds"},"parentDoc":null,"project":"573243608b55962900f063c0","user":"5716534c893cbe0e002d7647","version":{"__v":9,"_id":"573243608b55962900f063c1","project":"573243608b55962900f063c0","createdAt":"2016-04-19T15:51:35.494Z","releaseDate":"2016-04-19T15:51:35.494Z","categories":["573243608b55962900f063c3","573243608b55962900f063c2","573255b9ee92510e00087821","573255c0384fc70e0050ea42","573255ce9ef0fa0e0083f0d4","57334604b90dba1900b3d90c","5733474f45fc0c0e00c154da","57348e6e6a42521700a246fb","57348e79a210200e005f99e2","5734efd57e13fd17002f1129","5746204e04f2410e00a5a2e4"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-10T21:44:26.351Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"The REFUND process can also be made through a POST call.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Production Environment\\nhttps://mws2.safetypay.com/express/ws/v.3.0/Post/CreateRefundProcess\\n\\nSandbox Environment\\nhttps://sandbox-mws2.safetypay.com/express/ws/v.3.0/Post/CreateRefundProcess\",\n  \"title\": \"Endpoints\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"CreateRefund\"\n}\n[/block]\nThis method is used to request a refund.\n\n**REQUEST**\n\n**Request Fields**\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Values\",\n    \"0-0\": \"ApiKey\",\n    \"1-0\": \"RequestDateTime\",\n    \"2-0\": \"SalesOperationID\",\n    \"3-0\": \"AmountToRefund\",\n    \"4-0\": \"TotalPartial\",\n    \"5-0\": \"Reason\",\n    \"6-0\": \"Comments\",\n    \"7-0\": \"MerchantRefundId\",\n    \"8-0\": \"ShopperInformation\",\n    \"9-0\": \"Signature\",\n    \"0-1\": \"Merchant’s Api Key generated in the MMS.\",\n    \"1-1\": \"Merchant’s Time. \\nUsed to compose signature.\",\n    \"2-1\": \"SafetyPay’s unique ID of the original payment to be refunded.\",\n    \"3-1\": \"Total or partial amount to be refunded to the shopper in same currency as in the original transaction.  If currency exchange is used, same rate exchange will be used.\",\n    \"4-1\": \"Refund type. Values 1 to 2.\\n1: Total; 2: Parcial\",\n    \"5-1\": \"Refund reason. Values 1 to 6.\\n1: Product damaged in transit\\n2: Shopper cancelled transaction\\n3: Shopper returned product\\n4: Shopper not satisfied with service\\n5: Shopper not satisfied with product\\n6: Other\",\n    \"6-1\": \"Any comment related to the refund.\\n***OPTIONAL***\",\n    \"7-1\": \"Refund’s Reference.\\nValue is used to notify the Merchant about a refund.\\n***OPTIONAL***\",\n    \"8-1\": \"Custom information related to the shopper like key-value pair data. The Keys are case-sensitive and supports the next preset keys:\\n•\\tfirst_name (255)\\n•\\tlast_name (255)\\n•\\temail (255)\\n•\\tdocument_type (50)\\n•\\tdocument_number (50)\\n•\\tphone (50)\\n•\\taddress1 (255)\\n•\\taddress2 (255)\\n•\\tcountry_id (3)\\n•\\tcity (50)\\n•\\tpostal_code (50) \\n•\\tcountry_code ->  International dialing code\\n•\\tmobile -> mobile number\\n•\\tnotify_expiration -> in minutes, time before the expiration of a transaction. For Client notification via SMS.\\n\\nMore additional type key-value pair records can be added to the default list that we handle.\",\n    \"9-1\": \"HASH SHA256 OF:\\nRequestDateTime + \\nSalesOperationID +\\nAmountToRefund + \\nTotalPartial +\\nReason +\\nSignatureKey\",\n    \"0-2\": \"String (32)\",\n    \"1-2\": \"Datetime\",\n    \"2-2\": \"String (16)\",\n    \"3-2\": \"Decimal\",\n    \"4-2\": \"Integer\",\n    \"5-2\": \"Integer\",\n    \"6-2\": \"String\",\n    \"7-2\": \"String (16)\",\n    \"8-2\": \"ShopperInformationType\",\n    \"9-2\": \"String (64)\",\n    \"0-3\": \"Example:\\n23f1d7e1b2d44b7fb43e4bcddee45689\",\n    \"1-3\": \"ISO 8601: \\nyyyy-MM-ddThh:mm:ss\\n\\nExample: \\n2007-01-31T14:24:59\",\n    \"2-3\": \"Example: 0111005115444311\",\n    \"3-3\": \"Example: \\n100.00\\n50.50\",\n    \"4-3\": \"1\\n2\",\n    \"5-3\": \"1\\n2\\n3\\n4\\n5\\n6\",\n    \"7-3\": \"Example: \\nREFUND-10001,\\nRXM-103-R01,\\nR001-312220, etc.\",\n    \"8-3\": \"Ejemplo:\\n{“first_name”: “Jhon”}\\n{“last_name”: “Braunz”}\\n{“email”: “jbraunz:::at:::server.com”}\\n{“document_type”: “DNI”}\\n{“document_number”: “454821454”}\\n{“phone”: “9966-2-462”}\\n{“address1”: “1920 Meridian Avenue”}\\n{“address2”: “Second Floor”}\\n{“country_id”: “USA”}\\n{“city”: “Miami Beach”}\\n{“postal_code”: “Florida 33139”}\"\n  },\n  \"cols\": 4,\n  \"rows\": 10\n}\n[/block]\n**ShopperInformationType**\n\n**ShopperInformationType Fields**\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Values\",\n    \"0-0\": \"ShopperField\",\n    \"0-2\": \"ShopperField\",\n    \"0-3\": \"Example:\\n{“first_name”: “Jhon”}\\n{“last_name”: “Braunz”}\\n{“email”: “jbraunz@server.com”}\\n{“document_type”: “DNI”}\\n{“document_number”: “454821454”}\\n{“phone”: “9966-2-462”}\\n{“address1”: “1920 Meridian Avenue”}\\n{“address2”: “Second Floor”}\\n{“country_id”: “USA”}\\n{“city”: “Miami Beach”}\\n{“postal_code”: “Florida 33139”}\",\n    \"0-1\": \"Element that contains information related to the shopper. Information formatted like key-value pairs data into attributes.\\n\\nThe Keys are case-sensitive. It supports the next preset keys:\\n•\\tfirst_name (255)\\n•\\tlast_name (255)\\n•\\temail (255)\\n•\\tdocument_type (50)\\n•\\tdocument_number (50)\\n•\\tphone (50)\\n•\\taddress1 (255)\\n•\\taddress2 (255)\\n•\\tcountry_id (3)\\n•\\tcity (50)\\n•\\tpostal_code (50) \\n\\nMore records type key-value pair can be added to the preset list that we handle.\"\n  },\n  \"cols\": 4,\n  \"rows\": 1\n}\n[/block]\n**Request - Example** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Create Refund\\n    $Result = $proxy->CreateRefund( $params );\\n    if ( $Result['ErrorManager']['ErrorNumber']['@content'] == '0' )\\n        $errorNo = '<span style=\\\"color:black;\\\">'\\n            . current(@@$Result['ErrorManager']['ErrorNumber']) . ', '\\n            . current(@@$Result['ErrorManager']['Description']) . '. Severity: '\\n            . current(@@$Result['ErrorManager']['Severity']) . '</span>';\\n    else\\n        if (is_array($Result['ErrorManager']['ErrorNumber']))\\n            $errorNo = '<span style=\\\"color:red;\\\">'\\n                . current(@@$Result['ErrorManager']['ErrorNumber']) . ', '\\n                . current(@@$Result['ErrorManager']['Description']) . '. Severity: '\\n                . current(@@$Result['ErrorManager']['Severity']) . '</span>';\\n        else\\n            $errorNo = '<span style=\\\"color:red;\\\">'\\n                . @@$Result['ErrorManager']['ErrorNumber'] . ', '\\n                . @@$Result['ErrorManager']['Description'] . '. Severity: '\\n                . @@$Result['ErrorManager']['Severity'] . '</span>';\\n}\\n?>\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n**RESPONSE**\n\n**Response Fields**\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Values\",\n    \"0-0\": \"ResponseDateTime\",\n    \"1-0\": \"Refund\",\n    \"2-0\": \"Signature\",\n    \"3-0\": \"ErrorManager\",\n    \"0-1\": \"SAFETYPAY Date and Time (GMT) used to compose the Signature.\",\n    \"1-1\": \"Refund Information\",\n    \"2-1\": \"HASH SHA256 OF:\\nResponseDateTime + \\nRefund.OperationID +\\nRefund.CreationDateTime + Refund.SalesOperationID + Refund.AmountToRefund + \\nRefund.TotalPartial +\\nRefund.Reason + \\nSignatureKey\",\n    \"3-1\": \"Error associated to the operation\",\n    \"0-3\": \"ISO 8601: \\nyyyy-MM-ddThh:mm:ss\\n\\nExample: \\n2007-01-31T14:24:59\",\n    \"0-2\": \"Datetime\",\n    \"2-2\": \"String (64)\",\n    \"1-2\": \"RefundType\",\n    \"3-2\": \"ErrorManagerType\",\n    \"1-3\": \"See definition of RefundType\",\n    \"3-3\": \"See definition of ErrorManagerType\"\n  },\n  \"cols\": 4,\n  \"rows\": 4\n}\n[/block]\n**RefundType**\n\n**RefundType Fields**\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Values\",\n    \"0-0\": \"OperationID\",\n    \"1-0\": \"CreationDatetime\",\n    \"2-0\": \"SalesOperationID\",\n    \"3-0\": \"AmountToRefund\",\n    \"4-0\": \"CurrencyIDToRefund\",\n    \"5-0\": \"TotalPartial\",\n    \"6-0\": \"Reason\",\n    \"7-0\": \"Comments\",\n    \"0-1\": \"Unique ID for the Refund Operation.\",\n    \"1-1\": \"Date and time of when the refund request was created. SafetyPay GMT Date and time in ISO 8601 format.\",\n    \"2-1\": \"SafetyPay’s unique ID of the original payment to be refunded.\",\n    \"3-1\": \"Total or partial amount to be refunded to the shopper in same currency as in the original transaction.  If currency exchange is used, same rate exchange will be used.\",\n    \"4-1\": \"Currency requested for the refund.\",\n    \"5-1\": \"Refund Type. Values 1 or 2.\\n1: Total\\n2: Partial\",\n    \"6-1\": \"Refund reason. Values [1 - 6].\\n1: Product damaged in transit\\n2: Shopper cancelled transaction\\n3: Shopper returned product\\n4: Shopper not satisfied with service\\n5: Shopper not satisfied with product\\n6: Other\",\n    \"7-1\": \"Any comment related to the refund\",\n    \"0-2\": \"String (16)\",\n    \"1-2\": \"Datetime\",\n    \"2-2\": \"String (16)\",\n    \"4-2\": \"String (3)\",\n    \"7-2\": \"String\",\n    \"3-2\": \"Decimal\",\n    \"5-2\": \"Integer\",\n    \"6-2\": \"Integer\",\n    \"0-3\": \"Example: 0200299290019293\",\n    \"1-3\": \"ISO 8601:\\nyyyy-MM-ddThh:mm:ss\\n\\nExample: \\n2007-01-31T14:24:59\",\n    \"2-3\": \"Example: 0149929001929301\",\n    \"3-3\": \"Example:\\n100.00 \\n50.50\",\n    \"4-3\": \"\",\n    \"5-3\": \"1\\n2\",\n    \"6-3\": \"1\\n2\\n3\\n4\\n5\\n6\"\n  },\n  \"cols\": 4,\n  \"rows\": 8\n}\n[/block]\nThe response should be in the following CSV structure:\n\nError Number,Sales Operation ID,Create DateTime,Amount to Refund, CurrencyIDToRefund,Total Partial,Reason,’Comments’\n\n**Response - Example**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"0,0112214860256148,2012-08-01T18:11:40,346.5000, USD,1,5,\\\"Product Changed...\\\"\",\n      \"language\": \"text\",\n      \"name\": \"CSV\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Refund Processing Times\",\n  \"body\": \"A Refund usually takes between 5 - 7 days to be processed.\"\n}\n[/block]","excerpt":"","slug":"nvp-1","type":"basic","title":"Integrating with NVP"}

Integrating with NVP


The REFUND process can also be made through a POST call. [block:callout] { "type": "info", "body": "Production Environment\nhttps://mws2.safetypay.com/express/ws/v.3.0/Post/CreateRefundProcess\n\nSandbox Environment\nhttps://sandbox-mws2.safetypay.com/express/ws/v.3.0/Post/CreateRefundProcess", "title": "Endpoints" } [/block] [block:api-header] { "type": "basic", "title": "CreateRefund" } [/block] This method is used to request a refund. **REQUEST** **Request Fields** [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Values", "0-0": "ApiKey", "1-0": "RequestDateTime", "2-0": "SalesOperationID", "3-0": "AmountToRefund", "4-0": "TotalPartial", "5-0": "Reason", "6-0": "Comments", "7-0": "MerchantRefundId", "8-0": "ShopperInformation", "9-0": "Signature", "0-1": "Merchant’s Api Key generated in the MMS.", "1-1": "Merchant’s Time. \nUsed to compose signature.", "2-1": "SafetyPay’s unique ID of the original payment to be refunded.", "3-1": "Total or partial amount to be refunded to the shopper in same currency as in the original transaction. If currency exchange is used, same rate exchange will be used.", "4-1": "Refund type. Values 1 to 2.\n1: Total; 2: Parcial", "5-1": "Refund reason. Values 1 to 6.\n1: Product damaged in transit\n2: Shopper cancelled transaction\n3: Shopper returned product\n4: Shopper not satisfied with service\n5: Shopper not satisfied with product\n6: Other", "6-1": "Any comment related to the refund.\n***OPTIONAL***", "7-1": "Refund’s Reference.\nValue is used to notify the Merchant about a refund.\n***OPTIONAL***", "8-1": "Custom information related to the shopper like key-value pair data. The Keys are case-sensitive and supports the next preset keys:\n•\tfirst_name (255)\n•\tlast_name (255)\n•\temail (255)\n•\tdocument_type (50)\n•\tdocument_number (50)\n•\tphone (50)\n•\taddress1 (255)\n•\taddress2 (255)\n•\tcountry_id (3)\n•\tcity (50)\n•\tpostal_code (50) \n•\tcountry_code -> International dialing code\n•\tmobile -> mobile number\n•\tnotify_expiration -> in minutes, time before the expiration of a transaction. For Client notification via SMS.\n\nMore additional type key-value pair records can be added to the default list that we handle.", "9-1": "HASH SHA256 OF:\nRequestDateTime + \nSalesOperationID +\nAmountToRefund + \nTotalPartial +\nReason +\nSignatureKey", "0-2": "String (32)", "1-2": "Datetime", "2-2": "String (16)", "3-2": "Decimal", "4-2": "Integer", "5-2": "Integer", "6-2": "String", "7-2": "String (16)", "8-2": "ShopperInformationType", "9-2": "String (64)", "0-3": "Example:\n23f1d7e1b2d44b7fb43e4bcddee45689", "1-3": "ISO 8601: \nyyyy-MM-ddThh:mm:ss\n\nExample: \n2007-01-31T14:24:59", "2-3": "Example: 0111005115444311", "3-3": "Example: \n100.00\n50.50", "4-3": "1\n2", "5-3": "1\n2\n3\n4\n5\n6", "7-3": "Example: \nREFUND-10001,\nRXM-103-R01,\nR001-312220, etc.", "8-3": "Ejemplo:\n{“first_name”: “Jhon”}\n{“last_name”: “Braunz”}\n{“email”: “jbraunz@server.com”}\n{“document_type”: “DNI”}\n{“document_number”: “454821454”}\n{“phone”: “9966-2-462”}\n{“address1”: “1920 Meridian Avenue”}\n{“address2”: “Second Floor”}\n{“country_id”: “USA”}\n{“city”: “Miami Beach”}\n{“postal_code”: “Florida 33139”}" }, "cols": 4, "rows": 10 } [/block] **ShopperInformationType** **ShopperInformationType Fields** [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Values", "0-0": "ShopperField", "0-2": "ShopperField", "0-3": "Example:\n{“first_name”: “Jhon”}\n{“last_name”: “Braunz”}\n{“email”: “jbraunz@server.com”}\n{“document_type”: “DNI”}\n{“document_number”: “454821454”}\n{“phone”: “9966-2-462”}\n{“address1”: “1920 Meridian Avenue”}\n{“address2”: “Second Floor”}\n{“country_id”: “USA”}\n{“city”: “Miami Beach”}\n{“postal_code”: “Florida 33139”}", "0-1": "Element that contains information related to the shopper. Information formatted like key-value pairs data into attributes.\n\nThe Keys are case-sensitive. It supports the next preset keys:\n•\tfirst_name (255)\n•\tlast_name (255)\n•\temail (255)\n•\tdocument_type (50)\n•\tdocument_number (50)\n•\tphone (50)\n•\taddress1 (255)\n•\taddress2 (255)\n•\tcountry_id (3)\n•\tcity (50)\n•\tpostal_code (50) \n\nMore records type key-value pair can be added to the preset list that we handle." }, "cols": 4, "rows": 1 } [/block] **Request - Example** [block:code] { "codes": [ { "code": "// Create Refund\n $Result = $proxy->CreateRefund( $params );\n if ( $Result['ErrorManager']['ErrorNumber']['@content'] == '0' )\n $errorNo = '<span style=\"color:black;\">'\n . current(@@$Result['ErrorManager']['ErrorNumber']) . ', '\n . current(@@$Result['ErrorManager']['Description']) . '. Severity: '\n . current(@@$Result['ErrorManager']['Severity']) . '</span>';\n else\n if (is_array($Result['ErrorManager']['ErrorNumber']))\n $errorNo = '<span style=\"color:red;\">'\n . current(@@$Result['ErrorManager']['ErrorNumber']) . ', '\n . current(@@$Result['ErrorManager']['Description']) . '. Severity: '\n . current(@@$Result['ErrorManager']['Severity']) . '</span>';\n else\n $errorNo = '<span style=\"color:red;\">'\n . @@$Result['ErrorManager']['ErrorNumber'] . ', '\n . @@$Result['ErrorManager']['Description'] . '. Severity: '\n . @@$Result['ErrorManager']['Severity'] . '</span>';\n}\n?>", "language": "php" } ] } [/block] **RESPONSE** **Response Fields** [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Values", "0-0": "ResponseDateTime", "1-0": "Refund", "2-0": "Signature", "3-0": "ErrorManager", "0-1": "SAFETYPAY Date and Time (GMT) used to compose the Signature.", "1-1": "Refund Information", "2-1": "HASH SHA256 OF:\nResponseDateTime + \nRefund.OperationID +\nRefund.CreationDateTime + Refund.SalesOperationID + Refund.AmountToRefund + \nRefund.TotalPartial +\nRefund.Reason + \nSignatureKey", "3-1": "Error associated to the operation", "0-3": "ISO 8601: \nyyyy-MM-ddThh:mm:ss\n\nExample: \n2007-01-31T14:24:59", "0-2": "Datetime", "2-2": "String (64)", "1-2": "RefundType", "3-2": "ErrorManagerType", "1-3": "See definition of RefundType", "3-3": "See definition of ErrorManagerType" }, "cols": 4, "rows": 4 } [/block] **RefundType** **RefundType Fields** [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Values", "0-0": "OperationID", "1-0": "CreationDatetime", "2-0": "SalesOperationID", "3-0": "AmountToRefund", "4-0": "CurrencyIDToRefund", "5-0": "TotalPartial", "6-0": "Reason", "7-0": "Comments", "0-1": "Unique ID for the Refund Operation.", "1-1": "Date and time of when the refund request was created. SafetyPay GMT Date and time in ISO 8601 format.", "2-1": "SafetyPay’s unique ID of the original payment to be refunded.", "3-1": "Total or partial amount to be refunded to the shopper in same currency as in the original transaction. If currency exchange is used, same rate exchange will be used.", "4-1": "Currency requested for the refund.", "5-1": "Refund Type. Values 1 or 2.\n1: Total\n2: Partial", "6-1": "Refund reason. Values [1 - 6].\n1: Product damaged in transit\n2: Shopper cancelled transaction\n3: Shopper returned product\n4: Shopper not satisfied with service\n5: Shopper not satisfied with product\n6: Other", "7-1": "Any comment related to the refund", "0-2": "String (16)", "1-2": "Datetime", "2-2": "String (16)", "4-2": "String (3)", "7-2": "String", "3-2": "Decimal", "5-2": "Integer", "6-2": "Integer", "0-3": "Example: 0200299290019293", "1-3": "ISO 8601:\nyyyy-MM-ddThh:mm:ss\n\nExample: \n2007-01-31T14:24:59", "2-3": "Example: 0149929001929301", "3-3": "Example:\n100.00 \n50.50", "4-3": "", "5-3": "1\n2", "6-3": "1\n2\n3\n4\n5\n6" }, "cols": 4, "rows": 8 } [/block] The response should be in the following CSV structure: Error Number,Sales Operation ID,Create DateTime,Amount to Refund, CurrencyIDToRefund,Total Partial,Reason,’Comments’ **Response - Example** [block:code] { "codes": [ { "code": "0,0112214860256148,2012-08-01T18:11:40,346.5000, USD,1,5,\"Product Changed...\"", "language": "text", "name": "CSV" } ] } [/block] [block:callout] { "type": "info", "title": "Refund Processing Times", "body": "A Refund usually takes between 5 - 7 days to be processed." } [/block]