Hi! I'm developing a mobile app with IUGU payment method, for this, I need to build from scratch a plugin. I'm new in programming and OUTSYSTEMS. I don't know how to get the information from API like in the site: https://dev.iugu.com/reference#criar-fatura, that when I post this JS code:
var data = JSON.stringify({ "ensure_workday_due_date": false, "items": [ { "description": "Teste", "quantity": 1, "price_cents": 10000 }, { "description": "Teste1", "quantity": 1, "price_cents": 10000 } ], "payer": { "address": { "zip_code": "zip_code", "street": "street", "number": "1490", "district": "district", "city": "city", "state": "SP", "country": "Brasil", "complement": "Casa" }, "cpf_cnpj": "cpf_cnpj", "name": "Bruno" }, "commissions": { "cents": 5000 }, "email": "exemple@exemple.com.br", "due_date": "2020-08-07" }); var xhr = new XMLHttpRequest(); xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("POST", "https://api.iugu.com/v1/invoices?api_token="); xhr.setRequestHeader("content-type", "application/json");
returns a Json like this:
{"id":
"ID"
"due_date":
"2020-08-07"
"currency":
"BRL"
"discount_cents":
NULL
"email":
"example@example.com.br"
"items_total_cents":
20000
"notification_url":
"return_url":
"status":
"pending"
"tax_cents":
"total_cents":
}
The code isn't the problem, but I'm not too good at programming and I don't know how to get this JSON data back to my mobile app. Anyone can help me with an article or documentation??
Best Regards
Hi,
follow this document
https://itnext.io/serializing-deserializing-json-in-the-outsystems-platform-ae08f2f6b5b4
https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Traditional_Web/Web_Logic_Tools/JSON_Deserialize
some post regarding JSON
https://www.outsystems.com/forums/discussion/35042/jsonserialize-jsondeserialize/
https://www.outsystems.com/forums/discussion/28488/deserialize-a-dynamic-json-object/
you can create a structure from json use jsondeserialization and get data in structure.
Thanks!!!! You really helped me!