{"id":107962,"date":"2019-08-19T01:12:58","date_gmt":"2019-08-19T01:12:58","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/wootix\/"},"modified":"2019-08-19T01:12:58","modified_gmt":"2019-08-19T01:12:58","slug":"wootix","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/wootix\/","author":17454176,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.0","stable_tag":"1.0","tested":"5.2.24","requires":"4.0","requires_php":"","requires_plugins":"","header_name":"Wootix","header_author":"WPDO","header_description":"WooCommerce ticket\/credit system","assets_banners_color":"","last_updated":"2019-08-19 01:12:58","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/zairwolf\/wootix","header_author_uri":"","rating":0,"author_block_rating":0,"active_installs":0,"downloads":1554,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","changelog"],"tags":[],"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":{"1":"Credits on the order Thanks You page"}},"plugin_section":[],"plugin_tags":[],"plugin_category":[],"plugin_contributors":[],"plugin_business_model":[],"class_list":["post-107962","plugin","type-plugin","status-closed","hentry","plugin_committers-wpdo5ea"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/wootix.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"\n\n<!--section=description-->\n<p>This plugin will enable the connection between your app and WooCommerce orders for digital credits usage. It can be used to check the remaining credits in one order, or consume them.<\/p>\n\n<h3>Usage<\/h3>\n\n<p>Redirect to your app link on order paid page, carring on the order key.<\/p>\n\n<p>Let's assume the order_key=<code>xxxorderkeyxxx<\/code>, your app URL is <code>https:\/\/myapp.com\/refill<\/code>, your WordPress link is <code>https:\/\/mywp.com\/<\/code><\/p>\n\n<ol>\n<li><p>On the order Thank You page, show a button <code>&lt;a href=\"https:\/\/myapp.com\/refill?order_key=xxxorderkeyxxx\"&gt;Go back to myapp&lt;\/a&gt;<\/code>.<\/p><\/li>\n<li><p>In <code>https:\/\/myapp.com\/refill<\/code>, call <code>https:\/\/mywp.com\/wp-json\/wootix\/v1\/order\/xxxorderkeyxxx<\/code> with <code>$_POST[ 'num' ] = 'max'<\/code>, assume the consumed credits is 42 in returned JSON.<\/p><\/li>\n<li><p>Add 42 credits into the corresponding user account.<\/p><\/li>\n<\/ol>\n\n<h3>REST APIs<\/h3>\n\n<p>1) Show balance:\n    Method: GET\n    URL: <code>https:\/\/mywp.com\/wp-json\/wootix\/v1\/order\/xxxorderkeyxxx<\/code>\n    Return: <code>{\"order_id\":45,\"status\":\"completed\",\"balance\":\"142\"}<\/code>\n    \/\/ NOTE: only the order with status=<code>completed<\/code> can be consumed credits.<\/p>\n\n<p>2) Consume 100 credits:\n    Method: <code>POST<\/code>\n    URL: <code>https:\/\/mywp.com\/wp-json\/wootix\/v1\/order\/xxxorderkeyxxx<\/code>\n    Data: <code>[ 'num' =&gt; 100 ]<\/code>\n    Return: <code>{\"order_id\":45,\"consumed\":\"100\",\"balance\":\"42\"}<\/code><\/p>\n\n<p>3) Consume all credits:\n    Method: POST\n    URL: https:\/\/mywp.com\/wp-json\/wootix\/v1\/order\/xxxorderkeyxxx\n    Data: <code>[ 'num' =&gt; 'max' ]<\/code>\n    Return: <code>{\"order_id\":45,\"consumed\":\"42\",\"balance\":\"0\"}<\/code><h3>Order Status<\/h3>\nIf an order contains only items that have valid credit in product detail, once the order is paid, the status will change to <code>completed<\/code> automatically instead of <code>processing<\/code>.<\/p>\n\n<p>The reason to do this is because some unpaid getways (Bank Wire, Cheque, Cash on delivery) will have status <code>processing<\/code> once the order is placed while not paid. Thus we can't use <code>processing<\/code> to detect if the order is paid or not.<\/p>\n\n<h3>Error Code<\/h3>\n\n<p>HTTP status: <code>442<\/code>\nError code: <code>wrong_hash<\/code>\nDescription: The order key doesn't match any order.<\/p>\n\n<p>HTTP status: <code>409<\/code>\nError code: <code>wong_status<\/code>\nDescription: The order isn't in processing\/completed status, maybe not paid yet?<\/p>\n\n<p>HTTP status: <code>409<\/code>\nError code: <code>lack_of_param<\/code>\nDescription: Need to specify the ammount to consume. Either numeric or a fixed string <code>max<\/code>.<\/p>\n\n<p>HTTP status: <code>409<\/code>\nError code: <code>lack_of_bal<\/code>\nDescription: Not enough balance left in this order.<\/p>\n\n<!--section=changelog-->\n<h4>1.0 - Aug 18 2019<\/h4>\n\n<ul>\n<li>\ud83c\udf89 Initial Release.<\/li>\n<\/ul>","raw_excerpt":"WooCommerce ticket\/credit system","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/107962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=107962"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/wpdo5ea"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=107962"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=107962"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=107962"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=107962"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=107962"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=107962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}