-
Notifications
You must be signed in to change notification settings - Fork 0
/
9d1f221e.c92f145e.js
1 lines (1 loc) · 76.3 KB
/
9d1f221e.c92f145e.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[91],{191:function(e,n,a){"use strict";a.r(n),a.d(n,"frontMatter",(function(){return s})),a.d(n,"metadata",(function(){return l})),a.d(n,"Highlight",(function(){return b})),a.d(n,"rightToc",(function(){return u})),a.d(n,"default",(function(){return d}));var t=a(2),r=a(6),i=(a(0),a(250)),o=a(257),c=a(258),s={id:"EndpointsAssinatura",title:"Outros endpoints",hide_title:!0,sidebar_label:"Others endpoints"},l={id:"Assinaturas/EndpointsAssinatura",isDocsHomePage:!1,title:"Outros endpoints",description:"Others endpoints",source:"@site/docs\\Assinaturas\\OutrosEndpoints.md",permalink:"/documentation/docs/Assinaturas/EndpointsAssinatura",sidebar_label:"Others endpoints",sidebar:"someSidebar",previous:{title:"Criando assinaturas",permalink:"/documentation/docs/Assinaturas/CriandoAssinatura"},next:{title:"Introdu\xe7\xe3o",permalink:"/documentation/docs/Carnes/Introducao"}},b=function(e){var n=e.children;e.color;return Object(i.b)("span",{style:{borderRadius:"2px",color:"#009615",padding:"0.2rem"}},n)},u=[{value:"1. List existing subscription plans",id:"1-list-existing-subscription-plans",children:[]},{value:"2. Cancel subscription plan",id:"2-cancel-subscription-plan",children:[]},{value:"3. Return subscription information linked to a plan",id:"3-return-subscription-information-linked-to-a-plan",children:[]},{value:"4. Cancel active subscriptions on a plan",id:"4-cancel-active-subscriptions-on-a-plan",children:[]},{value:"5.Change notification URL (notification_url) and/or custom_id of subscriptions",id:"5change-notification-url-notification_url-andor-custom_id-of-subscriptions",children:[{value:"a) Hierarchical structure of Schema attributes that can be used:",id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used",children:[]},{value:"b) Attributes that can be used to update notification URL and/or custom_id:",id:"b-attributes-that-can-be-used-to-update-notification-url-andor-custom_id",children:[]}]},{value:"6. List installments, according to the credit card brand",id:"6-list-installments-according-to-the-credit-card-brand",children:[]},{value:"7. Add information to subscription history",id:"7-add-information-to-subscription-history",children:[{value:"a) Hierarchical structure of Schema attributes that can be used :",id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used-",children:[]},{value:"b) Attributes that can be used to add messages to the subscription history:",id:"b-attributes-that-can-be-used-to-add-messages-to-the-subscription-history",children:[]}]},{value:"8. Edit subscription plan name",id:"8-edit-subscription-plan-name",children:[{value:"a) Hierarchical structure of Schema attributes that can be used:",id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used-1",children:[]},{value:"b) Attribute that can be used to edit the name of a pre-existing subscription plan:",id:"b-attribute-that-can-be-used-to-edit-the-name-of-a-pre-existing-subscription-plan",children:[]}]}],p={Highlight:b,rightToc:u};function d(e){var n=e.components,a=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(t.a)({},p,a,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h1",{className:"titulo"},"Others endpoints"),Object(i.b)("div",{className:"subtitulo"},Object(i.b)("p",null,"There are another endpoints (services) available in the API that can be used in subscriptions: "),Object(i.b)("ol",null,Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"#1-listar-os-planos-de-assinatura-existentes"}),"List existing subscription plans "))),Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"#2-cancelar-plano-de-assinatura"}),"Cancel subscription plan "))),Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"#3-retornar-informa%C3%A7%C3%B5es-de-assinatura-vinculada-a-um-plano"}),"Return subscription information linked to a plan"))),Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"#4-cancelar-assinaturas-ativas-em-um-plano"}),"Cancel active subscriptions on a plan"))),Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"#5-alterar-url-de-notifica%C3%A7%C3%A3o-notification_url-eou-custom_id-de-assinaturas"}),"Change notification URL (notification_url) and/or custom_id of subscriptions"))),Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"#6-listar-parcelas-de-acordo-com-a-bandeira-do-cart%C3%A3o-de-cr%C3%A9dito"}),"List installments, according to the credit card brand"))),Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"#7-acrescentar-informa%C3%A7%C3%B5es-ao-hist%C3%B3rico-da-assinatura"}),"Add information to subscription history"))),Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"#8-editar-nome-do-plano-de-assinatura"}),"Edit subscription plan name")))),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(t.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(t.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(t.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"Before proceeding, make sure that the Gerencianet SDK has been installed")),Object(i.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"The rest of this page provides detailed procedures, but you need to ",Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"Introducao.md"}),"install one of our libraries")," on your server to run the sample code. "))),Object(i.b)("br",null),Object(i.b)("h2",{id:"1-list-existing-subscription-plans"},"1. List existing subscription plans"),Object(i.b)("p",null,"Allows you to list the subscription plans created. There are advanced filters that can be used to find, such as:"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"Name"),": returns results from the search for the name of the previously registered plan;"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"Limit"),": maximum limit of response records;"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"Offset"),": determines from which register the search will be performed.")),Object(i.b)("p",null,"To return information demonstrating the subscription plans already created, you must send a ",Object(i.b)("code",null,"GET")," request to the ",Object(i.b)("code",null,"/v1/plans")," route."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(i.b)(o.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // caminho relacionado a SDK\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // insira seu Client_Id, conforme o ambiente (Des ou Prod)\n$clientSecret = 'informe_seu_client_secret'; // insira seu Client_Secret, conforme o ambiente (Des ou Prod)\n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // altere conforme o ambiente (true = desenvolvimento e false = producao)\n];\n\n$params = ['limit' => 20, 'offset' => 0];\n\ntry {\n $api = new Gerencianet($options);\n $plans = $api->getPlans($params, []);\n print_r($plans);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(c.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\ngn = Gerencianet(CREDENTIALS)\n\nparams = {\n 'name': \"My Plan\",\n 'limit': 1,\n 'offset': 0\n}\n\nresponse = gn.get_plans(params=params)\nprint(response)\n"))),Object(i.b)(c.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\nvar params = {\n name: 'My Plan',\n limit: 20,\n offset: 0\n}\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .getPlans(params)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(c.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class GetPlans\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new\n {\n // name = "My Plan",\n limit = 20,\n offset = 0\n };\n\n try\n {\n var response = endpoints.GetPlans(param);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n'))),Object(i.b)(c.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/json/ListPlan.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/map/ListPlan.java\n\n*/\n'))),Object(i.b)(c.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'package main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n res, err := gn.GetPlans(20, 0) // limit e offset\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(i.b)(c.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nparams = {\n name: "My Plan",\n limit: 1,\n offset: 0\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.get_plans(params: params)\n'))),Object(i.b)(c.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction GetPlans: String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction GetPlans: String;\nvar\n Params: String;\nbegin\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize();\n\n Params := CreateRequestParams( [ 'name=my plan', 'limit=20', 'offset=0' ] ).Text;\n Result := ExecuteGerenciaNetRequest( 'getPlans','', Params, '' );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"2-cancel-subscription-plan"},"2. Cancel subscription plan"),Object(i.b)("p",null,"Allows you to cancel a subscription plan. To do so, you must enter the ",Object(i.b)("code",null,"plan_id")," of the subscription plan you wish to cancel."),Object(i.b)("p",null,"To cancel a subscription plan, you must send a ",Object(i.b)("code",null,"DELETE")," request to the ",Object(i.b)("code",null,"/v1/plan/:id")," route, where ",Object(i.b)("code",null,":id")," is the ",Object(i.b)("code",null,"plan_id")," of the plan you want to cancel."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(i.b)(o.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // caminho relacionado a SDK\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // insira seu Client_Id, conforme o ambiente (Des ou Prod)\n$clientSecret = 'informe_seu_client_secret'; // insira seu Client_Secret, conforme o ambiente (Des ou Prod)\n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // altere conforme o ambiente (true = desenvolvimento e false = producao)\n];\n\n// $plan_id refere-se ao \"plan_id\" do plano\n$params = [\n 'id' => $plan_id\n];\n\ntry {\n $api = new Gerencianet($options);\n $plan = $api->deletePlan($params, []);\n print_r($plan);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(c.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\ngn = Gerencianet(CREDENTIALS)\n\nparams = {\n 'id': 1\n}\n\nresponse = gn.delete_plan(params=params)\nprint(response)\n"))),Object(i.b)(c.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\nvar params = {\n id: 0\n}\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .deletePlan(params)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(c.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class DeletePlan\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new\n {\n id = 1000\n };\n\n try\n {\n var response = endpoints.DeletePlan(param);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n"))),Object(i.b)(c.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/json/DeletePlan.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/map/DeletePlan.java\n\n*/\n'))),Object(i.b)(c.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'package main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n res, err := gn.DeletePlan(1) // no lugar do 1 coloque o plan_id correto\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(i.b)(c.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nparams = {\n id: 1\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.delete_plan(params: params)\n'))),Object(i.b)(c.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction DeletePlan(Id: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction DeletePlan(Id: String): String;\nvar\n Params: String;\nbegin\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize();\n\n Params := CreateRequestParams( [ 'id='+Id ] ).Text;\n Result := ExecuteGerenciaNetRequest( 'deletePlan',Params,'','' );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"3-return-subscription-information-linked-to-a-plan"},"3. Return subscription information linked to a plan"),Object(i.b)("p",null,"Allows you to search for information about a subscription that is linked to a plan. To do so, you must inform the ",Object(i.b)("code",null,"subscription_id")," of the subscription you want to search for."),Object(i.b)("p",null,"To return information from a subscription linked to a plan, you must send a ",Object(i.b)("code",null,"GET")," request to the ",Object(i.b)("code",null,"/v1/subscription/:id")," route, where ",Object(i.b)("code",null,":id")," is the ",Object(i.b)("code",null,"subscription_id")," of the subscription."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(i.b)(o.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // caminho relacionado a SDK\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // insira seu Client_Id, conforme o ambiente (Des ou Prod)\n$clientSecret = 'informe_seu_client_secret'; // insira seu Client_Secret, conforme o ambiente (Des ou Prod)\n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // altere conforme o ambiente (true = desenvolvimento e false = producao)\n];\n\n// $subscription_id refere-se ao \"subscription_id\" da assinatura\n$params = [\n 'id' => $subscription_id\n];\n\ntry {\n $api = new Gerencianet($options);\n $subscription = $api->detailSubscription($params, []);\n print_r($subscription);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(c.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\ngn = Gerencianet(CREDENTIALS)\n\nparams = {\n 'id': 1\n}\n\nresponse = gn.detail_subscription(params=params)\nprint(response)\n"))),Object(i.b)(c.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\nvar params = {\n id: 0\n}\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .detailSubscription(params)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(c.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class DetailSubscription\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new\n {\n id = 1002\n };\n\n try\n {\n var response = endpoints.DetailSubscription(param);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n"))),Object(i.b)(c.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/json/DetailSubscription.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/map/DetailSubscription.java\n\n*/\n'))),Object(i.b)(c.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'package main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n res, err := gn.DetailSubscription(1) // no lugar do 1 coloque o subscription_id correto\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(i.b)(c.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nparams = {\n id: 1120\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.detail_subscription(params: params)\n\n'))),Object(i.b)(c.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction DetailSubscription(Id: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction DetailSubscription(Id: String): String;\nvar\n Params: String;\nbegin\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize();\n\n Params := CreateRequestParams( [ 'id='+Id ] ).Text;\n Result := ExecuteGerenciaNetRequest( 'detailSubscription',Params,'', '' );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"4-cancel-active-subscriptions-on-a-plan"},"4. Cancel active subscriptions on a plan"),Object(i.b)("p",null,"Allows you to cancel active subscriptions on a plan. To do so, you must inform the ",Object(i.b)("code",null,"subscription_id")," of the subscription you want to cancel."),Object(i.b)("p",null,"To cancel active subscriptions in a subscription plan, you must send a ",Object(i.b)("code",null,"PUT")," request to the ",Object(i.b)("code",null,"/v1/subscription/:id/cancel")," route, where ",Object(i.b)("code",null,":id")," is the ",Object(i.b)("code",null,"subscription_id")," of the subscription."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(i.b)(o.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // caminho relacionado a SDK\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // insira seu Client_Id, conforme o ambiente (Des ou Prod)\n$clientSecret = 'informe_seu_client_secret'; // insira seu Client_Secret, conforme o ambiente (Des ou Prod)\n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // altere conforme o ambiente (true = desenvolvimento e false = producao)\n];\n\n// $subscription_id refere-se ao \"subscription_id\" da assinatura\n$params = [\n 'id' => $subscription_id\n];\n\ntry {\n $api = new Gerencianet($options);\n $subscription = $api->cancelSubscription($params, []);\n print_r($subscription);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(c.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\ngn = Gerencianet(CREDENTIALS)\n\nparams = {\n 'id': 1\n}\n\nresponse = gn.cancel_subscription(params=params)\nprint(response)\n"))),Object(i.b)(c.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\nvar params = {\n id: 0\n}\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .cancelSubscription(params)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(c.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class CancelSubscription\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new\n {\n id = 0\n };\n\n try\n {\n var response = endpoints.CancelSubscription(param);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n"))),Object(i.b)(c.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/json/CancelSubscription.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/map/CancelSubscription.java\n\n*/\n'))),Object(i.b)(c.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'package main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n res, err := gn.CancelSubscription(1) // no lugar do 1 coloque o subscription_id correto\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(i.b)(c.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nparams = {\n id: 1111\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.cancel_subscription(params: params)\n'))),Object(i.b)(c.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction CancelSubscription(Id: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction CancelSubscription(Id: String): String;\nvar\n Params: String;\nbegin\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize();\n\n Params := CreateRequestParams( [ 'id='+Id ] ).Text;\n Result := ExecuteGerenciaNetRequest( 'cancelSubscription',Params,'', '' );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"5change-notification-url-notification_url-andor-custom_id-of-subscriptions"},"5.Change notification URL (notification_url) and/or custom_id of subscriptions"),Object(i.b)("p",null,"You can set or change the information sent in the ",Object(i.b)("code",null,"metadata")," property of a subscription at any time. This endpoint is ",Object(i.b)("strong",{parentName:"p"},"extremely important")," for updating your notification URL tied to subscriptions or modifying the ",Object(i.b)("code",null,"custom_id")," previously associated with the subscription."),Object(i.b)("p",null,"In this case, all transactions belonging to the subscription will be updated."),Object(i.b)("p",null,"To change the ",Object(i.b)("code",null,"notification_url")," and/or ",Object(i.b)("code",null,"custom_id")," of a subscription, you must send a ",Object(i.b)("code",null,"PUT")," request to the ",Object(i.b)("code",null,"/v1/subscription/ route :id/metadata"),", where ",Object(i.b)("code",null,":id")," is the ",Object(i.b)("code",null,"subscription_id")," of the transaction. "),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"Use cases for this endpoint :")),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},"Integrator changed the server IP that was associated in the subscription/transactions notification URL;")),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},"Integrator has updated the notification URL for new subscriptions/transactions that are created, but also needs to update on previous subscriptions/transactions that were generated and that are associated with the incorrect/outdated URL;")),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},'SSL (https) was installed on the client\'s server and even if the client defines a 301 or 302 redirection rule, it will be necessary to define the new URL in the subscriptions/transactions that have the "old" URL;')),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},"Integrator generated charges and had not informed the notification URL when sending the subscription/transaction creation request;")),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},"Modify or add information next to the ",Object(i.b)("code",null,"custom_id")," attribute associated with previously generated subscriptions/transactions;")),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},"Among other possible scenarios."))),Object(i.b)("p",null,"If you want, you can explore and learn more about this feature ",Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundAssinaturas"}),"using our Playground")),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(i.b)(o.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n\nrequire __DIR__.'/../../vendor/autoload.php'; // caminho relacionado a SDK\n\nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n\n$file = file_get_contents(__DIR__.'/../config.json');\n$options = json_decode($file, true);\n\n// $subscription_id refere-se ao \"subscription_id\" da assinatura\n$params = [\n 'id' => $subscription_id\n];\n\n$body = [\n 'notification_url' => 'http://localhost.com',\n 'custom_id' => 'Custom Subscription 0001'\n];\n\ntry {\n $api = new Gerencianet($options);\n $subscription = $api->updateSubscriptionMetadata($params, $body);\n print_r($subscription);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(c.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\ngn = Gerencianet(CREDENTIALS)\n\nparams = {\n 'id': 1\n}\n\nbody = {\n 'notification_url': 'http://yourdomain.com',\n 'custom_id': 'my_new_id'\n}\n\nresponse = gn.update_subscription_metadata(params=params, body=body)\nprint(response)\n"))),Object(i.b)(c.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\nvar params = {\n id: 1009\n}\n\nvar body = {\n notification_url: 'http://yourdomain.com',\n custom_id: 'my_new_id'\n}\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .updateSubscriptionMetadata(params, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(c.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class UpdateSubscriptionMetadata\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new\n {\n id = 1002,\n };\n\n var body = new\n {\n notification_url = "http://yourdomain.com",\n custom_id = "my_new_id"\n };\n\n try\n {\n var response = endpoints.UpdateSubscriptionMetadata(param, body);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n'))),Object(i.b)(c.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/json/UpdateSubscription.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/map/UpdateSubscription.java\n\n*/\n'))),Object(i.b)(c.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'package main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n body := map[string]interface{} {\n "custom_id": "Product 0001",\n "notification_url": "http://domain.com/notification",\n }\n\n res, err := gn.UpdateSubscriptionMetadata(1, body) // no lugar do 1 coloque o subscription_id correto\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(i.b)(c.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nparams = {\n id: 1009\n}\n\nbody = {\n notification_url: "http://yourdomain.com",\n custom_id: "my_new_id"\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.update_subscription_metadata(params: params, body: body)\n'))),Object(i.b)(c.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction UpdateSubscription(Id: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction UpdateSubscription(Id: String): String;\nvar\n Body: String;\n Params : String;\nbegin\n Params := CreateRequestParams( [ 'id='+Id ] ).Text;\n Body :=\n '{\"custom_id\": \"Subscription10\",'+\n '\"notification_url\": \"http://domain.com/notification\" }';\n\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize();\n\n Result := ExecuteGerenciaNetRequest( 'updateSubscriptionMetadata', Params,'', Body );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("h3",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used"},"a) Hierarchical structure of Schema attributes that can be used:"),Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{}),'"id": "/SubscriptionMetadataUpdate"\n "notification_url"\n "custom_id"\n')),Object(i.b)("p",null,"For more details, ",Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundAssinaturas"}),"click here")," and explore it in our Playground."),Object(i.b)("br",null),Object(i.b)("h3",{id:"b-attributes-that-can-be-used-to-update-notification-url-andor-custom_id"},"b) Attributes that can be used to update notification URL and/or custom_id:"),Object(i.b)("table",null,Object(i.b)("tbody",null,Object(i.b)("tr",null,Object(i.b)("th",null,"Attribute"),Object(i.b)("th",{align:"center"},"Description"),Object(i.b)("th",{align:"center"},"Required"),Object(i.b)("th",{align:"center"},"Type")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"notification_url")),Object(i.b)("td",{align:"left"},"Address of your valid URL that will receive transaction status change notifications.",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Maximum 255 characters")),Object(i.b)("td",{align:"center"},"No"),Object(i.b)("td",{align:"center"},"String/null")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"custom_id")),Object(i.b)("td",{align:"left"},"Allows you to associate a Gerencianet transaction with a specific ID of your system or application, allowing you to identify it if you have a specific ID and want to keep it.",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 characters")),Object(i.b)("td",{align:"center"},"No"),Object(i.b)("td",{align:"center"},"String")))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"6-list-installments-according-to-the-credit-card-brand"},"6. List installments, according to the credit card brand"),Object(i.b)("p",null,"The ",Object(i.b)("inlineCode",{parentName:"p"},"installments")," endpoint is used to list the installments of each credit card brand, with the interest values and number of installments calculated according to the integrating account. That is, if your account has a card interest setting (option available for customers who have chosen to receive card amounts in installments), it is not necessary to make any calculations, this endpoint already informs the calculated amounts."),Object(i.b)("p",null,"Available brands: ",Object(i.b)("inlineCode",{parentName:"p"},"visa"),", ",Object(i.b)("inlineCode",{parentName:"p"},"mastercard"),", ",Object(i.b)("inlineCode",{parentName:"p"},"amex"),", ",Object(i.b)("inlineCode",{parentName:"p"},"elo")," and ",Object(i.b)("inlineCode",{parentName:"p"},"hipercard"),"."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(i.b)(o.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // caminho relacionado a SDK\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // insira seu Client_Id, conforme o ambiente (Des ou Prod)\n$clientSecret = 'informe_seu_client_secret'; // insira seu Client_Secret, conforme o ambiente (Des ou Prod)\n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // altere conforme o ambiente (true = desenvolvimento e false = producao)\n];\n\n$params = [\n 'total' => '20000',\n 'brand' => 'visa'\n];\n\ntry {\n $api = new Gerencianet($options);\n $installments = $api->getInstallments($params, []);\n print_r($installments);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(c.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\ngn = Gerencianet(CREDENTIALS)\n\nparams = {\n 'brand': 'visa',\n 'total': 5000\n}\n\nresponse = gn.get_installments(params=params)\nprint(response)\n"))),Object(i.b)(c.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\nvar params = {\n type: 'visa',\n total: 5000\n}\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .getInstallments(params)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(c.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class GetInstallments\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new\n {\n brand = "visa",\n total = 2500\n };\n\n try\n {\n var response = endpoints.GetInstallments(param);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n'))),Object(i.b)(c.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/extra/json/GetInstallments.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/extra/map/GetInstallments.java\n\n*/\n'))),Object(i.b)(c.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'// No c\xf3digo de exemplo de uso da SDK de Go, definimos as credenciais de acesso \xe0 API (Client_Id e Client_Secret) e o ambiente a ser usado (sandbox como \'true\' ou \'false\') dentro de um arquivo espec\xedfico (configs.go), que est\xe1 localizado no diret\xf3rio "_examples/configs". Essas credenciais s\xe3o exportadas atrav\xe9s da vari\xe1vel \'Credentials\'.\n\npackage main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n res, err := gn.GetInstallments(20000, "visa") // total e bandeira\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(i.b)(c.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nparams = {\n brand: "visa",\n total: 5000\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.get_installments(params: params)\n'))),Object(i.b)(c.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),"interface\nfunction GetInstallments: String;\n\nimplementation\nuses\n uGerenciaNetClientUtilities, uGerenciaClient;\n\nfunction GetInstallments: String;\nvar\n Params: String;\nbegin\n Params := CreateRequestParams( [ 'total=20000', 'brand=visa' ] ).Text;\n Result := ExecuteGerenciaNetRequest( 'getInstallments','',Params,'' );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"7-add-information-to-subscription-history"},"7. Add information to subscription history"),Object(i.b)("p",null,"The history of a subscription is similar to the history of a transaction. However, it reflects the actions that the signature suffered. And, in the same way, it is possible to add personalized messages to the history of a subscription, without influencing in the flow of the same."),Object(i.b)("p",null,"To add custom messages to the history of a subscription, you must send a ",Object(i.b)("code",null,"POST")," request to the route ",Object(i.b)("code",null,"/v1/subscription/:id/history"),", where ",Object(i.b)("code",null,":id")," is the ",Object(i.b)("code",null,"subscription_id")," of the subscription."),Object(i.b)("p",null,"If you want, you can explore and learn more about this feature ",Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundAssinaturas"}),"using our Playground"),"."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(i.b)(o.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // caminho relacionado a SDK\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // insira seu Client_Id, conforme o ambiente (Des ou Prod)\n$clientSecret = 'informe_seu_client_secret'; // insira seu Client_Secret, conforme o ambiente (Des ou Prod)\n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // altere conforme o ambiente (true = desenvolvimento e false = producao)\n];\n \n// $subscription_id refere-se ao ID da assinatura desejada\n$params = [\n 'id' => $subscription_id\n];\n\n$body = [\n 'description' => 'Esta assinatura \xe9 sobre um servi\xe7o'\n];\ntry {\n $api = new Gerencianet($options);\n $response = $api->createSubscriptionHistory($params, $body);\n print_r($response);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(c.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\ngn = Gerencianet(CREDENTIALS)\n\n\nparams = {\n 'id': 1000\n}\n\nbody = {\n 'description': \"Esta assinatura \xe9 sobre um servi\xe7o\"\n}\n\nresponse = gn.create_subscription_history(params=params, body=body)\nprint(response)\n"))),Object(i.b)(c.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\nvar params = {\n id: 1001\n}\n\nvar body = {\n description: 'Esta assinatura \xe9 sobre um servi\xe7o'\n}\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .createSubscriptionHistory(params, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(c.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class CreateChargeHistory\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new {\n id = 1000\n };\n\n var body = new\n {\n description = "Esta assinatura \xe9 sobre um servi\xe7o"\n };\n\n\n try\n {\n var response = endpoints.CreateSubscriptionHistory(param, body);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n'))),Object(i.b)(c.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/json/CreateSubscriptionHistory.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/map/CreateSubscriptionHistory.java\n\n*/\n'))),Object(i.b)(c.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'package main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n body := map[string]interface{} {\n "description": "Esta assinatura \xe9 sobre um servi\xe7o",\n }\n\n res, err := gn.CreateSubscriptionHistory(13100, body) // no lugar do 1 coloque o subscription_id certo\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(i.b)(c.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nparams = {\n id: 1000\n}\n\nbody = {\n description: "Esta assinatura \xe9 sobre um servi\xe7o"\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.create_subscription_history(params: params, body: body)\n'))),Object(i.b)(c.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-json"}),"function CreateSubscriptionHistory(Id: String): String;\nvar\n Body : String;\n UpdateParams : String;\nbegin\n UpdateParams := CreateRequestParams( [ 'id='+Id ] ).Text;\n Body := '{\"description\": \"Esta assinatura \xe9 sobre um servi\xe7o\"}';\n Result := ExecuteGerenciaNetRequest( 'createSubscriptionHistory', UpdateParams, '', Body );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("br",null),Object(i.b)("h3",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used-"},"a) Hierarchical structure of Schema attributes that can be used :"),Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{}),'"id": "/SubscriptionHistory"\n "description"\n')),Object(i.b)("p",null,"To more details, ",Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundAssinaturas"}),"click here")," and explore it in our Playground."),Object(i.b)("h3",{id:"b-attributes-that-can-be-used-to-add-messages-to-the-subscription-history"},"b) Attributes that can be used to add messages to the subscription history:"),Object(i.b)("table",null,Object(i.b)("tbody",null,Object(i.b)("tr",null,Object(i.b)("th",null,"Attribute"),Object(i.b)("th",{align:"center"},"Description"),Object(i.b)("th",{align:"center"},"Required"),Object(i.b)("th",{align:"center"},"Type")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"description")),Object(i.b)("td",{align:"left"},"Allows you to add information to the subscription history without influencing its flow.",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Minimum of 1 character and maximum of 255 characters (String).")),Object(i.b)("td",{align:"center"},"Yes"),Object(i.b)("td",{align:"center"},"String")))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"8-edit-subscription-plan-name"},"8. Edit subscription plan name"),Object(i.b)("p",null,"Allows you to change (edit) the name of a pre-existing subscription plan. For this, the plan identifier ",Object(i.b)("code",null,"plan_id")," must be provided."),Object(i.b)("p",null,"To do so, you must send a ",Object(i.b)("code",null,"PUT")," request to the ",Object(i.b)("code",null,"/v1/plan/:id")," route, where ",Object(i.b)("code",null,":id")," is the ",Object(i.b)("code",null,"plan_id ")," of the plan."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(i.b)(o.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // caminho relacionado a SDK\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // insira seu Client_Id, conforme o ambiente (Des ou Prod)\n$clientSecret = 'informe_seu_client_secret'; // insira seu Client_Secret, conforme o ambiente (Des ou Prod)\n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // altere conforme o ambiente (true = desenvolvimento e false = producao)\n];\n \n// $charge_id refere-se ao ID da transa\xe7\xe3o gerada anteriormente\n$params = [\n 'id' => $charge_id\n];\n\n$body = [ 'name' => 'Meu novo plano' ];\n\ntry {\n $api = new Gerencianet($options);\n $subscription = $api->updatePlan($params, $body);\n print_r($subscription);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(c.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\ngn = Gerencianet(CREDENTIALS)\n\nparams = {\n 'id': 1\n}\n\nbody = {\n 'name': 'My new plan'\n}\n\nresponse = gn.update_plan(params=params, body=body)\nprint(response)\n"))),Object(i.b)(c.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\nvar params = {\n id: 1008\n}\n\nvar body = {\n name: 'My new plan'\n}\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .updatePlan(params, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(c.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class UpdateParcel\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new {\n id = 1001\n };\n\n var body = new {\n name = "My new plan"\n };\n\n try\n {\n var response = endpoints.UpdatePlan(param, body);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n'))),Object(i.b)(c.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-java"}),'/* Para que a SDK Java funcione corretamente, \xe9 necess\xe1rio que a instancia\xe7\xe3o do m\xf3dulo seja feita atrav\xe9s da cria\xe7\xe3o de um objeto do tipo Gerencianet.\n\nSempre que quisermos chamar uma fun\xe7\xe3o da API, basta invocar o m\xe9todo call do objeto Gerencianet, passando como par\xe2metro o nome do m\xe9todo, os par\xe2metros da requisi\xe7\xe3o (sempre ser\xe1 um HashMap<String, String>), e o "body", que consiste nas propriedades a serem passadas como argumento na chamada de um fun\xe7\xe3o da SDK. O "body" pode ser declarado de duas formas: um JSONObject ou um Map<String, Object>.\n\nEsta estrutura \xe9 necess\xe1ria para representar o corpo da requisi\xe7\xe3o http que \xe9 enviada \xe0 um determinado endpoint. Se o "body" for um JSONObject, o retorno do m\xe9todo call ser\xe1 um JSONObject, se for um Map<String, Object>, o retorno do m\xe9todo call ser\xe1 um Map<String, Object>\n\nA seguir, disponibilizamos links de nosso Github mostrando duas formas diferentes de retorno: JSONObject\ne Map<String, Object>\n\n\nJSONObject\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/json/UpdatePlan.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/subscriptions/map/UpdatePlan.java\n\n*/\n'))),Object(i.b)(c.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-go"}),'package main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n body := map[string]interface{} {\n "name": "My new plan",\n }\n\n res, err := gn.UpdatePlan(1, body) // no lugar do 1 coloque o plan_id certo\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(i.b)(c.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nparams = {\n id: 1008\n}\n\nbody = {\n name: "My new plan"\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.update_plan(params: params, body: body)\n'))),Object(i.b)(c.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction UpdatePlan(Id: String): String;\nvar\n Body: String;\n Params : String;\nbegin\n Params := CreateRequestParams( [ 'id='+Id ] ).Text;\n Body :=\n '{\"name\": \"My new plan\" }';\n Result := ExecuteGerenciaNetRequest( 'updatePlan', Params,'', Body );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("h3",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used-1"},"a) Hierarchical structure of Schema attributes that can be used:"),Object(i.b)("pre",null,Object(i.b)("code",Object(t.a)({parentName:"pre"},{}),'"id": "/UpdatePlan"\n "name"\n')),Object(i.b)("p",null,"To more details, ",Object(i.b)("a",Object(t.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundAssinaturas"}),"click here")," and explore it in our Playground."),Object(i.b)("br",null),Object(i.b)("h3",{id:"b-attribute-that-can-be-used-to-edit-the-name-of-a-pre-existing-subscription-plan"},"b) Attribute that can be used to edit the name of a pre-existing subscription plan:"),Object(i.b)("br",null),Object(i.b)("table",null,Object(i.b)("tbody",null,Object(i.b)("tr",null,Object(i.b)("th",null,"Attribute"),Object(i.b)("th",{align:"center"},"Description"),Object(i.b)("th",{align:"center"},"Required"),Object(i.b)("th",{align:"center"},"Type")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"name")),Object(i.b)("td",{align:"left"},"Allows you to change (edit) the name of a pre-existing subscription plan.",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Minimum of 1 character and maximum of 255 characters (String).")),Object(i.b)("td",{align:"center"},"Yes"),Object(i.b)("td",{align:"center"},"String"))))))}d.isMDXComponent=!0},250:function(e,n,a){"use strict";a.d(n,"a",(function(){return u})),a.d(n,"b",(function(){return m}));var t=a(0),r=a.n(t);function i(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function o(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,t)}return a}function c(e){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?o(Object(a),!0).forEach((function(n){i(e,n,a[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):o(Object(a)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))}))}return e}function s(e,n){if(null==e)return{};var a,t,r=function(e,n){if(null==e)return{};var a,t,r={},i=Object.keys(e);for(t=0;t<i.length;t++)a=i[t],n.indexOf(a)>=0||(r[a]=e[a]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t<i.length;t++)a=i[t],n.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=r.a.createContext({}),b=function(e){var n=r.a.useContext(l),a=n;return e&&(a="function"==typeof e?e(n):c(c({},n),e)),a},u=function(e){var n=b(e.components);return r.a.createElement(l.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},d=r.a.forwardRef((function(e,n){var a=e.components,t=e.mdxType,i=e.originalType,o=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=b(a),d=t,m=u["".concat(o,".").concat(d)]||u[d]||p[d]||i;return a?r.a.createElement(m,c(c({ref:n},l),{},{components:a})):r.a.createElement(m,c({ref:n},l))}));function m(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var i=a.length,o=new Array(i);o[0]=d;var c={};for(var s in n)hasOwnProperty.call(n,s)&&(c[s]=n[s]);c.originalType=e,c.mdxType="string"==typeof e?e:t,o[1]=c;for(var l=2;l<i;l++)o[l]=a[l];return r.a.createElement.apply(null,o)}return r.a.createElement.apply(null,a)}d.displayName="MDXCreateElement"},254:function(e,n,a){"use strict";function t(e){var n,a,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;n<e.length;n++)e[n]&&(a=t(e[n]))&&(r&&(r+=" "),r+=a);else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}n.a=function(){for(var e,n,a=0,r="";a<arguments.length;)(e=arguments[a++])&&(n=t(e))&&(r&&(r+=" "),r+=n);return r}},255:function(e,n,a){"use strict";var t=a(0);const r=Object(t.createContext)({tabGroupChoices:{},setTabGroupChoices:()=>{},isAnnouncementBarClosed:!1,closeAnnouncementBar:()=>{}});n.a=r},256:function(e,n,a){"use strict";var t=a(0),r=a(255);n.a=function(){return Object(t.useContext)(r.a)}},257:function(e,n,a){"use strict";var t=a(0),r=a.n(t),i=a(256),o=a(254),c=a(92),s=a.n(c);const l=37,b=39;n.a=function(e){const{block:n,children:a,defaultValue:c,values:u,groupId:p}=e,{tabGroupChoices:d,setTabGroupChoices:m}=Object(i.a)(),[j,g]=Object(t.useState)(c);if(null!=p){const e=d[p];null!=e&&e!==j&&u.some(n=>n.value===e)&&g(e)}const O=e=>{g(e),null!=p&&m(p,e)},h=[];return r.a.createElement("div",null,r.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(o.a)("tabs",{"tabs--block":n})},u.map(({value:e,label:n})=>r.a.createElement("li",{role:"tab",tabIndex:"0","aria-selected":j===e,className:Object(o.a)("tabs__item",s.a.tabItem,{"tabs__item--active":j===e}),key:e,ref:e=>h.push(e),onKeyDown:e=>((e,n,a)=>{switch(a.keyCode){case b:((e,n)=>{const a=e.indexOf(n)+1;e[a]?e[a].focus():e[0].focus()})(e,n);break;case l:((e,n)=>{const a=e.indexOf(n)-1;e[a]?e[a].focus():e[e.length-1].focus()})(e,n)}})(h,e.target,e),onFocus:()=>O(e),onClick:()=>O(e)},n))),r.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},t.Children.toArray(a).filter(e=>e.props.value===j)[0]))}},258:function(e,n,a){"use strict";var t=a(0),r=a.n(t);n.a=function(e){return r.a.createElement("div",null,e.children)}}}]);