{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"79d1b9ed-c769-4e9c-ba9e-b25741a97dc7","name":"8. YCS Fiscal Offline","description":"# DLL Library Documentation #\r\n\r\nThe **YCS Fiscal** allows you to process IVU Loto transactions with ease and simpliity, just with a few lines of code. Here's a quick documentation of how to utilize the YCS Fiscal library.\r\n\r\n**Step #1: Download the .DLL**<br/>\r\n[Download the library here](https://ycsfiles.blob.core.windows.net/dll-ycs-fiscal/YCS%20Fiscal.dll)<br/>\r\n\r\n**Step #2: Include the library in your project**<br/>\r\nOnce you've downloaded the .dll, you'll need to include it on your project. <br/>\r\n\r\n**Step #3: How to get the control get the control code with 3 examples**<br/>\r\n\r\n```csharp\r\nusing YCS_Fiscal;\t\t// Add Namespace\r\n\r\n// Variables and Objects //\r\nYCSFiscal fiscal;\t\t// YCS Fiscal DLL Object\r\nstring posID = \"0\";\t\t// POS ID Assigned by YCS\r\n\r\npublic class YourClass\r\n{\r\n\tpublic YourClass()\r\n\t{\r\n\t\t// Instantiate the YCS Fiscal object with your assigned POS ID //\r\n\t\tfiscal = new YCSFiscal(posID);\r\n\t}\r\n\r\n\tprivate void ExampleMethod1()\r\n\t{\r\n\t\t// Generate a new fiscal print //\r\n\t\tfiscal.generateNewFiscalPrint();\r\n\t\t\r\n\t\t// Store the generated Fiscal Print //\r\n\t\tstring fiscalLine1 = \"CONTROL: \" + fiscal.FiscalPrintLine1;\r\n\t\tstring fiscalLine2 = fiscal.FiscalPrintLine2;\r\n\t\tstring fiscalLine3 = fiscal.FiscalPrintLine3;\r\n\t\t\r\n\t\t// Print fiscalLine1, 2 and 3 on your receipt //\r\n\t\tprintReceipt(fiscalLine1, fiscalLine2, fiscalLine3);\r\n\t\t\r\n\t\t// Store Submit Token with the control code //\r\n\t\tstoreTransDetails(fiscal.fiscalToken, fiscalLine1);\r\n\t}\r\n\t\r\n\tprivate void ExampleMethod2()\r\n\t{\r\n\t\t// Generate a new fiscal print //\r\n\t\tfiscal.generateNewFiscalPrint();\r\n\t\t\r\n\t\t// Store the generated Fiscal Print //\r\n        string fiscalFooter = $\"CONTROL: {FiscalPrintLine1}\\n{FiscalPrintLine2}\\n{FiscalPrintLine3}\\n\";\r\n\t\t\r\n\t\t// Print fiscalFooter on your receipt //\r\n\t\tprintReceipt(fiscalFooter);\r\n\t\t\r\n\t\t// Store Submit Token with the control code //\r\n\t\tstoreTransDetails(fiscal.fiscalToken, fiscalLine1);\r\n\t}\r\n\t\r\n\tprivate void ExampleMethod3()\r\n\t{\r\n\t\t// Generate a new fiscal print //\r\n\t\tfiscal.generateNewFiscalPrint();\r\n\t\t\r\n\t\t// Store the generated Fiscal Print //\r\n        string fiscalFooter = string.Format(\"CONTROL: {0}{3}{1}{3}{2}{3}\", FiscalPrintLine1, FiscalPrintLine2, FiscalPrintLine3, Environment.NewLine);\r\n        \r\n        // or\r\n        //string fiscalFooter = string.Format(\"CONTROL: {0}\\n{1}\\n{2}\\n\", FiscalPrintLine1, FiscalPrintLine2, FiscalPrintLine3);\r\n\t\t\r\n\t\t// Print fiscalFooter on your receipt //\r\n\t\tprintReceipt(fiscalFooter);\r\n\t\t\r\n\t\t// Store Submit Token with the control code //\r\n\t\tstoreTransDetails(fiscal.fiscalToken, fiscalLine1);\r\n\t}\r\n}\r\n\r\n```\r\n\r\n**Step #4: Transaction Signature and details**<br/>\r\nNow that you've generated and printed the control code, you must save the control code *FiscalPrintLine1* and the transaction signature *fiscalToken* for when you report it via our web api. Read the API POST call, to understand how to send us your sale report. <br/>\r\n\r\n***\r\n\r\n**Recomendations**\r\n\r\n1. Do not generate control codes from the same application that will be uploading transactions.\r\n2. You must add the string CONTROL: before the first FiscalPrintLine1.\r\n3. The control code text block must be aligned in a specific form, please review the examples below.\r\n \r\n**Examples of allowed control code alignments:**\r\n```\r\n\r\n|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|\r\n|   RECEIPT HEADER TEXT         |\r\n|   DATE/TIME                   |\r\n|   STORE INFO                  |\r\n|                               |\r\n|   -------------------------   |\r\n|                               |\r\n|   Item                $1.00   |\r\n|   Item                $1.00   |\r\n|   Item                $1.00   |\r\n|                               |\r\n|   Subtotal:           $3.00   |\r\n|                               |\r\n|   -------------------------   |\r\n|     Store Promotion Text      |\r\n|                               |\r\n|   CONTROL: XXXXX-XXXXX        |\r\n|   YC                          |\r\n|   Processed by YCS PR Corp.   |\r\n|                               |\r\n|_______________________________|\r\n\r\n|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|\r\n|   RECEIPT HEADER TEXT         |\r\n|   DATE/TIME                   |\r\n|   STORE INFO                  |\r\n|                               |\r\n|   -------------------------   |\r\n|                               |\r\n|   Item                $1.00   |\r\n|   Item                $1.00   |\r\n|   Item                $1.00   |\r\n|                               |\r\n|   Subtotal:           $3.00   |\r\n|                               |\r\n|   -------------------------   |\r\n|     Store Promotion Text      |\r\n|                               |\r\n| CONTROL: XXXXX-XXXXX          |\r\n| YC                            |\r\n| Processed by YCS PR Corp.     |\r\n|                               |\r\n|_______________________________|\r\n\r\n```\r\n\r\n**Examples of unallowed control code alignments:**\r\n```\r\n\r\n|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|\r\n|   RECEIPT HEADER TEXT         |\r\n|   DATE/TIME                   |\r\n|   STORE INFO                  |\r\n|                               |\r\n|   -------------------------   |\r\n|                               |\r\n|   Item                $1.00   |\r\n|   Item                $1.00   |\r\n|   Item                $1.00   |\r\n|                               |\r\n|   Subtotal:           $3.00   |\r\n|                               |\r\n|   -------------------------   |\r\n|     Store Promotion Text      |\r\n|                               |\r\n|          CONTROL: XXXXX-XXXXX |\r\n|                            YC |\r\n|     Processed by YCS PR Corp. |\r\n|                               |\r\n|_______________________________|\r\n\r\n|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|\r\n|   RECEIPT HEADER TEXT         |\r\n|   DATE/TIME                   |\r\n|   STORE INFO                  |\r\n|                               |\r\n|   -------------------------   |\r\n|                               |\r\n|   Item                $1.00   |\r\n|   Item                $1.00   |\r\n|   Item                $1.00   |\r\n|                               |\r\n|   Subtotal:           $3.00   |\r\n|                               |\r\n|   -------------------------   |\r\n|     Store Promotion Text      |\r\n|                               |\r\n|      CONTROL: XXXXX-XXXXX     |\r\n|              YC               |\r\n|   Processed by YCS PR Corp.   |\r\n|                               |\r\n|_______________________________|\r\n\r\n```\r\n\r\n# Web API Documentation #\r\n\r\n**YCS Fiscal Offline** is an API oriented for the implementation of Hacienda of Puerto Rico regulations. YCS Fiscal Offline API let you submit sales through an HTTPS request and retrieve a unique Fiscal number to be printer in the POS receipts.\r\n\r\nSubmited sales are posted every day to \"Hacienda Dept\" automatically by YCS. The developers have the responsability to print the \"Fiscal Code\" to inform the customer receiving the receipt, it is a legal sale receipt and then report the transaction to \"Hacienda Dept\" via our API.\r\n\r\n**Allowed HTTPs requests:**\r\n>**POST**    : To upload sale information<br/>\r\n\r\n**Description Of Usual Server Responses:**\r\n>**200 OK** - the request was successful (some API calls may return 201 instead).<br/>\r\n>**201 Created** - the request was successful and a resource was created.<br/>\r\n>**204 No Content** - the request was successful but there is no representation to return (i.e. the response is empty).<br/>\r\n>**400 Bad Request** - the request could not be understood or was missing required parameters.<br/>\r\n>**401 Unauthorized** - authentication failed or user doesn't have permissions for requested operation.<br/>\r\n>**403 Forbidden** - access denied.<br/>\r\n>**404 Not Found** - resource was not found.405 Method Not Allowed - requested method is not supported for resource.<br/>\r\n\r\n# Classes Definitions #\r\n<br/>\r\n\r\n**IVUSale class**<br/>\r\n>Used on: \r\n>  - [POST -> Submit Transaction](#e90d58a8-cda0-441f-b07b-01b19680626c)\r\n\r\n| Variable | Type | Value |\r\n|:------:|:-----:|:-----:|\r\n| posId | `integer` | POS Identifier (Provided by YCS PR) |\r\n| ycsToken | `string` | POS signature  |\r\n| time | `string` | Transaction time in `hh:mm:ss` format  |\r\n| amount | `double` | Transaction Subtotal (w/o Taxes). Positive value only. |\r\n| munTax | `double` | Municipal Tax (1%). Positive value only.  |\r\n| stTax | `double` | State Tax (10.5%). Positive value only. |\r\n| control | `string` | Control Code generated by YCS PR in `XXXXX-XXXXX` format |\r\n| tender | `string` | Transaction Tender: `CASH` or `CRED` (in UPPERCASE) |\r\n| dob | `double` | Transaction date in `yyyy-mm-dd` format |\r\n| transType | `string` | Transaction Type: `DB` (Sale), `CR` (Refund) |\r\n| fiscalToken | `string` | Transaction signature  |\r\n\r\n***\r\n**Response class**<br/>\r\n>Used on: \r\n>  - [POST -> Submit Transaction](#e90d58a8-cda0-441f-b07b-01b19680626c)\r\n\r\n| Variable | Type | Value |\r\n|:------:|:-----:|:-----:|\r\n| Result | `integer` | Result id |\r\n| Message | `string` | Result description |\r\n\r\n\r\n***\r\n\r\n# IMPORTANT #\r\n\r\n**PRINTING specifications**<br/>\r\n\r\nHacienda of Puerto Rico mandates that the fiscal control number must be inserted on the bottom portion of every receipt. Make note that it should only be printed on sales receipt that paid taxes and it should not be printed on reprints of the original copy and/or refunds or voids.\r\n\r\nYou must insert the following lines at the end of the receipt.\r\n\r\n\tCONTROL: XXXXX-XXXXX \r\n\tYC\r\n\tProcessed by YCS PR Corp.\r\n\r\n\r\n*** Important notes:\r\n\r\n>Control code can only be printed on sales receipts that paid taxes.\r\n>Reprints cannot print the Fiscal code.\r\n>The control code must always be printed on the bottom portion of the receipts.\r\n>You must always print the control code utilizing the format provided by Hacienda.\r\n>DO NOT repeat the fiscal control number on two separate receipts. The code can only be printer ONCE.\r\n\r\n\r\n**Going LIVE**<br/>\r\n\r\nOnce testing is complete, copies of the receipts should be send to YCS for approval. \r\nYCS will provide a production URL to complete the integration.\r\n\r\n\r\n","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"6395545","team":246598,"collectionId":"79d1b9ed-c769-4e9c-ba9e-b25741a97dc7","publishedId":"S1ENwxh7","public":true,"publicUrl":"https://docs.fiscaloffline.ycspr.net","privateUrl":"https://go.postman.co/documentation/6395545-79d1b9ed-c769-4e9c-ba9e-b25741a97dc7","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","version":"8.10.1","publishDate":"2019-06-28T13:27:03.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/9ca00957cf3a92b8b218e1c3e3f2c0b3f7feae0f619ca9b2e5117339c6b945dd","favicon":"https://ycspr.net/favicon.ico"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://docs.fiscaloffline.ycspr.net/view/metadata/S1ENwxh7"}