-
Notifications
You must be signed in to change notification settings - Fork 0
/
4c4c76b3.c95d49ca.js
1 lines (1 loc) · 86.7 KB
/
4c4c76b3.c95d49ca.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[47],{148:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return b})),t.d(n,"metadata",(function(){return l})),t.d(n,"Highlight",(function(){return s})),t.d(n,"rightToc",(function(){return d})),t.d(n,"default",(function(){return p}));var a=t(2),r=t(6),c=(t(0),t(250)),i=t(257),o=t(258),b={id:"CriandoAssinatura",title:"Criando assinaturas",hide_title:!0,sidebar_label:"Create subscription"},l={id:"Assinaturas/CriandoAssinatura",isDocsHomePage:!1,title:"Criando assinaturas",description:"Create subscription",source:"@site/docs\\Assinaturas\\CriandoAssinatura.md",permalink:"/documentation/docs/Assinaturas/CriandoAssinatura",sidebar_label:"Create subscription",sidebar:"someSidebar",previous:{title:"Como funciona",permalink:"/documentation/docs/Assinaturas/ComoFunciona"},next:{title:"Outros endpoints",permalink:"/documentation/docs/Assinaturas/EndpointsAssinatura"}},s=function(e){var n=e.children;e.color;return Object(c.b)("span",{style:{borderRadius:"2px",color:"#009615",padding:"0.2rem"}},n)},d=[{value:"1. Create a subscription plan",id:"1-create-a-subscription-plan",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 create a transaction:",id:"b-attributes-that-can-be-used-to-create-a-transaction",children:[]}]},{value:"2. Create subscriptions to link to the plan",id:"2-create-subscriptions-to-link-to-the-plan",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) Attributes that can be used to associate a subscription with a plan:",id:"b-attributes-that-can-be-used-to-associate-a-subscription-with-a-plan",children:[]}]},{value:"3. Define a subscription payment method and customer data",id:"3-define-a-subscription-payment-method-and-customer-data",children:[{value:"a) Hierarchical structure of Schema attributes that can be used:",id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used-2",children:[]},{value:"b) Attributes that can be used to define the payment method for the subscription:",id:"b-attributes-that-can-be-used-to-define-the-payment-method-for-the-subscription",children:[]}]},{value:"4. Other endpoints and methods",id:"4-other-endpoints-and-methods",children:[]},{value:"5. V\xeddeo: Creating subscriptions (recurring billing)",id:"5-v\xeddeo-creating-subscriptions-recurring-billing",children:[{value:"5.1. Creating subscriptions (recurring billing) through the Gerencianet integration AP",id:"51-creating-subscriptions-recurring-billing-through-the-gerencianet-integration-ap",children:[]}]},{value:"6. Next steps",id:"6-next-steps",children:[]}],u={Highlight:s,rightToc:d};function p(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(c.b)("wrapper",Object(a.a)({},u,t,{components:n,mdxType:"MDXLayout"}),Object(c.b)("h1",{className:"titulo"},"Create subscription"),Object(c.b)("div",{className:"subtitulo"},Object(c.b)("p",null,"Learn how to generate a set of recurring charges for your customers. To create a subscription, it is quite simple and requires only three steps: "),Object(c.b)("ol",null,Object(c.b)("li",{parentName:"ol"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"#1-crie-o-plano-de-assinatura"}),"Create the subscription plan"),", defining the frequency and how many charges should be generated;")),Object(c.b)("li",{parentName:"ol"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"#2-crie-inscri%C3%A7%C3%B5es-assinaturas-para-vincular-ao-plano"}),"Create subscriptions to link to a plan"),";")),Object(c.b)("li",{parentName:"ol"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"#3-defina-a-forma-de-pagamento-da-assinatura-e-os-dados-do-cliente"}),"Define subscription payment method and customer data"),"."))),Object(c.b)("p",null,"Once you've created your subscription plan(s), you will only need to perform the second and third steps for each subsequent subscription."),Object(c.b)("p",null,"The rest of this page presents the three detailed steps, but you need to install one of our libraries on your server to run the sample code. ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Instalacao/introducao"}),"Make sure the Gerencianet SDK has been installed"),"."),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"Bolix")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"If you have activated Bolix in your Gestornet account, the charges generated by our module/plugin will already come with the pix in the boleto.\nMore details about Bolix and how to activate it, click ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Bolix/bolix"}),"here"),"."))),Object(c.b)("hr",null),Object(c.b)("br",null),Object(c.b)("h2",{id:"1-create-a-subscription-plan"},"1. Create a subscription plan"),Object(c.b)("p",null,"Initially, the ",Object(c.b)("strong",{parentName:"p"},"subscription plan")," will be created, in which the integrator can define three pieces of information:"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},"Name of the plan;"),Object(c.b)("li",{parentName:"ul"},"Frequency of billing (eg ",Object(c.b)("code",null,"1")," for monthly);"),Object(c.b)("li",{parentName:"ul"},"How many charges should be generated.")),Object(c.b)("p",null,"To create a subscription plan, you must send a ",Object(c.b)("code",null,"POST")," request to the ",Object(c.b)("code",null,"/plan")," route."),Object(c.b)("p",null,"If you want, you can explore and learn more about this feature ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes"}),"using our Playground"),"."),Object(c.b)("p",null,"The example below shows how this can be done, using the SDK's available:"),Object(c.b)(i.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(c.b)(o.a,{value:"php",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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$body = [\n 'name' => 'Meu Plano de Assinatura', // nome do plano de assinatura\n 'interval' => 1, // periodicidade da cobran\xe7a (em meses) - informe 1 para assinatura mensal\n 'repeats' => null // n\xfamero de vezes que a cobran\xe7a deve ser gerada (padr\xe3o: null, que significa que a cobran\xe7a \xe9 gerada por tempo indeterminado ou at\xe9 que o plano seja cancelado)\n];\n \ntry {\n $api = new Gerencianet($options);\n $plan = $api->createPlan([], $body);\n \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(c.b)(o.a,{value:"python",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\u200b\nfrom gerencianet import Gerencianet\n \noptions = {\n 'client_id': 'client_id',\n 'client_secret': 'client_secret',\n 'sandbox': True\n}\n \ngn = Gerencianet(options)\n \nbody = {\n 'name': \"Meu Plano de Assinatura\",\n 'repeats': null,\n 'interval': 1\n}\n \nplan = gn.create_plan(body=body)\n"))),Object(c.b)(o.a,{value:"js",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n \nvar moment = require('moment');\nvar Gerencianet = require('gn-api-sdk-node');\n \nvar clientId = 'your_client_id';\nvar clientSecret = 'your_client_secret';\n \nvar options = {\n client_id: clientId,\n client_secret: clientSecret,\n sandbox: true\n}\n \nvar body = {\n name: 'Meu Plano de Assinatura',\n repeats: null,\n interval: 1\n}\n \nvar gerencianet = new Gerencianet(options);\n \ngerencianet\n .createPlan({}, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(c.b)(o.a,{value:"c",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'dynamic endpoints = new Endpoints("client_id", "client_secret", true);\n \nvar body = new {\n name = "Meu Plano de Assinatura",\n repeats = null,\n interval = 1\n};\n \nvar planResponse = endpoints.CreatePlan(null, body);\n'))),Object(c.b)(o.a,{value:"java",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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/CreatePlan.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/CreatePlan.java\n\n*/\n'))),Object(c.b)(o.a,{value:"go",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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 body := map[string]interface{} {\n "name": "My plan",\n "interval": 2,\n "repeats": nil,\n }\n\n res, err := gn.CreatePlan(body)\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(c.b)(o.a,{value:"ruby",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\n \noptions = {\n client_id: "client_id",\n client_secret: "client_secret",\n sandbox: true\n}\n \nbody = {\n name: "Meu Plano de Assinatura",\n repeats: null,\n interval: 1\n}\n \ngerencianet = Gerencianet.new(options)\ngerencianet.create_plan(body: body)\n'))),Object(c.b)(o.a,{value:"delphi",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction CreatePlan: String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction CreatePlan: String;\nvar\n Body: String;\nbegin\n Body :=\n '{\"name\": \"my_plan\",'+\n '\"interval\": 2,'+\n '\"repeats\": 2}';\n\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize(); \n\n Result := ExecuteGerenciaNetRequest( 'createPlan','','', Body );\nend;\n")))),Object(c.b)("br",null),Object(c.b)("h3",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used"},"a) Hierarchical structure of Schema attributes that can be used:"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),'"id": "/Plan"\n "name"\n "interval"\n "repeats"\n')),Object(c.b)("p",null,"Para verificar mais detalhes, ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes"}),"acesse aqui")," e explore em nosso Playground."),Object(c.b)("br",null),Object(c.b)("h3",{id:"b-attributes-that-can-be-used-to-create-a-transaction"},"b) Attributes that can be used to create a transaction:"),Object(c.b)("table",null,Object(c.b)("tbody",null,Object(c.b)("tr",null,Object(c.b)("th",null,"Attribute"),Object(c.b)("th",{align:"center"},"Description"),Object(c.b)("th",{align:"center"},"Required"),Object(c.b)("th",{align:"center"},"Type")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"name")),Object(c.b)("td",{align:"left"},Object(c.b)("b",null,"Plan's name")," of the subscription. ",Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Minimum of 1 character and maximum of 255 characters (String).")),Object(c.b)("td",{align:"center"},"Yes"),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"interval")),Object(c.b)("td",{align:"left"},Object(c.b)("b",null,"Frequency of billing."),"Determines the interval, ",Object(c.b)("b",null,"in months")," that the subscription charge should be generated. Enter ",Object(c.b)("em",null,"1")," for monthly subscription.",Object(c.b)("br",null),Object(c.b)("br",null)," Example 1: if ",Object(c.b)("em",null,"interval = 1")," and ",Object(c.b)("em",null,"repeats = null"),", will be generated 1 (one) charge per month, that is, the recurring charge will be monthly, according to the first due date chosen and generated indefinitely.",Object(c.b)("br",null),Object(c.b)("br",null)," Example 2: if ",Object(c.b)("em",null,"interval = 6")," and ",Object(c.b)("em",null,"repeats = 2"),", 1 (one) charge will be generated every 6 (six) months, totaling 2 (two) charges in 12 months (one in the 6th month and another in the 12th month).",Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Minimum 1 month and maximum 24 months.")),Object(c.b)("td",{align:"center"},"Yes"),Object(c.b)("td",{align:"center"},"Integer")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"repeats")),Object(c.b)("td",{align:"left"},Object(c.b)("b",null,"How many charges should be generated.")," Determines the number of times the charge should be generated. If nothing is sent, the charge is generated indefinitely or until the plan is cancelled.",Object(c.b)("br",null),Object(c.b)("br",null)," Example 1: if ",Object(c.b)("em",null,"interval = 1")," and ",Object(c.b)("em",null,"repeats = null"),", 1 (one) charge will be generated per month, that is, the recurring charge will be monthly, according to the first due date chosen.",Object(c.b)("br",null),Object(c.b)("br",null)," Example 2: if ",Object(c.b)("em",null,"interval = 6")," and ",Object(c.b)("em",null,"repeats = 2"),", 1 (one) charge will be generated every 6 (six) months, totaling 2 (two) charges in 12 months (one in the 6th month and another in the 12th month).",Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Default: Unlimited.",Object(c.b)("br",null),"Minimum of 2 and maximum of 120.")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Integer")))),Object(c.b)("br",null),Object(c.b)("hr",null),Object(c.b)("h2",{id:"2-create-subscriptions-to-link-to-the-plan"},"2. Create subscriptions to link to the plan"),Object(c.b)("p",null,"With the plan created, it's time to create subscriptions by associating them with plan(s). Subscriptions are applicable when you need to bill your customers on a recurring basis. In this way, subsequent costs will be created automatically based on the plan configuration."),Object(c.b)("p",null,"It should be noted that the ",Object(c.b)("code",null,"plan_id")," of the previously created plan to which you want to associate must be informed."),Object(c.b)("p",null,"To associate subscriptions with plans, you must send a ",Object(c.b)("code",null,"POST")," request to the ",Object(c.b)("code",null,"/plan/:id/subscription")," route, where ",Object(c.b)("code",null,":id")," is the ",Object(c.b)("code",null,"plan_id")," of the plan you want to link to the subscription."),Object(c.b)("p",null,"If you want, you can explore and learn more about this feature ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes"}),"using our Playground")),Object(c.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(c.b)(i.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(c.b)(o.a,{value:"php",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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$item_1 = [\n 'name' => 'Item 1', // nome do item, produto ou servi\xe7o\n 'amount' => 1, // quantidade\n 'value' => 1000 // valor (1000 = R$ 10,00) (Obs: \xc9 poss\xedvel a cria\xe7\xe3o de itens com valores negativos. Por\xe9m, o valor total da fatura deve ser superior ao valor m\xednimo para gera\xe7\xe3o de transa\xe7\xf5es.)\n];\n \n$item_2 = [\n 'name' => 'Item 2' // nome do item, produto ou servi\xe7o\n 'amount' => 2, // quantidade\n 'value' => 2000 // valor (2000 = R$ 20,00)\n];\n \n$items = [\n $item_1,\n $item_2\n];\n// Exemplo para receber notifica\xe7\xf5es da altera\xe7\xe3o do status da transa\xe7\xe3o.\n// $metadata = ['notification_url'=>'sua_url_de_notificacao_.com.br']\n// Outros detalhes em: https://dev.gerencianet.com.br/docs/notificacoes\n\n// Como enviar seu $body com o $metadata\n// $body = [\n// 'items' => $items,\n// 'metadata' => $metadata\n// ];\n\n$body = [\n 'items' => $items\n];\n\n// $plan_id refere-se ao ID do plano criado anteriormente\n\n$params = [\n 'id' => $plan_id\n];\n \ntry {\n $api = new Gerencianet($options);\n $subscription = $api->createSubscription($params, $body);\n \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(c.b)(o.a,{value:"python",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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 'items': [{\n 'name': \"Product 1\",\n 'value': 1000,\n 'amount': 2\n }]\n}\n\nresponse = gn.create_subscription(params=params, body=body)\nprint(response)\n"))),Object(c.b)(o.a,{value:"js",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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 planBody = {\n name: 'My first plan',\n repeats: 24,\n interval: 2\n}\n\nvar subscriptionBody = {\n items: [{\n name: 'Product 1',\n value: 1000,\n amount: 2\n }]\n}\n\nvar gerencianet = new Gerencianet(options);\n\nvar createSubscription = function (response) {\n var params = {\n id: response.data.plan_id\n }\n\n return gerencianet.createSubscription(params, subscriptionBody);\n}\n\ngerencianet\n .createPlan({}, planBody)\n .then(createSubscription)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(c.b)(o.a,{value:"c",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class CreateSubscription\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var planBody = new {\n name = "My first plan",\n repeats = 24,\n interval = 2\n };\n \n var subscriptionBody = new\n {\n items = new[] {\n new {\n name = "Product 1",\n value = 1000,\n amount = 2\n }\n }\n };\n\n try\n {\n var planResponse = endpoints.CreatePlan(null, planBody);\n\n var subscriptionParam = new {\n id = planResponse.data.plan_id\n };\n var subscriptionResponse = endpoints.CreateSubscription(subscriptionParam, subscriptionBody);\n Console.WriteLine(subscriptionResponse);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n'))),Object(c.b)(o.a,{value:"java",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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/CreateSubscription.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/CreateSubscription.java\n\n*/\n'))),Object(c.b)(o.a,{value:"go",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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 body := map[string]interface{} {\n "items": []map[string]interface{}{\n {\n "name": "Product 1",\n "value": 1000,\n "amount": 2,\n },\n },\n }\n\n res, err := gn.CreateSubscription(1, body) // 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(c.b)(o.a,{value:"ruby",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.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\nplan = {\n name: "My first plan",\n repeats: 24,\n interval: 2\n}\n\nsubscription = {\n items: [{\n name: "Product 1",\n value: 1000,\n amount: 2\n }]\n}\n\ngerencianet = Gerencianet.new(options)\nplan = gerencianet.create_plan(body: plan)\n\nparams = {\n id: plan["data"]["plan_id"]\n}\n\nputs gerencianet.create_subscription(params: params, body: subscription)\n'))),Object(c.b)(o.a,{value:"delphi",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction CreateSubscription(Id: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction CreateSubscription(Id: String): String;\nvar\n Params: String;\n Body: String;\nbegin\n Params := CreateRequestParams( [ 'id='+Id ] ).Text;\n Body :=\n '{\"items\": ['+\n '{\"name\": \"Item 1\",'+\n '\"amount\": 1,'+\n '\"value\": 2000}'+\n ']}';\n\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize(); \n\n Result := ExecuteGerenciaNetRequest( 'createSubscription',Params,'', Body );\nend;\n")))),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.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(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),'"id": "/Subscription"\n "items"\n "name"\n "value"\n "amount"\n "shippings"\n "name"\n "value"\n "payee_code"\n "metadata"\n "custom_id"\n "notification_url"\n')),Object(c.b)("p",null,"Para verificar mais detalhes, ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes"}),"acesse aqui")," e explore em nosso Playground."),Object(c.b)("br",null),Object(c.b)("h3",{id:"b-attributes-that-can-be-used-to-associate-a-subscription-with-a-plan"},"b) Attributes that can be used to associate a subscription with a plan:"),Object(c.b)("table",null,Object(c.b)("tbody",null,Object(c.b)("tr",null,Object(c.b)("th",null,"Attribute"),Object(c.b)("th",{align:"center"},"Description"),Object(c.b)("th",{align:"center"},"Required"),Object(c.b)("th",{align:"center"},"Type")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"items")),Object(c.b)("td",{align:"left"},"item being sold. The same transaction can have unlimited items. ",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Item attributes:"),Object(c.b)("br",null),Object(c.b)("code",null,"name*"),"// Name of the item, product or service. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Minimum 1 character and maximum 255 characters (String)."),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"value*"),"// Value, in cents. Ex: R$ 10.00 = 1000. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Integer"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"amount"),"// Quantity. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Integer")),Object(c.b)("td",{align:"center"},"Yes"),Object(c.b)("td",{align:"center"},"Array")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"shippings")),Object(c.b)("td",{align:"left"},"Determines the shipping amount(s) for a transaction. The same transaction can have unlimited shipping values. ",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Shipping attributes:"),Object(c.b)("br",null),Object(c.b)("code",null,"name*"),"// Shipping label. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Maximum 255 characters. String."),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"value*"),"// Shipping value, in cents (1990 is equivalent to R$19.90). ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Integer")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Array")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"metadata")),Object(c.b)("td",{align:"left"},"Defines a transaction specific data",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Metadata attributes:"),Object(c.b)("br",null),Object(c.b)("code",null,"custom_id"),"// Allows you to associate a Gerencianet transaction with a specific ID on your system or application, allowing you to identify it if you have a specific identification and want to keep it. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Maximum 255 characters. String/null."),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"notification_url"),"// Address of your valid URL that will receive transaction status change notifications. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Maximum 255 characters. String/null.")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Object")))),Object(c.b)("br",null),Object(c.b)("hr",null),Object(c.b)("h2",{id:"3-define-a-subscription-payment-method-and-customer-data"},"3. Define a subscription payment method and customer data"),Object(c.b)("p",null,"After creating the subscription plan and associating subscriptions to the plans, it is time to associate the recurring payment method for the subscriptions, which can be ",Object(c.b)("code",null,"banking_billet")," (boleto) or ",Object(c.b)("code",null,"credit_card")," ( credit card)."),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("strong",{parentName:"p"},"Credit Card"),": your customer makes the payment, according to the frequency you defined (monthly, quarterly, etc.) in the plan, the same amount being automatically charged to your customer's credit card. In the recurrence by card, your customer enters the card data only in the first payment, then the charge is carried out automatically without having to inform the data again;")),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("strong",{parentName:"p"},"Boleto Banc\xe1rio"),": will be generated according to the number of repetitions defined by the plan, and can be sent by email. The subscriber or seller can unsubscribe at any time. When this occurs, the two are notified via email, with all the details of the cancellation."))),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.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"})))),'"trial_days" attribute that allows granting a trial period')),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"The API provides the ",Object(c.b)("code",null,"trial_days")," attribute, which allows you to define a number of days for a free trial of the subscription plan. Attribute only available when payment is ",Object(c.b)("code",null,"credit_card"),"."),Object(c.b)("p",{parentName:"div"},"For details, see the table below: ",Object(c.b)("code",null,'Objeto Credit_Card ("credit card)')))),Object(c.b)("p",null,"To associate subscriptions with the payment method, you must send a ",Object(c.b)("inlineCode",{parentName:"p"},"POST")," request to the ",Object(c.b)("inlineCode",{parentName:"p"},"/subscription/:id/pay")," route, where ",Object(c.b)("inlineCode",{parentName:"p"},":id")," is the ",Object(c.b)("inlineCode",{parentName:"p"},"subscription_id")," of the desired subscription ."),Object(c.b)("p",null,"If you want, you can explore and learn more about this feature ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes"}),"using our Playground"),"."),Object(c.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(c.b)(i.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(c.b)(o.a,{value:"php",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-php"}),"// Fun\xe7\xe3o paySubscription\n\n// Forma de pagamento por boleto banc\xe1rio (\"banking_billet\")\n\n$params = ['id' => $subscription_id];\n\n$customer = [\n 'name' => 'Gorbadoc Oldbuck',\n 'cpf' => '94271564656',\n 'phone_number' => '5144916523'\n];\n\n$body = [\n 'payment' => [\n 'banking_billet' => [\n 'expire_at' => '2018-12-12',\n 'customer' => $customer\n ]\n ]\n];\n\ntry {\n $api = new Gerencianet($options);\n $subscription = $api->paySubscription($params, $body);\n\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\n\n// Forma de pagamento por cart\xe3o de cr\xe9dito (\"credit_card\")\n\n$params = ['id' => $subscription_id];\n\n$paymentToken = 'payment_token';\n\n$customer = [\n 'name' => 'Gorbadoc Oldbuck',\n 'cpf' => '94271564656',\n 'phone_number' => '5144916523',\n 'email' => '[email protected]',\n 'birth' => '1977-01-15'\n];\n\n$billingAddress = [\n 'street' => 'Av. JK',\n 'number' => 909,\n 'neighborhood' => 'Bauxita',\n 'zipcode' => '35400000',\n 'city' => 'Ouro Preto',\n 'state' => 'MG',\n];\n\n$body = [\n 'payment' => [\n 'credit_card' => [\n 'billing_address' => $billingAddress,\n 'payment_token' => $paymentToken,\n 'customer' => $customer\n ]\n ]\n];\n\ntry {\n $api = new Gerencianet($options);\n $subscription = $api->paySubscription($params, $body);\n\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(c.b)(o.a,{value:"python",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-py"}),"# Fun\xe7\xe3o pay_subscription\n\n# Forma de pagamento por boleto banc\xe1rio (\"banking_billet\")\n# encoding: utf-8\n\nfrom gerencianet import Gerencianet\n\ncredentials = {\n 'client_id': 'client_id',\n 'client_secret': 'client_secret',\n 'sandbox': True\n}\n\ngn = Gerencianet(credentials)\n\nbody = {\n 'payment': {\n 'banking_billet': {\n 'expire_at': '2016-12-12',\n 'customer': {\n 'name': \"Gorbadoc Oldbuck\",\n 'email': \"[email protected]\",\n 'cpf': \"04267484171\",\n 'birth': \"1977-01-15\",\n 'phone_number': \"5144916523\"\n }\n }\n }\n}\n\nparams = {\n 'id': charge['data']['charge_id'] # informe o subscription_id\n}\n\nresponse = gn.pay_subscription(params=params, body=body)\nprint(response)\n\n\n# Forma de pagamento por cart\xe3o de cr\xe9dito (\"credit_card\")\n# encoding: utf-8\n\nfrom gerencianet import Gerencianet\n\ncredentials = {\n 'client_id': 'client_id',\n 'client_secret': 'client_secret',\n 'sandbox': True\n}\n\ngn = Gerencianet(credentials)\n\nparams = {\n 'id': 123 # informe o subscription_id\n}\n\nbody = {\n 'payment': {\n 'credit_card': {\n 'installments': 1,\n 'payment_token': \"\", #see credit card flow to see how to get this\n 'billing_address': {\n 'street': \"Av. JK\",\n 'number': 909,\n 'neighborhood': \"Bauxita\",\n 'zipcode': \"35400000\",\n 'city': \"Ouro Preto\",\n 'state': \"MG\"\n },\n 'customer': {\n 'name': \"Gorbadoc Oldbuck\",\n 'email': \"[email protected]\",\n 'cpf': \"04267484171\",\n 'birth': \"1977-01-15\",\n 'phone_number': \"5144916523\"\n }\n }\n }\n}\n\nresponse = gn.pay_subscription(params=params, body=payment)\nprint(response)\n"))),Object(c.b)(o.a,{value:"js",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"// Fun\xe7\xe3o paySubscription\n\n// Forma de pagamento por boleto banc\xe1rio (\"banking_billet\")\n\nvar tenDaysFromNow = moment()\n .add(10, 'days')\n .format('YYYY-MM-DD 00:00:00');\n\nvar params = {\n id: 1000 // informe o subscription_id\n}\n\nvar body = {\n payment: {\n banking_billet: {\n expire_at: tenDaysFromNow,\n customer: {\n name: 'Gorbadoc Oldbuck',\n email: '[email protected]',\n cpf: '04267484171',\n birth: '1977-01-15',\n phone_number: '5144916523'\n }\n }\n }\n}\n\ngerencianet\n .paySubscription(params, body)\n .then(console.log)\n .catch(console.log)\n .done();\n\n\n// Forma de pagamento por cart\xe3o de cr\xe9dito (\"credit_card\")\n\nvar params = {\n id: 1000 // informe o subscription_id\n}\n\nvar body = {\n payment: {\n credit_card: {\n payment_token: 'payment_token_aqui',\n billing_address: {\n street: 'Av. JK',\n number: 909,\n neighborhood: 'Bauxita',\n zipcode: '35400000',\n city: 'Ouro Preto',\n state: 'MG'\n },\n customer: {\n name: 'Gorbadoc Oldbuck',\n email: '[email protected]',\n cpf: '04267484171',\n birth: '1977-01-15',\n phone_number: '5144916523'\n }\n }\n }\n}\n\ngerencianet\n .paySubscription(params, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(c.b)(o.a,{value:"c",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'<%-- Fun\xe7\xe3o PaySubscription --%>\n\n<%-- Forma de pagamento por boleto banc\xe1rio ("banking_billet") --%>\n\nusing Gerencianet.SDK;\n...\ndynamic endpoints = new Endpoints("client_id", "client_secret", true);\n\nvar body = new {\n payment = new {\n banking_billet = new {\n expire_at = "2016-12-12",\n customer = new {\n name = "Gorbadoc Oldbuck",\n email = "[email protected]",\n cpf = "04267484171",\n birth = "1977-01-15",\n phone_number = "5144916523"\n }\n }\n }\n};\n\nvar param = new {\n id = chargeResult.data.charge_id # <%-- informe o charge_id --%>\n};\n\nvar response = endpoints.PaySubscription(param, body);\nConsole.WriteLine(response);\n\n\n<%-- Forma de pagamento por cart\xe3o de cr\xe9dito ("credit_card") --%>\n\nusing Gerencianet.SDK;\n...\ndynamic endpoints = new Endpoints("client_id", "client_secret", true);\n\nvar param = {\n id = 123 <%-- informe o subscription_id --%>\n};\n\nvar body = new {\n payment = new {\n credit_card = new {\n installments = 1,\n payment_token = "", // see credit card flow to see how to get this\n billing_address = new {\n street = "Av. JK",\n number = 909,\n neighborhood = "Bauxita",\n zipcode = "35400000",\n city = "Ouro Preto",\n state = "MG"\n },\n customer = new {\n name = "Gorbadoc Oldbuck",\n email = "[email protected]",\n cpf = "04267484171",\n birth = "1977-01-15",\n phone_number = "5144916523"\n }\n }\n }\n};\n\nvar response = endpoints.PaySubscription(param, body);\nConsole.WriteLine(response);\n'))),Object(c.b)(o.a,{value:"java",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-java"}),'/* For the Java SDK to work correctly, the module must be instantiated by creating an object of type Gerencianet.\n\nWhenever we want to call an API function, just invoke the call method of the Gerencianet object, passing as a parameter the name of the method, the parameters of the request (it will always be a HashMap<String, String>), and the "body", which consists of in the properties to be passed as an argument in an SDK function call. The "body" can be declared in two ways: a JSONObject or a Map<String, Object>.\n\nThis structure is needed to represent the body of the http request that is sent to a given endpoint. If the "body" is a JSONObject, the return of the call method will be a JSONObject, if it is a Map<String, Object>, the return of the call method will be a Map<String, Object>\n\nBelow, we provide links from our Github showing two different ways to return: JSONObject\nand 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/PaySubscription.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/PaySubscription.java\n\n*/\n'))),Object(c.b)(o.a,{value:"go",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-go"}),'//In the example code using the Go SDK, we defined the API access credentials (Client_Id and Client_Secret) and the environment to use (sandbox as \'true\' or \'false\') inside a specific file (configs.go) , which is located in the "_examples/configs" directory. These credentials are exported through the \'Credentials\' variable. \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 customer := map[string]interface{}{\n "name": "Gorbadoc Oldbuck",\n "cpf": "04267484171",\n "phone_number": "5144916523",\n }\n\n body := map[string]interface{} {\n "payment": map[string]interface{} {\n "banking_billet": map[string]interface{} {\n "expire_at": "2018-12-12",\n "customer": customer,\n },\n },\n }\n\n res, err := gn.PaySubscription(1, body) // in place of 1 put the right subscription_id \n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(c.b)(o.a,{value:"ruby",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'# Fun\xe7\xe3o pay_subscription\n\n# Forma de pagamento por boleto banc\xe1rio ("banking_billet")\n\nparams = {\n id: 1113 # informe o subscription_id\n}\n\nvar body = {\n payment: {\n banking_billet: {\n expire_at: "2016-12-12",\n customer: {\n name: "Gorbadoc Oldbuck",\n email: "[email protected]",\n cpf: "04267484171",\n birth: "1977-01-15",\n phone_number: "5144916523"\n }\n }\n }\n}\n\ngerencianet = Gerencianet.new(options)\ngerencianet.pay_subscription(params: params, body: body)\n\n\n# Forma de pagamento por cart\xe3o de cr\xe9dito ("credit_card")\n\nparams = {\n id: 1113 # informe o subscription_id\n}\n\nbody = {\n payment: {\n credit_card: {\n payment_token: "e0c210bb679fea225a586256234f8ce179fd16c5",\n billing_address: {\n street: "Av. JK",\n number: 909,\n neighborhood: "Bauxita",\n zipcode: "35400000",\n city: "Ouro Preto",\n state: "MG"\n },\n customer: {\n name: "Gorbadoc Oldbuck",\n email: "[email protected]",\n cpf: "04267484171",\n birth: "1977-01-15",\n phone_number: "5144916523"\n }\n }\n }\n}\n\ngerencianet = Gerencianet.new(options)\ngerencianet.pay_subscription(params: params, body: body)\n'))),Object(c.b)(o.a,{value:"delphi",mdxType:"TabItem"},Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),"// Function paySubscription\n\n// boleto banc\xe1rio payment method (\"banking_billet\")\n\ninterface\nfunction PaySubscription(Id: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction PaySubscription(Id: String): String;\nvar\n Body : String;\n PaymentParams: String;\n \nconst BodyText = '{'+\n '\"payment\": {'+\n '\"banking_billet\": {'+\n '\"customer\": {'+\n '\"email\": \"[email protected]\",'+\n '\"phone_number\": \"5144916523\",'+\n '\"birth\": \"1977-07-17\",'+\n '\"address\": {'+\n '\"street\": \"Av. JK\",'+\n '\"number\": 909,'+\n '\"neighborhood\": \"Bauxita\",'+\n '\"complement\": \"\",'+\n '\"city\": \"Ouro Preto\",'+\n '\"state\": \"MG\",'+\n '\"zipcode\": \"35400000\"'+\n '},'+\n '\"name\": \"Gorbadoc Oldbuck\",'+\n '\"cpf\": \"94271564656\"'+\n '},'+\n '\"message\": \"Test\",'+\n '\"expire_at\": \"2019-02-21\"'+\n '}'+\n '}'+\n'}';\n\nbegin\n PaymentParams := CreateRequestParams( [ 'id='+id ] ).Text;\n Body := BodyText;\n\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize(); \n\n Result := ExecuteGerenciaNetRequest( 'paySubscription',PaymentParams,'',Body );\nend;\n\n\n\n// credit card payment method (\"credit_card\")\n\n\ninterface\nfunction PaySubscriptionWithCreditCard(Id, Token: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction PaySubscriptionWithCreditCard(Id, Token: String): String;\nvar\n Body : String;\n PaymentParams: String;\n \nbegin\n Body :=\n '{'+\n '\"payment\": {'+\n '\"credit_card\": {'+\n '\"customer\": {'+\n '\"name\": \"Gorbadoc Oldbuck\",'+\n '\"cpf\": \"94271564656\",'+\n '\"phone_number\": \"5144916523\",'+\n '\"email\": \"[email protected]\",'+\n '\"birth\": \"1977-01-15\"'+\n '},'+\n '\"installments\": 1,'+\n '\"payment_token\": \"'+Token+'\",'+\n '\"billing_address\": {'+\n '\"street\": \"Av. JK\",'+\n '\"number\": \"909\",'+\n '\"neighborhood\": \"Bauxita\",'+\n '\"zipcode\": \"35400000\",'+\n '\"city\": \"Ouro Preto\",'+\n '\"state\": \"MG\"'+\n '}'+\n '}'+\n '}'+\n '}';\n\n PaymentParams := CreateRequestParams( [ 'id='+id ] ).Text;\n\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize(); \n\n Result := ExecuteGerenciaNetRequest( 'paySubscription',PaymentParams,'',Body );\nend;\n")))),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("h3",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used-2"},"a) Hierarchical structure of Schema attributes that can be used:"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{}),'"id": "/SubscriptionPay"\n "payment"\n "banking_billet"\n "customer"\n "name"\n "cpf"\n "email"\n "phone_number"\n "birth"\n "address"\n "street"\n "number"\n "neighborhood"\n "zipcode"\n "city"\n "complement"\n "state"\n "juridical_person"\n "corporate_name"\n "cnpj"\n "expire_at"\n "discount"\n "type"\n "percentage"\n "currency"\n "value"\n "conditional_discount"\n "type"\n "percentage",\n "currency"\n "value"\n "until_date"\n "configurations"\n "fine"\n "interest"\n "message"\n\n "credit_card"\n "customer"\n "name"\n "cpf"\n "email"\n "phone_number"\n "birth"\n "address"\n "street"\n "number"\n "neighborhood"\n "zipcode"\n "city"\n "complement"\n "state"\n "juridical_person"\n "corporate_name"\n "cnpj"\n "billing_address"\n "street"\n "number"\n "neighborhood"\n "zipcode"\n "city"\n "complement"\n "state"\n "payment_token"\n "discount"\n "type"\n "percentage"\n "currency"\n "value"\n "message"\n "trial_days"\n')),Object(c.b)("p",null,"Para verificar mais detalhes, ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes"}),"acesse aqui")," e explore em nosso Playground."),Object(c.b)("br",null),Object(c.b)("h3",{id:"b-attributes-that-can-be-used-to-define-the-payment-method-for-the-subscription"},"b) Attributes that can be used to define the payment method for the subscription:"),Object(c.b)("table",null,Object(c.b)("tbody",null,Object(c.b)("tr",null,Object(c.b)("th",null,"Attribute"),Object(c.b)("th",{align:"center"},"Description"),Object(c.b)("th",{align:"center"},"Required"),Object(c.b)("th",{align:"center"},"Type")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"payment")),Object(c.b)("td",{align:"left"},"Tag raiz"),Object(c.b)("td",{align:"center"},"Yes"),Object(c.b)("td",{align:"center"},"Object ",Object(c.b)("b",null,"Payment"))))),Object(c.b)("br",null),Object(c.b)("p",null,Object(c.b)("em",{parentName:"p"},"Object")," ",Object(c.b)("strong",{parentName:"p"},"Payment")),Object(c.b)("table",null,Object(c.b)("tbody",null,Object(c.b)("tr",null,Object(c.b)("th",null,"Attribute"),Object(c.b)("th",{align:"center"},"Description"),Object(c.b)("th",{align:"center"},"Required"),Object(c.b)("th",{align:"center"},"Type")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"banking_billet")),Object(c.b)("td",{align:"left"},'"boleto banc\xe1rio" as a payment method.'),Object(c.b)("td",{align:"center"},"Yes **"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"credit_card")),Object(c.b)("td",{align:"left"},'"credit card" as a payment method'),Object(c.b)("td",{align:"center"},"Yes **"),Object(c.b)("td",{align:"center"},"Object ",Object(c.b)("b",null,"Credit_Card"))))),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"}," The attribute with (* *) s related to the payment method and is mandatory and can be boleto banc\xe1rio or credit card")," "),Object(c.b)("br",null),Object(c.b)("p",null,Object(c.b)("em",{parentName:"p"},"Object")," ",Object(c.b)("strong",{parentName:"p"},Object(c.b)("em",{parentName:"strong"},"Banking_Billet")),' ("boleto banc\xe1rio")'),Object(c.b)("table",null,Object(c.b)("tbody",null,Object(c.b)("tr",null,Object(c.b)("th",null,"Attribute"),Object(c.b)("th",{align:"center"},"Description"),Object(c.b)("th",{align:"center"},"Required"),Object(c.b)("th",{align:"center"},"Type")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"name")),Object(c.b)("td",{align:"left"},"Nome do cliente.",Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"M\xednimo de 1 caractere e m\xe1ximo de 255 caracteres (String).")),Object(c.b)("td",{align:"center"},"Yes ",Object(c.b)("br",null),"Obs: Para Pessoa Jur\xeddica n\xe3o ser\xe3o obrigat\xf3rios o nome e CPF, apenas os demais dados do cliente."),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"cpf")),Object(c.b)("td",{align:"left"},"CPF v\xe1lido do cliente (sem pontos, v\xedrgulas ou h\xedfen).",Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Tamanho: 11 caracteres.")),Object(c.b)("td",{align:"center"},"Yes ",Object(c.b)("br",null),"Obs: Para Pessoa Jur\xeddica n\xe3o ser\xe3o obrigat\xf3rios o nome e CPF, apenas os demais dados do cliente."),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"email")),Object(c.b)("td",{align:"left"},"Email do cliente.",Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"M\xe1ximo de 255 caracteres. Ex.: [email protected].")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"phone_number")),Object(c.b)("td",{align:"left"},"Telefone do cliente.",Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Formato: sem pontos ou v\xedrgulas, com DDD de 2 caracteres (9\xba d\xedgito \xe9 opcional). Ex.: 11988887777")),Object(c.b)("td",{align:"center"},"Yes ",Object(c.b)("br",null),"Obs: Para Pessoa Jur\xeddica n\xe3o ser\xe3o obrigat\xf3rios o nome e CPF, apenas os demais dados do cliente."),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"birth")),Object(c.b)("td",{align:"left"},"Data de nascimento do cliente.",Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Formato: YYYY-MM-DD")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"address")),Object(c.b)("td",{align:"left"},"Endere\xe7o do cliente.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Atributos de address:"),Object(c.b)("br",null),Object(c.b)("code",null,"street*"),"// Nome da rua ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(Object)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"number*"),"// N\xfamero ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String/Integer)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"neighborhood*"),"// Bairro ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"zipcode*"),"// CEP (sem pontos ou h\xedfen) ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"city*"),"// Cidade ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"complement"),"// Complemento ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String/null)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"state*"),"// Estado (2 caracteres) ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(Object)")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"juridical_person")),Object(c.b)("td",{align:"left"},"Dados de pessoa jur\xeddica.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Atributos de juridical_person:"),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("code",null,"corporate_name*"),"// Nome da raz\xe3o social. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"M\xednimo de 1 caractere e m\xe1ximo de 255. String."),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"cnpj*"),"// CNPJ da empresa. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Tamanho: 14 caracteres. String.")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"expire_at")),Object(c.b)("td",{align:"left"},"Data de vencimento do boleto.",Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Formato: YYYY-MM-DD")),Object(c.b)("td",{align:"center"},"Yes"),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"discount")),Object(c.b)("td",{align:"left"},"Define dados de desconto sobre a cobran\xe7a.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Atributos de discount:"),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"type*"),"// Tipo do desconto (String). Valores permitidos: ",Object(c.b)("br",null),Object(c.b)("code",null,"currency"),": o desconto ser\xe1 informado em centavos. ",Object(c.b)("code",null,"percentage"),": o desconto ser\xe1 informado em porcentagem.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"cnpj*"),"// CNPJ da empresa. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Tamanho: 14 caracteres. String."),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"value*"),"// Valor do desconto (Integer). Se o tipo do desconto for ",Object(c.b)("code",null,"currency")," , o valor desta tag dever\xe1 ser informada pelo integrador em centavos (ou seja, 500 equivale a R$ 5,00). Caso o tipo do desconto seja ",Object(c.b)("code",null,"percentage"),", o valor dever\xe1 ser multiplicado por 100 (ou seja, 1500 equivale a 15%). Exemplos: ",Object(c.b)("br",null),"1)",Object(c.b)("code",null,"currency"),"// deve ser informado em centavos, ou seja, se o desconto ser\xe1 de R$ 5,99, o integrador deve informar ",Object(c.b)("code",null,"599"),";",Object(c.b)("br",null)," 2)",Object(c.b)("code",null,"percentage")," // deve ser informado em centavos, ou seja, se o desconto \xe9 de 15%, o integrador deve informar ",Object(c.b)("code",null,"1500"),".",Object(c.b)("br",null),Object(c.b)("br",null)),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"conditional_discount")),Object(c.b)("td",{align:"left"},"Define desconto condicional que \xe9 v\xe1lido at\xe9 uma data espec\xedfica. Se o pagamento n\xe3o for efetuado at\xe9 aquela data, o desconto \xe9 invalidado.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Atributos de conditional_discount:"),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"type*"),"// Tipo do desconto (String). Valores permitidos: ",Object(c.b)("br",null),Object(c.b)("code",null,"currency"),": o desconto ser\xe1 informado em centavos. ",Object(c.b)("code",null,"percentage"),": o desconto ser\xe1 informado em porcentagem.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"cnpj*"),"// CNPJ da empresa. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Tamanho: 14 caracteres. String."),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"value*"),"// Valor do desconto (Integer). Se o tipo do desconto for ",Object(c.b)("code",null,"currency")," , o valor desta tag dever\xe1 ser informada pelo integrador em centavos (ou seja, 500 equivale a R$ 5,00). Caso o tipo do desconto seja ",Object(c.b)("code",null,"percentage"),", o valor dever\xe1 ser multiplicado por 100 (ou seja, 1500 equivale a 15%). Exemplos: ",Object(c.b)("br",null),"1)",Object(c.b)("code",null,"currency"),"// deve ser informado em centavos, ou seja, se o desconto ser\xe1 de R$ 5,99, o integrador deve informar ",Object(c.b)("code",null,"599"),";",Object(c.b)("br",null)," 2)",Object(c.b)("code",null,"percentage")," // deve ser informado em centavos, ou seja, se o desconto \xe9 de 15%, o integrador deve informar ",Object(c.b)("code",null,"1500"),".",Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"until_date*"),", // Data m\xe1xima que o desconto ser\xe1 concedido. (String).",Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Formato: YYYY-MM-DD")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"configurations")),Object(c.b)("td",{align:"left"},"Permite incluir no boleto multa e juros caso seja pago ap\xf3s o vencimento.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Atributos de configurations:"),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"fine"),"// Valor cobrado de multa ap\xf3s o vencimento. Por exemplo: se voc\xea quiser 2%, voc\xea deve informar ",Object(c.b)("code",null,"200"),".",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"M\xednimo de 0 e m\xe1ximo de 1000. Integer."),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Caso voc\xea possua configura\xe7\xf5es de multa ativada na Gerencianet e queira gerar emiss\xf5es na API sem multa, utilize ",Object(c.b)("code",null,"0"),"como valor do atributo ",Object(c.b)("code",null,"fine")),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"interest"),"// Valor cobrado de juros por dia ap\xf3s a data de vencimento. Por exemplo: se voc\xea quiser 0,033%, voc\xea deve informar ",Object(c.b)("code",null,"33"),".",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"M\xednimo de 0 e m\xe1ximo de 330. Integer."),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Caso voc\xea possua configura\xe7\xf5es de multa ativada na Gerencianet e queira gerar emiss\xf5es na API sem juros, utilize ",Object(c.b)("code",null,"0")," como valor do atributo ",Object(c.b)("code",null,"interest"))),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"message")),Object(c.b)("td",{align:"left"},'Permite incluir no boleto uma "observa\xe7\xe3o", ou em outras palavras, uma mensagem para o cliente. Essa mensagem poder\xe1 ser vista nos e-mails relacionados \xe0 cobran\xe7a, no boleto ou carn\xea.',Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"At\xe9 4 linhas contendo 100 caracteres em cada linha. String. ",Object(c.b)("br",null),"O operador ",Object(c.b)("code",null,"\\n"),"\xe9 utilizado para efetuar a quebra de linha.")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"String")))),Object(c.b)("br",null),Object(c.b)("p",null,Object(c.b)("em",{parentName:"p"},"Object")," ",Object(c.b)("strong",{parentName:"p"},Object(c.b)("em",{parentName:"strong"},"Credit_Card"))),Object(c.b)("table",null,Object(c.b)("tbody",null,Object(c.b)("tr",null,Object(c.b)("th",null,"Attribute"),Object(c.b)("th",{align:"center"},"Description"),Object(c.b)("th",{align:"center"},"Required"),Object(c.b)("th",{align:"center"},"Type")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"customer")),Object(c.b)("td",{align:"left"},"Dados pessoais do pagador.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Atributos de customer:"),Object(c.b)("br",null),Object(c.b)("code",null,"name*")," // Nome ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"cpf*")," // CPF do cliente (sem pontos, v\xedrgulas ou h\xedfen).",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"email*")," // Endere\xe7o de email v\xe1lido do cliente. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("code",null,"phone_number*")," // Telefone v\xe1lido do cliente, sem caracteres especiais. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("code",null,"birth*")," // Data de Nascimento do cliente (data v\xe1lida em formato YYYY-MM-DD). ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("code",null,"address")," // Endere\xe7o de Entrega. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(Object)")," (mais informa\xe7\xf5es)",Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("code",null,"juridical_person")," // Dados de pessoa jur\xeddica. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(Object)")," (mais informa\xe7\xf5es)"),Object(c.b)("td",{align:"center"},"Yes"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"installments")),Object(c.b)("td",{align:"left"},"N\xfamero de parcelas em que o pagamento deve ser dividido.",Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"M\xednimo 1 e m\xe1ximo 12. Integer.")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Integer")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"discount")),Object(c.b)("td",{align:"left"},"Define dados de desconto sobre a cobran\xe7a.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Atributos de discount:"),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"type*"),"// Tipo do desconto (String). Valores permitidos: ",Object(c.b)("br",null),Object(c.b)("code",null,"currency"),": o desconto ser\xe1 informado em centavos. ",Object(c.b)("code",null,"percentage"),": o desconto ser\xe1 informado em porcentagem.",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"cnpj*"),"// CNPJ da empresa. ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"Tamanho: 14 caracteres. String."),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"value*"),"// Valor do desconto (Integer). Se o tipo do desconto for ",Object(c.b)("code",null,"currency")," , o valor desta tag dever\xe1 ser informada pelo integrador em centavos (ou seja, 500 equivale a R$ 5,00). Caso o tipo do desconto seja ",Object(c.b)("code",null,"percentage"),", o valor dever\xe1 ser multiplicado por 100 (ou seja, 1500 equivale a 15%). Exemplos: ",Object(c.b)("br",null),"1)",Object(c.b)("code",null,"currency"),"// deve ser informado em centavos, ou seja, se o desconto ser\xe1 de R$ 5,99, o integrador deve informar ",Object(c.b)("code",null,"599"),";",Object(c.b)("br",null)," 2)",Object(c.b)("code",null,"percentage")," // deve ser informado em centavos, ou seja, se o desconto \xe9 de 15%, o integrador deve informar ",Object(c.b)("code",null,"1500"),".",Object(c.b)("br",null),Object(c.b)("br",null)),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"billing_address")),Object(c.b)("td",{align:"left"},"Endere\xe7o de cobran\xe7a (mais informa\xe7\xf5es)",Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("em",null,"Atributos de billing_address:"),Object(c.b)("br",null),Object(c.b)("code",null,"street*"),"// Nome da rua ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(Object)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"number*"),"// N\xfamero ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String/Integer)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"neighborhood*"),"// Bairro ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"zipcode*"),"// CEP (sem pontos ou h\xedfen) ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"city*"),"// Cidade ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"complement"),"// Complemento ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(String/null)"),Object(c.b)("br",null),Object(c.b)("br",null)," ",Object(c.b)("code",null,"state*"),"// Estado (2 caracteres) ",Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"(Object)")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Object")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"payment_token")),Object(c.b)("td",{align:"left"},"Token \xfanico de pagamento obtido na primeira etapa da gera\xe7\xe3o da transa\xe7\xe3o."),Object(c.b)("td",{align:"center"},"Yes"),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"message")),Object(c.b)("td",{align:"left"},'Permite incluir na cobran\xe7a uma "observa\xe7\xe3o", ou em outras palavras, uma mensagem para o cliente. Essa mensagem poder\xe1 ser vista nos e-mails relacionados \xe0 cobran\xe7a, no boleto ou carn\xea.',Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"At\xe9 4 linhas contendo 100 caracteres em cada linha. String. ",Object(c.b)("br",null),"O operador ",Object(c.b)("code",null,"\\n"),"\xe9 utilizado para efetuar a quebra de linha.")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"String")),Object(c.b)("tr",null,Object(c.b)("td",null,Object(c.b)("code",null,"trial_days")),Object(c.b)("td",{align:"left"},"Permite definir uma quantidade de dias para teste gratuito do plano de assinatura. O per\xedodo para a avalia\xe7\xe3o gratuita, definido em ",Object(c.b)("code",null,"trial_days"),", come\xe7a a contar a partir do dia seguinte ao dia da realiza\xe7\xe3o da assinatura. Atributo dispon\xedvel somente quando o pagamento for ",Object(c.b)("code",null,"credit_card"),".",Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)(s,{color:"#009615",mdxType:"Highlight"},"M\xednimo de 1 dia e m\xe1ximo de 365 dias.",Object(c.b)("br",null),"Por exemplo: Criei um plano de assinatura em 25/09/2017 e defini ",Object(c.b)("b",null,Object(c.b)("code",null,"trial_days: 7"))," \xe9 utilizado para efetuar a quebra de linha.",Object(c.b)("br",null),Object(c.b)("br",null),"Isso significa que o primeiro pagamento ser\xe1 cobrado no dia 02/10/2017, e se for cancelado antes de 02/10/2017, ent\xe3o nada ser\xe1 cobrado.")),Object(c.b)("td",{align:"center"},"No"),Object(c.b)("td",{align:"center"},"Integer")))),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"Fields with * represent mandatory values")),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.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"})))),"Payment made as a Juridical Person (PJ) ")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"}," The customer associated with the subscription can be a Juridical Person. In this case, the Corporate Name and CNPJ of the paying company must be informed within the attribute ",Object(c.b)("code",null,"juridical_person"),"."),Object(c.b)("a",{href:"../OutrosRecursos/PessoaJuridica",target:"_blank",title:"Link Interno"},"Juridical Person")," on how to generate a subscription (recurrence) for a client who is a Juridical Person (PJ). ")),Object(c.b)("br",null),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.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"})))),"List of all possible statuses of a subscription ")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},'All subscriptions have statuses, which represent the "situation" of that subscription. Therefore, it is important to know the possible statuses in the API to provide the proper handling in your system. '),Object(c.b)("p",{parentName:"div"},"Check ",Object(c.b)("a",{href:"../VisaoGeral/statusTransacoes",target:"_blank",title:"Status das Transa\xe7\xf5es"},"this link")," all details of possible subscription statuses. "))),Object(c.b)("br",null),Object(c.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"API's subscription callbacks (notifications) for your system")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},":class: hyperlinkcolor\nNotifications let you know when a subscription changes status. In this way, you will be able to identify when the charge is paid, for example. "),Object(c.b)("p",{parentName:"div"},"Check ",Object(c.b)("a",{href:"../Notificacoes/RecebendoNotificacoes",target:"_blank",title:"Link Interno"},"this link")," all the details on how to implement your notification URL. "))),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("hr",null),Object(c.b)("h2",{id:"4-other-endpoints-and-methods"},"4. Other endpoints and methods"),Object(c.b)("p",null,"There are other subscription's endpoints and methods (recurring billing) that are available in the API and can be exploited by the integrator. Check out the complete list: "),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Assinaturas/EndpointsAssinatura#1-listar-os-planos-de-assinatura-existentes"}),"List existing subscription plans"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Assinaturas/EndpointsAssinatura#2-cancelar-plano-de-assinatura"}),"Cancel subscription plan"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Assinaturas/EndpointsAssinatura#3-retornar-informa%C3%A7%C3%B5es-de-assinatura-vinculada-a-um-plano"}),"Return subscription information linked to a plan"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Assinaturas/EndpointsAssinatura#4-cancelar-assinaturas-ativas-em-um-plano"}),"Cancel active subscriptions on a plan"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Assinaturas/EndpointsAssinatura#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(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Assinaturas/EndpointsAssinatura#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(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Assinaturas/EndpointsAssinatura#7-acrescentar-informa%C3%A7%C3%B5es-ao-hist%C3%B3rico-da-assinatura"}),"Add information to subscription history"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"../Assinaturas/EndpointsAssinatura#8-editar-nome-do-plano-de-assinatura"}),"Edit subscription plan name")))),Object(c.b)("br",null),Object(c.b)("hr",null),Object(c.b)("h2",{id:"5-v\xeddeo-creating-subscriptions-recurring-billing"},"5. V\xeddeo: Creating subscriptions (recurring billing)"),Object(c.b)("p",null,"Thinking of offering new ways of transmitting information, Gestoret makes the following video available in order to explain, in a clear and objective way, how to create a subscription plan and associate it with the payment method (credit card or boleto) to charge your customer recurrently. "),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("h3",{id:"51-creating-subscriptions-recurring-billing-through-the-gerencianet-integration-ap"},"5.1. Creating subscriptions (recurring billing) through the Gerencianet integration AP"),Object(c.b)("br",null),Object(c.b)("iframe",{width:"560",height:"315",src:"https://www.youtube.com/embed/xrRUBi6wG2Y",frameborder:"0",allowfullscreen:!0}),Object(c.b)("br",null),Object(c.b)("br",null),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.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"})))),"Complete Course on Integration with the Gerencianet API ")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"For access to other classes, on other subjects, access the page ",Object(c.b)("a",{href:"../CursosIntegracao/CursoOnline",title:"Link Interno"},"Integrations Online Course "),"."))),Object(c.b)("br",null),Object(c.b)("hr",null),Object(c.b)("h2",{id:"6-next-steps"},"6. Next steps"),Object(c.b)("p",null,"With the subscriptions created, it is important to know all the endpoints that can be used. Also, if you have any doubts about the subscription mechanism, see how it works. ")))}p.isMDXComponent=!0},250:function(e,n,t){"use strict";t.d(n,"a",(function(){return d})),t.d(n,"b",(function(){return m}));var a=t(0),r=t.n(a);function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?i(Object(t),!0).forEach((function(n){c(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function b(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t,a,r={},c=Object.keys(e);for(a=0;a<c.length;a++)t=c[a],n.indexOf(t)>=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)t=c[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=r.a.createContext({}),s=function(e){var n=r.a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},d=function(e){var n=s(e.components);return r.a.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},p=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,l=b(e,["components","mdxType","originalType","parentName"]),d=s(t),p=a,m=d["".concat(i,".").concat(p)]||d[p]||u[p]||c;return t?r.a.createElement(m,o(o({ref:n},l),{},{components:t})):r.a.createElement(m,o({ref:n},l))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var c=t.length,i=new Array(c);i[0]=p;var o={};for(var b in n)hasOwnProperty.call(n,b)&&(o[b]=n[b]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var l=2;l<c;l++)i[l]=t[l];return r.a.createElement.apply(null,i)}return r.a.createElement.apply(null,t)}p.displayName="MDXCreateElement"},254:function(e,n,t){"use strict";function a(e){var n,t,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]&&(t=a(e[n]))&&(r&&(r+=" "),r+=t);else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}n.a=function(){for(var e,n,t=0,r="";t<arguments.length;)(e=arguments[t++])&&(n=a(e))&&(r&&(r+=" "),r+=n);return r}},255:function(e,n,t){"use strict";var a=t(0);const r=Object(a.createContext)({tabGroupChoices:{},setTabGroupChoices:()=>{},isAnnouncementBarClosed:!1,closeAnnouncementBar:()=>{}});n.a=r},256:function(e,n,t){"use strict";var a=t(0),r=t(255);n.a=function(){return Object(a.useContext)(r.a)}},257:function(e,n,t){"use strict";var a=t(0),r=t.n(a),c=t(256),i=t(254),o=t(92),b=t.n(o);const l=37,s=39;n.a=function(e){const{block:n,children:t,defaultValue:o,values:d,groupId:u}=e,{tabGroupChoices:p,setTabGroupChoices:m}=Object(c.a)(),[j,O]=Object(a.useState)(o);if(null!=u){const e=p[u];null!=e&&e!==j&&d.some(n=>n.value===e)&&O(e)}const g=e=>{O(e),null!=u&&m(u,e)},h=[];return r.a.createElement("div",null,r.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(i.a)("tabs",{"tabs--block":n})},d.map(({value:e,label:n})=>r.a.createElement("li",{role:"tab",tabIndex:"0","aria-selected":j===e,className:Object(i.a)("tabs__item",b.a.tabItem,{"tabs__item--active":j===e}),key:e,ref:e=>h.push(e),onKeyDown:e=>((e,n,t)=>{switch(t.keyCode){case s:((e,n)=>{const t=e.indexOf(n)+1;e[t]?e[t].focus():e[0].focus()})(e,n);break;case l:((e,n)=>{const t=e.indexOf(n)-1;e[t]?e[t].focus():e[e.length-1].focus()})(e,n)}})(h,e.target,e),onFocus:()=>g(e),onClick:()=>g(e)},n))),r.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(t).filter(e=>e.props.value===j)[0]))}},258:function(e,n,t){"use strict";var a=t(0),r=t.n(a);n.a=function(e){return r.a.createElement("div",null,e.children)}}}]);