-
Notifications
You must be signed in to change notification settings - Fork 0
/
6fa5cdce.37fb79fd.js
1 lines (1 loc) · 110 KB
/
6fa5cdce.37fb79fd.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[69,63],{169:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return o})),n.d(t,"metadata",(function(){return s})),n.d(t,"Highlight",(function(){return d})),n.d(t,"rightToc",(function(){return u})),n.d(t,"default",(function(){return p}));var a=n(2),c=n(6),r=(n(0),n(250)),b=n(93),i=n(257),l=n(258),o={id:"PagamentoCartao",title:"Paying with Credit Card",hide_title:!0,sidebar_label:"Paying with Credit Card"},s={id:"PagamentoCartao/PagamentoCartao",isDocsHomePage:!1,title:"Paying with Credit Card",description:"Paying with Credit Card",source:"@site/docs\\PagamentoCartao\\PagamentoCartao.md",permalink:"/documentation/docs/PagamentoCartao/PagamentoCartao",sidebar_label:"Paying with Credit Card",sidebar:"someSidebar",previous:{title:"Outros endpoints",permalink:"/documentation/docs/PagamentoBoleto/EndpointsBoletos"},next:{title:"Outros endpoints",permalink:"/documentation/docs/PagamentoCartao/EndpointsCartao"}},d=function(e){var t=e.children;e.color;return Object(r.b)("span",{style:{borderRadius:"2px",color:"#009615",padding:"0.2rem"}},t)},u=[{value:"1. Creating <em>One Step</em> transaction",id:"1-creating-one-step-transaction",children:[{value:"1.1. Obtaining the payment_token",id:"11-obtaining-the-payment_token",children:[]},{value:"a) Get the "payment_token" ( getPaymentToken ):",id:"a-get-the-payment_token--getpaymenttoken-",children:[]},{value:"b) Getting information about installments ( getInstallments ):",id:"b-getting-information-about-installments--getinstallments-",children:[]},{value:"c) Attributes related to sending card data:",id:"c-attributes-related-to-sending-card-data",children:[]},{value:"1.2. Paying with card",id:"12-paying-with-card",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. Creating a Credit Card Transaction in Two Steps",id:"2-creating-a-credit-card-transaction-in-two-steps",children:[{value:"2.1. Creating transaction",id:"21-creating-transaction",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 create a transaction:",id:"b-attributes-that-can-be-used-to-create-a-transaction-1",children:[]},{value:"2.2. Associate with the card payment method",id:"22-associate-with-the-card-payment-method",children:[]},{value:"2.3. Obtaining the payment_token",id:"23-obtaining-the-payment_token",children:[]},{value:"a) Getting a "payment_token" ( getPaymentToken ):",id:"a-getting-a-payment_token--getpaymenttoken-",children:[]},{value:"b) Getting information about installments ( getInstallments ):",id:"b-getting-information-about-installments---getinstallments-",children:[]},{value:"c) Attributes related to sending card data:",id:"c-attributes-related-to-sending-card-data-1",children:[]},{value:"2.4. Paying with credit card",id:"24-paying-with-credit-card",children:[]},{value:"a) Hierarchical structure of Schema attributes that can be used in the requisition:",id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used-in-the-requisition",children:[]},{value:"b) Attributes related to credit card payment:",id:"b-attributes-related-to-credit-card-payment",children:[]}]},{value:"3. Other endpoints",id:"3-other-endpoints",children:[]},{value:"4. Videos: Creating transaction and paying via credit card",id:"4-videos-creating-transaction-and-paying-via-credit-card",children:[{value:"4.1. Creating transaction via Playground (test environment/sandbox)",id:"41-creating-transaction-via-playground-test-environmentsandbox",children:[]},{value:"4.2. Defining payment method by Credit Card (via Playground)",id:"42-defining-payment-method-by-credit-card-via-playground",children:[]},{value:"4.3. Creating a transaction by integration - Payment by Credit Card",id:"43-creating-a-transaction-by-integration---payment-by-credit-card",children:[]}]}],m={Highlight:d,rightToc:u};function p(e){var t=e.components,n=Object(c.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},m,n,{components:t,mdxType:"MDXLayout"}),Object(r.b)("h1",{className:"titulo"},"Paying with Credit Card"),Object(r.b)("div",{className:"subtitulo"},Object(r.b)("p",null,"We currently offer two procedures to create a credit card transaction, in the first one the title is created in a single step, thus being conventionally ",Object(r.b)("em",{parentName:"p"},"One Step"),". The second option to create the transaction takes place in two steps, thus being called ",Object(r.b)("em",{parentName:"p"},"Two Steps"),". Both are detailed below: "),Object(r.b)("ol",null,Object(r.b)("li",{parentName:"ol"},Object(r.b)("p",{parentName:"li"},Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"#1-creating-one-step-transaction"}),"Creating ",Object(r.b)("em",{parentName:"a"},"One Step")," transaction"),".")),Object(r.b)("li",{parentName:"ol"},Object(r.b)("p",{parentName:"li"},Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"#2-creating-a-credit-card-transaction-in-two-steps"}),"Creating ",Object(r.b)("em",{parentName:"a"},"Two Steps")," transaction"),"."))),Object(r.b)("h2",{id:"1-creating-one-step-transaction"},"1. Creating ",Object(r.b)("em",{parentName:"h2"},"One Step")," transaction"),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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"})))),"important")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"For the ",Object(r.b)("em",{parentName:"p"},"One Step")," transaction to occur, it is normally necessary to update your SDK. All the files necessary for this are available in our ",Object(r.b)("a",{href:"https://github.com/gerencianet"},"github repository")," and in our documentation."))),Object(r.b)("p",null,"In the credit card transactions, a step prior to creation will be carried out where the card data is transmitted (",Object(r.b)("strong",{parentName:"p"},"via JavaScript"),", in the browser), in a secure way, off the card data and and returning a ",Object(r.b)("code",null,"payment_token"),", and in the second step your ",Object(r.b)("em",{parentName:"p"},"backend")," sends the rest of the transaction information and the",Object(r.b)("code",null,"payment_token")," obtained in the first step. "),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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"})))),"important")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"It's important to emphasize that ",Object(r.b)("strong",{parentName:"p"},"it is not possible to pay by credit card without the")," ",Object(r.b)("inlineCode",{parentName:"p"},"payment_token")," of the transaction, therefore, it is essential to execute the procedures in ",Object(r.b)("br",null),Object(r.b)("inlineCode",{parentName:"p"},"item 1.1")," of this document (obtaining the ",Object(r.b)("inlineCode",{parentName:"p"},"payment_token"),"), and ",Object(r.b)("strong",{parentName:"p"},"only after")," move on to item 1.2 (which is properly the card payment)."))),Object(r.b)("h3",{id:"11-obtaining-the-payment_token"},"1.1. Obtaining the payment_token"),Object(r.b)("p",null,"Let's do the first step, which is obtaining the ",Object(r.b)("code",null,"payment_token"),". To do so, you will need a JavaScript code specific to your Gerencianet account. To generate it, follow the steps: "),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("a",{href:"https://usuario.gerencianet.com.br/login",target:"_blank"},"Log in")," your Gerencianet account and access",Object(r.b)("code",null,'"Minha Conta"')," (top right corner)"),Object(r.b)("li",{parentName:"ul"},"Copy the ",Object(r.b)("code",null,'"Identificador de Conta"')," (",Object(r.b)("a",{href:"https://s3.amazonaws.com/gerencianet-pub-prod-1/printscreen/2020/07/24/matheus.rodrigues/b66b15-d2201967-d646-4988-8e39-cffae37df203.png",target:"_blank"},"see how"),")"),Object(r.b)("li",{parentName:"ul"},"Paste in the field below and click the button ",Object(r.b)("inlineCode",{parentName:"li"},"Gerar"))),Object(r.b)(b.default,{mdxType:"AccountIdentifier"}),Object(r.b)("br",null),Object(r.b)("p",null,"It's important to make sure that the card data is obtained via ",Object(r.b)("strong",{parentName:"p"},"JavaScript"),", in the browser, in a secure way, and the return of the ",Object(r.b)("inlineCode",{parentName:"p"},"payment_token"),", which is the representation of the data tha was sent. "),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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"})))),"important")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"Remember that, after informing your account identifier, 2 (two) distinct JavaScript codes will be generated."),Object(r.b)("p",{parentName:"div"},"Copy and use the code referring to the environment that is going to be used, paying attention to the differences between the ",Object(r.b)("em",{parentName:"p"},'"Homologation"')," and ",Object(r.b)("em",{parentName:"p"},'"Production"')," environments. "))),Object(r.b)("p",null,"For web applications, you must copy the script above, specific to your account, and use our Javascript library, as per the ",Object(r.b)("em",{parentName:"p"},"snippet")," below. If you have a mobile app, check out how to proceed by accessing our GitHub page to ",Object(r.b)("a",{href:"https://github.com/gerencianet/gn-api-sdk-android",target:"_blank"},"Android")," and/or ",Object(r.b)("a",{href:"https://github.com/gerencianet/gn-api-sdk-ios",target:"_blank"},"iOS"),"."),Object(r.b)("p",null,"In addition, we explain that a Gerencianet account doesn't have a ",Object(r.b)("code",null,"payment_token")," - it is different and created for each charge generated by credit card. It represents the payer's card data and is obtained by the ",Object(r.b)("code",null,"getPaymentToken")," function. In addition, it should be noted that the ",Object(r.b)("code",null,"payment_token")," can be used only once, therefore, it is not possible to use it to charge on a recurring basis."),Object(r.b)("br",null),Object(r.b)("h3",{id:"a-get-the-payment_token--getpaymenttoken-"},'a) Get the "payment_token" ( getPaymentToken ):'),Object(r.b)(i.a,{defaultValue:"code",values:[{label:"C\xf3digo",value:"code"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"code",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"$gn.ready(function(checkout) {\n \n var callback = function(error, response) {\n if(error) {\n // Handles the error that occurred\n console.error(error);\n } else {\n // Treat the answer\n console.log(response);\n }\n };\n \n checkout.getPaymentToken({\n brand: 'visa', // card brand\n number: '4012001038443335', // card number\n cvv: '123', // security code\n expiration_month: '05', // expiration month\n expiration_year: '2021' // expiration year\n }, callback);\n \n});\n")))),Object(r.b)("br",null),Object(r.b)("h3",{id:"b-getting-information-about-installments--getinstallments-"},"b) Getting information about installments ( getInstallments ):"),Object(r.b)(i.a,{defaultValue:"code",values:[{label:"C\xf3digo",value:"code"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"code",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"$gn.ready(function(checkout){\n \n checkout.getInstallments(50000,'visa', function(error, response){\n if(error) {\n // Handles the error that occurred\n console.log(error);\n } else {\n // Insert the installment on the website\n }\n });\n \n});\n")))),Object(r.b)("br",null),Object(r.b)("h3",{id:"c-attributes-related-to-sending-card-data"},"c) Attributes related to sending card data:"),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"$gn.ready ( callback )")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Parameter"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"callback")),Object(r.b)("td",{align:"left"},"Initialization function that makes it possible to call functions ",Object(r.b)("em",null,"getPaymentToken")," and ",Object(r.b)("em",null,"getInstallments"),". ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Callback parameter(s):"),Object(r.b)("br",null),Object(r.b)("code",null,"object"),"// Object that receives instances of other functions."),Object(r.b)("td",{align:"center"},"Function")))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"getPaymentToken ( card_data, callback )")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Parameter"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"card_data")),Object(r.b)("td",{align:"left"},"Object that contains card data. ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"The properties of this object are:"),Object(r.b)("br",null),Object(r.b)("code",null,"brand"),"// Card brand ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"number"),"// Card number",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"cvv"),"// Card security code ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"expiration_month"),'// Expiration month of the card in "MM" format',Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"expiration_year"),'// Card expiry year in "YYYY" format'),Object(r.b)("td",{align:"center"},"Object")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"callback")),Object(r.b)("td",{align:"left"},"Function that receives the response from Gerencianet.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Callback parameter(s):"),Object(r.b)("br",null),Object(r.b)("code",null,"error"),"// If it wasn't possible to generate the payment_token, errors will be returned in this parameter. ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"response"),"// Receives the data representing the credit card: payment_token e card_mask",Object(r.b)("br",null),Object(r.b)("br",null)),Object(r.b)("td",{align:"center"},"Function")))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"getInstallments ( total, brand, callback )")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Parameter"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"total")),Object(r.b)("td",{align:"left"},"Total billing amount, including shipping, in cents.",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"For example: R$ 230,90 is equivalent to 23090.")),Object(r.b)("td",{align:"center"},"Integer")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"brand")),Object(r.b)("td",{align:"left"},"Card brand that you want to obtain the amounts of installments.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Possible values:"),Object(r.b)("br",null),Object(r.b)("code",null,"visa"),"// Visa brand",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"mastercard"),"// MasterCard brand",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"amex"),"// AmericanExpress brand",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"elo"),"// Elo brand",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"hipercard"),"//Hipercard brand"),Object(r.b)("td",{align:"center"},"String")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"callback")),Object(r.b)("td",{align:"left"},"Function that receives the response from Gerencianet.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Callback parameter(s):"),Object(r.b)("br",null),Object(r.b)("code",null,"error"),"// If payment data could not be obtained, errors will be returned in this parameter.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"response"),"//Receives data related to the type of payment consulted."),Object(r.b)("td",{align:"center"},"Function")))),Object(r.b)("br",null),Object(r.b)("h3",{id:"12-paying-with-card"},"1.2. Paying with card"),Object(r.b)("p",null,"Now that the ",Object(r.b)("code",null,"payment_token")," has already been obtained through the Javascript code of the first step, let's proceed with the credit card payment."),Object(r.b)("p",null,"In this step, your ",Object(r.b)("em",{parentName:"p"},"backend")," sends the rest of the transaction information and the ",Object(r.b)("code",null,"payment_token")," obtained in the first step."),Object(r.b)("p",null,"When paying for a transaction by credit card, the status changes from ",Object(r.b)("code",null,"new")," to ",Object(r.b)("code",null,"waiting"),". This means that the transaction is associated with a payment method and is waiting for payment confirmation."),Object(r.b)("p",null,"Once the payment is confirmed, the transaction status will change from ",Object(r.b)("code",null,"waiting")," to ",Object(r.b)("code",null,"paid"),". But if for some reason the payment cannot be confirmed, the status will change to ",Object(r.b)("code",null,"unpaid"),"."),Object(r.b)("p",null,"The example below shows how this can be done, using the SDK's available:"),Object(r.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(r.b)(l.a,{value:"php",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-php"}),"<?php\n\nrequire __DIR__.'/../../autoload.php'; //SDK Path\n\nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n\n$clientId = 'informe_seu_client_id'; // enter your Client_Id, depending on the environment (Des or Prod)\n$clientSecret = 'informe_seu_client_secret'; // enter your Client_Secret, depending on the environment (Des or Prod)\n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // change according to the environment (true = development and false = production)\n\n$paymentToken = 'InsiraAquiUmPayeementeCode'; // payment_token obtained in the 1st step (through single Javascript per Gerencianet account)\n\n$item_1 = [\n 'name' => 'Item 1', \n 'amount' => 1, \n 'value' => 3000 \n];\n$items = [\n $item_1\n];\n$metadata = array('notification_url'=>'https://SuaUrl/16rpx6y1');\n$customer = [\n 'name' => 'Gorbadoc Oldbuck', \n 'cpf' => '04267484171', \n 'phone_number' => '5144916523', \n 'email' => '[email protected]', \n 'birth' => '1977-01-15' \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$discount = [\n 'type' => 'currency',\n 'value' => 599\n];\n$configurations = [\n 'fine' => 200,\n 'interest' => 33\n];\n$credit_card = [\n 'customer' => $customer,\n 'installments' => 1, // number of installments into which the payment must be divided\n 'discount' =>$discount,\n 'billing_address' => $billingAddress,\n 'payment_token' => $paymentToken,\n 'message' => 'teste\\nteste\\nteste\\nteste'\n];\n$payment = [\n 'credit_card' => $credit_card // form of payment (credit_card = cart\xe3o)\n];\n$body = [\n 'items' => $items,\n 'metadata' =>$metadata,\n 'payment' => $payment\n];\ntry {\n $api = new Gerencianet($options);\n $pay_charge = $api->oneStep([],$body);\n echo '<pre>';\n print_r($pay_charge);\n echo '<pre>';\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(r.b)(l.a,{value:"python",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\u200b\nfrom gerencianet import Gerencianet\nfrom credentials import CREDENTIALS\n\u200b\ngn = Gerencianet(CREDENTIALS)\n\u200b\nbody = {\n 'items': [{\n 'name': \"Product 1\",\n 'value': 1000,\n 'amount': 2\n }],\n 'shippings': [{\n 'name': \"Default Shipping Cost\",\n 'value': 100\n }],\n 'payment': {\n 'credit_card': {\n 'installments': 1,\n 'payment_token': \"5cffb658d047093b3fbdf7eff8c434c3d26a4bd1\",\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': \"94271564656\",\n 'birth': \"1977-01-15\",\n 'phone_number': \"5144916523\"\n }\n }\n }\n}\n\u200b\nresponse = gn.create_charge_onestep(params=None, body=body)\nprint(response)\n"))),Object(r.b)(l.a,{value:"js",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\u200b\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\u200b\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n}\n\u200b\nvar body = {\n\u200b\n payment: {\n credit_card: {\n installments: 1,\n payment_token: '83d52dbd590d9ebc991938c711ddd31f65df89a5',\n billing_address: {\n street: 'Street 3',\n number: 10,\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: '94271564656',\n birth: '1977-01-15',\n phone_number: '5144916523'\n }\n }\n },\n\u200b\n items: [{\n name: 'Product 1',\n value: 1000,\n amount: 2\n }],\n shippings: [{\n name: 'Default Shipping Cost',\n value: 100\n }]\n}\n\u200b\nvar gerencianet = new Gerencianet(options);\n\u200b\ngerencianet\n .oneStep([], body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(r.b)(l.a,{value:"c",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class OneStep\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var body = new\n {\n items = new[] {\n new {\n name = "Product 1",\n value = 590,\n amount = 2\n }\n },\n shippings = new[] {\n new {\n name = "Default Shipping Cost",\n value = 10\n }\n },\n payment = new\n {\n credit_card = new\n {\n installments = 1,\n payment_token = "7d0a3fe0f0c9caab4f3b6578317a9d7e8ed6303f",\n billing_address = new\n {\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 {\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\n try\n {\n var response = endpoints.OneStep(null, 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(r.b)(l.a,{value:"java",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-java"}),'package br.com.gerencianet.charge.json;\n\nimport java.util.HashMap;\n\nimport org.json.JSONArray;\nimport org.json.JSONObject;\n\nimport br.com.gerencianet.Credentials;\nimport br.com.gerencianet.gnsdk.Gerencianet;\nimport br.com.gerencianet.gnsdk.exceptions.GerencianetException;\n\npublic class OneStepCard {\n public static void main(String[] args) {\n /* ********* Set credentials parameters ******** */\n Credentials credentials = new Credentials();\n JSONObject options = new JSONObject();\n options.put("client_id", credentials.getClientId());\n options.put("client_secret", credentials.getClientSecret());\n //options.put("partner_token", credentials.getPartnerToken());\n options.put("sandbox", credentials.isSandbox());\n /* ************************************************* */ \n \n String paymentToken = "32add25a335ff3f588e42055486b3156253b7b75";\n \n // items\n JSONArray items = new JSONArray();\n JSONObject item1 = new JSONObject();\n item1.put("name", "Item 1");\n item1.put("amount", 1);\n item1.put("value", 600);\n JSONObject item2 = new JSONObject("{\\"name\\":\\"Item 2\\", \\"amount\\":1, \\"value\\":1000}");\n items.put(item1);\n items.put(item2);\n \n //customer\n JSONObject customer = new JSONObject();\n customer.put("name", "Gorbadoc Oldbuck");\n customer.put("cpf", "94271564656");\n customer.put("phone_number", "5144916523");\n customer.put("email", "[email protected]");\n customer.put("birth", "1990-05-04");\n \n // endere\xe7o do comprador\n JSONObject billingAddress = new JSONObject();\n billingAddress.put("street", "Av. JK");\n billingAddress.put("number", 909);\n billingAddress.put("neighborhood", "Bauxita");\n billingAddress.put("zipcode", "35400000");\n billingAddress.put("city", "Ouro Preto");\n billingAddress.put("state", "MG");\n \n //URL de notifica\xe7\xf5es\n JSONObject metadata = new JSONObject();\n metadata.put("notification_url", "https://SuaUrl/16rpx6y1");\n metadata.put("custom_id", "Id_0007");\n \n //desconto \n JSONObject discount = new JSONObject();\n discount.put("type","currency");\n discount.put("value",599);\n \n \n JSONObject creditCard = new JSONObject();\n creditCard.put("installments", 1);\n creditCard.put("billing_address", billingAddress);\n creditCard.put("payment_token", paymentToken);\n creditCard.put("customer", customer);\n creditCard.put("discount", discount);\n\n JSONObject payment = new JSONObject();\n payment.put("credit_card", creditCard);\n\n JSONObject body = new JSONObject();\n body.put("payment", payment);\n body.put("items", items);\n body.put("metadata", metadata);\n \n try {\n Gerencianet gn = new Gerencianet(options);\n JSONObject response = gn.call("oneStep", new HashMap<String,String>(), body);\n System.out.println(response);\n }catch (GerencianetException e){\n System.out.println(e.getCode());\n System.out.println(e.getError());\n System.out.println(e.getErrorDescription());\n }\n catch (Exception e) {\n System.out.println(e.getMessage());\n }\n }\n}\n'))),Object(r.b)(l.a,{value:"go",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-go"}),'package main\n\u200b\nimport (\n "fmt"\n "github.com/dmalberto/gn-api-sdk-go/gerencianet"\n "../configs"\n)\n\u200b\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\u200b\n paymentToken := "428d7f3b2dc49117552ace464078557832c4ae4f";\n\u200b\n customer := map[string]interface{}{\n "name": "Gorbadoc Oldbuck",\n "cpf": "04267484171",\n "phone_number": "51944916523",\n "email": "[email protected]",\n "birth": "1977-01-15",\n }\n\u200b\n billingAddress := map[string]interface{} {\n "street": "Av JK",\n "number": 909,\n "neighborhood": "Bauxita",\n "zipcode": "35400000",\n "city": "Ouro Preto",\n "state": "MG",\n }\n\u200b\n body := map[string]interface{} {\n "payment": map[string]interface{} {\n "credit_card": map[string]interface{} {\n "installments": 1,\n "billing_address": billingAddress,\n "payment_token": paymentToken,\n "customer": customer,\n },\n },\n "items": []map[string]interface{}{\n {\n "name": "Product 1",\n "value": 1000,\n "amount": 2,\n },\n },\n "shippings": []map[string]interface{} {\n {\n "name": "Default Shipping Cost",\n "value": 100,\n },\n },\n }\n\u200b\n res, err := gn.CreateChargeOneStep(body) // no lugar do 1 coloque o charge_id certo\n\u200b\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(r.b)(l.a,{value:"ruby",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire_relative "./credentials"\n\u200b\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\u200b\nbody = {\n items: [{\n name: "Product 1",\n value: 1000,\n amount: 2\n }],\n shippings: [{\n name: "Default Shipping Cost",\n value: 100\n }],\n payment: {\n credit_card: {\n installments: 1,\n payment_token: "6426f3abd8688639c6772963669bbb8e0eb3c319",\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: "94271564656",\n birth: "1977-01-15",\n phone_number: "5144916523"\n }\n }\n }\n}\n\u200b\ngerencianet = Gerencianet.new(options)\nputs gerencianet.create_charge_onestep(body: body)\n'))),Object(r.b)(l.a,{value:"delphi",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),"interface\n\nfunction PayOneStepWithCard: String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nvar\n Body: String;\nbegin\n Body :=\n '{'+\n '\"items\": ['+\n '{'+\n '\"name\": \"Product 1\",'+\n '\"value\": 590,'+\n '\"amount\": 2'+\n '}'+\n '],'+\n '\"shippings\": ['+\n '{'+\n '\"name\": \"Default Shipping Cost\",'+\n '\"value\": 10'+\n '}'+\n '],'+\n '\"payment\": {'+\n '\"credit_card\": {'+\n '\"installments\": 1,'+\n '\"payment_token\": \"InsiraAquiOPayment_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 '\"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 Result := ExecuteGerenciaNetRequest( 'payOneStep','','',Body );\n")))),Object(r.b)("br",null),Object(r.b)("h3",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used"},"a) Hierarchical structure of Schema attributes that can be used:"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{}),'"items"\n "name"\n "value"\n "amount"\n "marketplace"\n "payee_code"\n "percentage"\n"shippings"\n "name"\n "value"\n "payee_code"\n"metadata"\n "custom_id"\n "notification_url"\n"payment"\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 "installments"\n "discount"\n "type"\n "percentage",\n "currency"\n "value"\n "billing_address"\n "street"\n "number"\n "neighborhood"\n "zipcode"\n "city"\n "complement"\n "state"\n "payment_token"\n "message"\n')),Object(r.b)("br",null),Object(r.b)("h3",{id:"b-attributes-that-can-be-used-to-create-a-transaction"},"b) Attributes that can be used to create a transaction:"),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Attribute"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Required"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"items")),Object(r.b)("td",{align:"left"},"item being sold. The same transaction can have unlimited items. ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Items attributes:"),Object(r.b)("br",null),Object(r.b)("code",null,"name*"),"// Name of the item, product or service. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Minimum of 1 character and maximum of 255 characters (String)."),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"value*"),"// Value, in cents of real. Example: R$ 10,00 = 1000. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Integer"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"amount"),"// Amount. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Integer")),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"Array")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"shippings")),Object(r.b)("td",{align:"left"},"Determines the shipping amount(s) for a transaction. The same transaction can have unlimited shipping values. ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Shippings attributes:"),Object(r.b)("br",null),Object(r.b)("code",null,"name*"),"// Shipping label ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"M\xe1ximo de 255 caracteres. String."),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"value*"),"// Shipping value, in cents of real (1990 is equivalent to R$19,90). ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Integer")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Array")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"metadata")),Object(r.b)("td",{align:"left"},"Define transaction-specific data",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Metadata attributes:"),Object(r.b)("br",null),Object(r.b)("code",null,"custom_id"),"// It allows associating 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(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 caracteres. String/null."),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"notification_url"),"// Address of your valid URL that will receive transaction status change notifications. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 caracteres. String/null.")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Object")))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"Object")," ",Object(r.b)("strong",{parentName:"p"},"Payment")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Attribute"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Required"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"credit_card")),Object(r.b)("td",{align:"left"},"Object containing the necessary information for credit card payment, such as the number of installments and customer data."),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"Object ",Object(r.b)("b",null,"Credit_Card"))))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"Object")," ",Object(r.b)("strong",{parentName:"p"},"Credit_Card")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Attribute"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Required"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"customer")),Object(r.b)("td",{align:"left"},"Payer's personal data.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Customer attributes:"),Object(r.b)("br",null),Object(r.b)("code",null,"name*")," // Payer's name ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"cpf*")," // Customer CPF (no dots, commas or hyphens).",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"email*")," // Customer's valid email address. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"phone_number*")," // Valid customer phone number, no special characters. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"birth*")," // Customer's Date of Birth (valid date in YYYY-MM-DD format). ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"address")," // Delivery address. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(Object)")," (more info)",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"juridical_person")," // Legal entity data.",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(Object)")," (more info)"),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"Object")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"installments")),Object(r.b)("td",{align:"left"},"Number of installments in which the payment must be divided. ",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Minimum 1 and maximum 12. Integer.")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Integer")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"discount")),Object(r.b)("td",{align:"left"},"Defines discount data about the billing.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Discount attributes:"),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"type*"),"// Discount type (String). Allowed values: ",Object(r.b)("br",null),Object(r.b)("code",null,"currency"),": the discount will be entered in Real cents. ",Object(r.b)("code",null,"percentage"),": the discount will be entered in percentage",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"cnpj*"),"//company's CNPJ. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Size: 14 caracteres. String."),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"value*"),"// Discount value (Integer). If the discount type is ",Object(r.b)("code",null,"currency")," , the value of this tag must be informed by the developer in cents of real (that is, 500 is equivalent to R$ 5.00). If the discount type is ",Object(r.b)("code",null,"percentage"),", the value must be multiplied by 100 (that is 1500 is equivalent to 15%). Examples: ",Object(r.b)("br",null),"1)",Object(r.b)("code",null,"currency"),"// must be informed in cents of real, that is, if the discount will be R$ 5.99, the developer must inform ",Object(r.b)("code",null,"599"),";",Object(r.b)("br",null)," 2)",Object(r.b)("code",null,"percentage")," // must be informed in cents of real, that is, if the discount is 15%, the developer must inform ",Object(r.b)("code",null,"1500"),".",Object(r.b)("br",null),Object(r.b)("br",null)),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Object")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"billing_address")),Object(r.b)("td",{align:"left"},"Billing address (more info)",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"billing_address attributes:"),Object(r.b)("br",null),Object(r.b)("code",null,"street*"),"// street name ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(Object)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"number*"),"// number ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String/Integer)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"neighborhood*"),"// Neighborhood ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"zipcode*"),"// zipcode (no dots or hyphen) ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"city*"),"// City ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"complement"),"// Complement ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String/null)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"state*"),"// state (2 caracteres) ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(Object)")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Object")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"payment_token")),Object(r.b)("td",{align:"left"},"Unique payment token obtained in the first step of transaction generation."),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"String")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"message")),Object(r.b)("td",{align:"left"},'Allows you to include an "observation" in the billing, or in other words, a message to the customer. This message can be seen in the emails related to the billing, in the slip or carnet. ',Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Up to 4 lines containing 100 characters on each line. String. ",Object(r.b)("br",null),"The operator ",Object(r.b)("code",null,"\\n"),"is used to perform the line break. ")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"String")))),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"Fields with * represents required attributes")),Object(r.b)("br",null),Object(r.b)("h2",{id:"2-creating-a-credit-card-transaction-in-two-steps"},"2. Creating a Credit Card Transaction in Two Steps"),Object(r.b)("p",null,"In this option, it is necessary that the ",Object(r.b)("em",{parentName:"p"},"body")," of the request has all the minimum attributes required to create the charge.\nBelow are implementation examples using the available SDK's:"),Object(r.b)("p",null,"2.1. ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"#21-creating-transaction"}),"Create the transaction"),", informing the item/product/service, value, quantity, etc;"),Object(r.b)("p",null,"2.2. ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"#22-associate-with-the-card-payment-method"}),"Associate with the payment method: card "),", informing the ",Object(r.b)("code",null,"charge_id")," of the transaction created and the customer data; "),Object(r.b)("p",null," 2.3. ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"#23-obtaining-the-payment_token"}),"Getting the payment_token")," (via JavaScript, unique per transaction);"),Object(r.b)("p",null," 2.4. ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"#24-paying-with-credit-card"}),"Paying with card"),"."),Object(r.b)("p",null,"As it is a payment via card and involves sensitive data, such as credit card data, the procedures described in items 3.1 and 3.2, that is, obtaining the ",Object(r.b)("code",null,"payment_token")," and paying by card, respectively, ",Object(r.b)("strong",{parentName:"p"},"are necessary"),"."),Object(r.b)("p",null,"The rest of this page has the detailed procedures, but you need to install one of our libraries on your server to run the sample code. ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"../Instalacao/introducao"}),"Make sure that the Gerencianet SDK has been installed"),"."),Object(r.b)("hr",null),Object(r.b)("h3",{id:"21-creating-transaction"},"2.1. Creating transaction"),Object(r.b)("p",null,'First, we need to generate the transaction (also called "charge"). It is at this moment that the name of the item/product/service, transaction value, quantity, among other possible information will be informed.'),Object(r.b)("p",null,"After creating it, the ",Object(r.b)("code",null,"charge_id")," will be returned, which is the unique identifier of the transaction and will be used to associate the payment method."),Object(r.b)("p",null,"As soon as this transaction is created, it receives the status ",Object(r.b)("code",null,"new"),", which means that the charge has been generated and is awaiting definition of the payment method. This charge will only change its status when the integrator defines your payment method."),Object(r.b)("p",null,"To generate a transaction, you must send a request ",Object(r.b)("code",null,"POST")," to the route ",Object(r.b)("code",null,"/v1/charge"),"."),Object(r.b)("p",null,"If you want, you can explore and learn more about this feature ",Object(r.b)("a",{href:"../AmbienteTestes/PlaygroundTransacoes#post-v1charge",target:"_blank"},"using our Playground"),"."),Object(r.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(r.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(r.b)(l.a,{value:"php",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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\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\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\ntry {\n $api = new Gerencianet($options);\n $charge = $api->createCharge([], $body);\n \n print_r($charge);\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(r.b)(l.a,{value:"python",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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 'items': [{\n 'name': \"Product 1\",\n 'value': 1000,\n 'amount': 2\n }],\n 'shippings': [{\n 'name': \"Default Shipping Cost\",\n 'value': 100\n }]\n}\n \ngn.create_charge(body=body)\n"))),Object(r.b)(l.a,{value:"js",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n \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 items: [{\n name: 'Product 1',\n value: 1000,\n amount: 2\n }],\n shippings: [{\n name: 'Default Shipping Cost',\n value: 100\n }]\n}\n \nvar gerencianet = new Gerencianet(options);\n \ngerencianet\n .createCharge({}, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(r.b)(l.a,{value:"c",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'dynamic endpoints = new Endpoints("client_id", "client_secret", true);\n \nvar body = new\n{\n items = new[] {\n new {\n name = "Product 1",\n value = 1000,\n amount = 2\n }\n },\n shippings = new[] {\n new {\n name = "Default Shipping Cost",\n value = 100\n }\n }\n};\n \nvar response = endpoints.CreateCharge(null, body);\nConsole.WriteLine(response);\n'))),Object(r.b)(l.a,{value:"java",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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/charge/json/CreateCharge.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/charge/map/CreateCharge.java\n\n*/\n'))),Object(r.b)(l.a,{value:"go",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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 "shippings": []map[string]interface{} {\n {\n "name": "Default Shipping Cost",\n "value": 100,\n },\n },\n }\n\n res, err := gn.CreateCharge(body)\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(r.b)(l.a,{value:"ruby",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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\nbody = {\n items: [{\n name: "Product 1",\n value: 1000,\n amount: 2\n }],\n shippings: [{\n name: "Default Shipping Cost",\n value: 100\n }]\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.create_charge(body: body)\n'))),Object(r.b)(l.a,{value:"delphi",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction CreateCharge: String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction CreateCharge: String;\nvar \nBody : String;\n\nbegin \n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize(); \n\n Body := \n '{'+\n '\"items\":'+\n '['+\n '{'+\n '\"name\":\"test article\",'+\n '\"value\":1900,'+\n '\"amount\":2'+\n '},'+\n '{'+\n '\"name\":\"test article 2\",'+\n '\"value\":3000,'+\n '\"amount\":1'+\n '}'+\n ']'+\n '}';\n\n Result := ExecuteGerenciaNetRequest( 'createCharge','','',Body );\nend;\n")))),Object(r.b)("br",null),Object(r.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(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{}),'"id": "/Charge"\n "items"\n "name"\n "value"\n "amount"\n "marketplace"\n "payee_code"\n "percentage"\n "shippings"\n "name"\n "value"\n "payee_code"\n "metadata"\n "custom_id"\n "notification_url"\n')),Object(r.b)("br",null),Object(r.b)("h3",{id:"b-attributes-that-can-be-used-to-create-a-transaction-1"},"b) Attributes that can be used to create a transaction:"),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Attribute"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Required"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"items")),Object(r.b)("td",{align:"left"},"item being sold. The same transaction can have unlimited items.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Item attributes:"),Object(r.b)("br",null),Object(r.b)("code",null,"name*"),"// Name of the item, product or service. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Minimum of 1 character and maximum of 255 characters (String)."),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"value*"),"// Value, in Real cents. Ex: R$ 10,00 = 1000. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Integer"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"amount"),"// amount ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Integer")),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"Array")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"shippings")),Object(r.b)("td",{align:"left"},"Determines the shipping amount(s) for a transaction. The same transaction can have unlimited shipping values. ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Shippings attributes:"),Object(r.b)("br",null),Object(r.b)("code",null,"name*"),"// Shipping label. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 caracteres. String."),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"value*"),"// Shipping value, in Real cents (1990 is equivalent to R$19.90).",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Integer")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Array")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"metadata")),Object(r.b)("td",{align:"left"},"Define transaction-specific data ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Metadata attributes:"),Object(r.b)("br",null),Object(r.b)("code",null,"custom_id"),"// It allows associating 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(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 caracteres. String/null."),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"notification_url"),"// Address of your valid URL that will receive transaction status change notifications. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 characters. String/null.")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Object")))),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"Field wih * represent required values")),Object(r.b)("br",null),Object(r.b)("hr",null),Object(r.b)("h3",{id:"22-associate-with-the-card-payment-method"},"2.2. Associate with the card payment method"),Object(r.b)("p",null,"Once the transaction has been created, we will associate it with the payment method, which in this case will be a credit card. To do so, the ",Object(r.b)("code",null,"charge_id")," obtained in the previous consumption in which the transaction was generated must be informed. "),Object(r.b)("p",null,"In the case of credit card transactions, it will be carried out in two steps, the first is the transmission (",Object(r.b)("strong",{parentName:"p"},"via JavaScript"),", in the browser), in a secure way, of the card data and returning a ",Object(r.b)("code",null,"payment_token"),", and in the second step your ",Object(r.b)("em",{parentName:"p"},"backend")," sends the rest of the transaction information and the ",Object(r.b)("code",null,"payment_token")," obtained in the first step. "),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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"})))),"IMPORTANT - ABOUT THE PAYMENT_TOKEN")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"It is important to emphasize that ",Object(r.b)("strong",{parentName:"p"},"it is not possible to pay by credit card without obtaining the")," ",Object(r.b)("inlineCode",{parentName:"p"},"payment_token")," of the transaction, therefore, it is essential to carry out the procedures of ",Object(r.b)("strong",{parentName:"p"},"item 2.1")," of this document (obtaining the ",Object(r.b)("inlineCode",{parentName:"p"},"payment_token"),"), and only then move on to ",Object(r.b)("strong",{parentName:"p"},"item 2.2")," (which is trully the card payment). "))),Object(r.b)("p",null,"To associate the payment method, you must send a ",Object(r.b)("inlineCode",{parentName:"p"},"POST")," request to the ",Object(r.b)("inlineCode",{parentName:"p"},"/v1/charge/:id/pay")," route, where ",Object(r.b)("inlineCode",{parentName:"p"},":id")," is the ",Object(r.b)("inlineCode",{parentName:"p"},"charge_id")," of the transaction in the case. "),Object(r.b)("h3",{id:"23-obtaining-the-payment_token"},"2.3. Obtaining the payment_token"),Object(r.b)("p",null,"Initially, we will be doing the first step, which is to obtain the ",Object(r.b)("code",null,"payment_token"),". To do so, you will need a JavaScript code specific to your Gerencianet account. To generate it, follow the steps: "),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("a",{href:"https://usuario.gerencianet.com.br/login",target:"_blank"},"Log in")," your Gerencianet account and access ",Object(r.b)("code",null,"Minha Conta")," (top right corner)"),Object(r.b)("li",{parentName:"ul"},"Copy your ",Object(r.b)("code",null,'"Identificador de Conta"')," (",Object(r.b)("a",{href:"https://s3.amazonaws.com/gerencianet-pub-prod-1/printscreen/2020/07/24/matheus.rodrigues/b66b15-d2201967-d646-4988-8e39-cffae37df203.png",target:"_blank"},"see how"),")"),Object(r.b)("li",{parentName:"ul"},"Paste in the field below and click the button ",Object(r.b)("inlineCode",{parentName:"li"},"Generate"))),Object(r.b)(b.default,{mdxType:"AccountIdentifier"}),Object(r.b)("p",null,"It is important to emphasize that it is obtained via ",Object(r.b)("strong",{parentName:"p"},"JavaScript"),", in the browser, in a secure way, the card data and returns a ",Object(r.b)("inlineCode",{parentName:"p"},"payment_token"),", which is the representation of the sent data."),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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"})))),"important")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"Remember that, after informing your account identifier, 2 (two) distinct JavaScript codes will be generated."),Object(r.b)("p",{parentName:"div"},"Copy and use the code referring to the desired environment, paying attention to the differences between the ",Object(r.b)("em",{parentName:"p"},'"Development"')," and ",Object(r.b)("em",{parentName:"p"},'"Production"')," environments. "))),Object(r.b)("p",null,"For web applications, you must copy the script above, specific to your account, and use our Javascript library, as shown the ",Object(r.b)("em",{parentName:"p"},"snippet")," below. If you have a mobile app, check out how to proceed by accessing our GitHub page to ",Object(r.b)("a",{href:"https://github.com/gerencianet/gn-api-sdk-android",target:"_blank"},"Android")," or ",Object(r.b)("a",{href:"https://github.com/gerencianet/gn-api-sdk-ios",target:"_blank"},"iOS"),"."),Object(r.b)("p",null,"In addition, we clarify that a Gerencianet account does not have a ",Object(r.b)("code",null,"payment_token"),"- it is different and created for each generated charge by credit card. It represents the payer's card data and is obtained by the ",Object(r.b)("code",null,"getPaymentToken")," function. Besides that, it should be noted that the ",Object(r.b)("code",null,"payment_token")," can be used only once, therefore, it is not possible to use it to a recurrently charge. "),Object(r.b)("br",null),Object(r.b)("h3",{id:"a-getting-a-payment_token--getpaymenttoken-"},'a) Getting a "payment_token" ( getPaymentToken ):'),Object(r.b)(i.a,{defaultValue:"code",values:[{label:"C\xf3digo",value:"code"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"code",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"$gn.ready(function(checkout) {\n \n var callback = function(error, response) {\n if(error) {\n // Trata o erro ocorrido\n console.error(error);\n } else {\n // Trata a resposta\n console.log(response);\n }\n };\n \n checkout.getPaymentToken({\n brand: 'visa', // bandeira do cart\xe3o\n number: '4012001038443335', // n\xfamero do cart\xe3o\n cvv: '123', // c\xf3digo de seguran\xe7a\n expiration_month: '05', // m\xeas de vencimento\n expiration_year: '2021' // ano de vencimento\n }, callback);\n \n});\n")))),Object(r.b)("br",null),Object(r.b)("h3",{id:"b-getting-information-about-installments---getinstallments-"},"b) Getting information about installments ( getInstallments ):"),Object(r.b)(i.a,{defaultValue:"code",values:[{label:"C\xf3digo",value:"code"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"code",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"$gn.ready(function(checkout){\n \n checkout.getInstallments(50000,'visa', function(error, response){\n if(error) {\n // Trata o erro ocorrido\n console.log(error);\n } else {\n // Insere o parcelamento no site\n }\n });\n \n});\n")))),Object(r.b)("br",null),Object(r.b)("h3",{id:"c-attributes-related-to-sending-card-data-1"},"c) Attributes related to sending card data:"),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"$gn.ready ( callback )")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Parameter"),Object(r.b)("th",{align:"center"},"Descri\xe7\xe3o"),Object(r.b)("th",{align:"center"},"Tipo")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"callback")),Object(r.b)("td",{align:"left"},"Initialization function that makes it possible to call functions ",Object(r.b)("em",null,"getPaymentToken")," e ",Object(r.b)("em",null,"getInstallments"),". ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Par\xe2metro(s) de callback:"),Object(r.b)("br",null),Object(r.b)("code",null,"object"),"// Object that receives instances of other functions."),Object(r.b)("td",{align:"center"},"Function")))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"getPaymentToken ( card_data, callback )")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Parameter"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"card_data")),Object(r.b)("td",{align:"left"},"Object that contains card data. ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"The properties of this object are:"),Object(r.b)("br",null),Object(r.b)("code",null,"brand"),"// card flag ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"number"),"// Card number without formatting",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"cvv"),"// card security code ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"expiration_month"),'// Card expiry month in format "MM"',Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"expiration_year"),'// Card expiry year in format "YYYY"'),Object(r.b)("td",{align:"center"},"Object")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"callback")),Object(r.b)("td",{align:"left"},"Function that receives the response from Gerencianet.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Callback parameter(s):"),Object(r.b)("br",null),Object(r.b)("code",null,"error"),"// If it was not possible to generate the payment_token, errors will be returned in this parameter. ",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"response"),"// Receives the data representing the credit card: payment_token and card_mask",Object(r.b)("br",null),Object(r.b)("br",null)),Object(r.b)("td",{align:"center"},"Function")))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"getInstallments ( total, brand, callback )")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Parameter"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"total")),Object(r.b)("td",{align:"left"},"Total billing amount, including shipping, in cents.",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"For example: R$ 230,90 equals to 23090.")),Object(r.b)("td",{align:"center"},"Integer")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"brand")),Object(r.b)("td",{align:"left"},"Brand of the card that you want to obtain the amounts of installments.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Possible values:"),Object(r.b)("br",null),Object(r.b)("code",null,"visa"),"// Brand Visa",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"mastercard"),"// Brand MasterCard",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"amex"),"// Brand AmericanExpress",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"elo"),"// Brand Elo",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"hipercard"),"// Brand Hipercard"),Object(r.b)("td",{align:"center"},"String")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"callback")),Object(r.b)("td",{align:"left"},"Function that receives the response from Gerencianet.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Callback parameter(s):"),Object(r.b)("br",null),Object(r.b)("code",null,"error"),"//If payment data could not be obtained, errors will be returned in this parameter.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"response"),"// Receives data related to the type of payment consulted."),Object(r.b)("td",{align:"center"},"Function")))),Object(r.b)("br",null),Object(r.b)("h3",{id:"24-paying-with-credit-card"},"2.4. Paying with credit card"),Object(r.b)("p",null,"Now that the ",Object(r.b)("code",null,"payment_token")," has already been obtained through the Javascript code of the first step, let's proceed with the credit card payment. "),Object(r.b)("p",null,"In this step, your ",Object(r.b)("em",{parentName:"p"},"backend")," sends the rest of the transaction information and the ",Object(r.b)("code",null,"payment_token")," obtained in the first step. "),Object(r.b)("p",null,"When paying for a transaction by credit card, the status changes from ",Object(r.b)("code",null,"new")," to ",Object(r.b)("code",null,"waiting"),". This means that the transaction is associated with a payment method and is waiting for payment confirmation. "),Object(r.b)("p",null,"Once the payment is confirmed, the transaction will change status from ",Object(r.b)("code",null,"waiting")," to ",Object(r.b)("code",null,"paid"),".But, if for some reason it is not possible to confirm the payment, the status will change to ",Object(r.b)("code",null,"unpaid"),"."),Object(r.b)("p",null,"The example below shows how this can be done, using the SDK's available: "),Object(r.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(r.b)(l.a,{value:"php",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-php"}),"<?php\n \nrequire __DIR__.'/../../vendor/autoload.php'; // SDK Path\n \nuse Gerencianet\\Exception\\GerencianetException;\nuse Gerencianet\\Gerencianet;\n \n$clientId = 'informe_seu_client_id'; // enter your Client_Id, depending on the environment (Des or Prod)\n$clientSecret = 'informe_seu_client_secret'; // enter your Client_Secret, depending on the environment (Des or Prod)\n \n \n$options = [\n 'client_id' => $clientId,\n 'client_secret' => $clientSecret,\n 'sandbox' => true // change according to the environment (true = development and false = production)\n];\n\n// $charge_id refere-se ao ID da transa\xe7\xe3o gerada anteriormente\n$params = [\n 'id' => $charge_id\n];\n \n$paymentToken = '6426f3abd8688639c6772963669bbb8e0eb3c319'; // payment_token obtained in the 1st step (through single Javascript per Gerencianet account)\n \n$customer = [\n 'name' => 'Gorbadoc Oldbuck', \n 'cpf' => '94271564656' , \n 'email' => '[email protected]' ,\n 'phone_number' => '5144916523', \n 'birth' => '1990-05-20' \n];\n \n$billingAddress = [\n 'street' => 'Street 3',\n 'number' => 10,\n 'neighborhood' => 'Bauxita',\n 'zipcode' => '35400000',\n 'city' => 'Ouro Preto',\n 'state' => 'MG',\n];\n \n$creditCard = [\n 'installments' => 1, // number of installments into which the payment must be divided\n 'billing_address' => $billingAddress,\n 'payment_token' => $paymentToken,\n 'customer' => $customer\n];\n \n$payment = [\n 'credit_card' => $creditCard // form of payment (credit_card = cart\xe3o)\n];\n\n$body = [\n 'payment' => $payment\n];\n \n \ntry {\n $api = new Gerencianet($options);\n $charge = $api->payCharge($params, $body);\n \n print_r($charge);\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(r.b)(l.a,{value:"python",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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 \nparams = {\n 'id': 1000\n}\n \nbody = {\n 'payment': {\n 'credit_card': {\n 'installments': 1,\n 'payment_token': \"6426f3abd8688639c6772963669bbb8e0eb3c319\",\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': \"94271564656\",\n 'birth': \"1977-01-15\",\n 'phone_number': \"5144916523\"\n }\n }\n }\n}\n \ngn.pay_charge(params=params, body=body)\n"))),Object(r.b)(l.a,{value:"js",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n \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 params = {\n id: 1000\n}\n \nvar body = {\n payment: {\n credit_card: {\n installments: 1,\n payment_token: '6426f3abd8688639c6772963669bbb8e0eb3c319',\n billing_address: {\n street: 'Street 3',\n number: 10,\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: '94271564656',\n birth: '1977-01-15',\n phone_number: '5144916523'\n }\n }\n }\n}\n \n \nvar gerencianet = new Gerencianet(options);\n \ngerencianet\n .payCharge(params, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(r.b)(l.a,{value:"c",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'dynamic endpoints = new Endpoints("client_id", "client_secret", true);\n \nvar param = new {\n id = 1000\n};\n \nvar body = new {\n payment = new {\n credit_card = new {\n installments = 1,\n payment_token = "6426f3abd8688639c6772963669bbb8e0eb3c319",\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 = "94271564656",\n birth = "1977-01-15",\n phone_number = "5144916523"\n }\n }\n }\n};\n \nvar response = endpoints.PayCharge(param, body);\nConsole.WriteLine(response);\n'))),Object(r.b)(l.a,{value:"java",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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/charge/json/Card.java\n\n\nMap<String, Object>\n\nhttps://github.com/gerencianet/gn-api-sdk-java-examples/blob/master/src/main/java/br/com/gerencianet/charge/map/Card.java\n\n*/\n'))),Object(r.b)(l.a,{value:"go",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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 paymentToken := "payment_token";\n\n customer := map[string]interface{}{\n "name": "Gorbadoc Oldbuck",\n "cpf": "04267484171",\n "phone_number": "5144916523",\n "email": "[email protected]",\n "birth": "1977-01-15",\n }\n\n billingAddress := map[string]interface{} {\n "street": "Av JK",\n "number": 909,\n "neighborhood": "Bauxita",\n "zipcode": "35400000",\n "city": "Ouro Preto",\n "state": "MG",\n }\n\n body := map[string]interface{} {\n "payment": map[string]interface{} {\n "credit_card": map[string]interface{} {\n "installments": 1,\n "billing_address": billingAddress,\n "payment_token": paymentToken,\n "customer": customer,\n },\n },\n }\n\n res, err := gn.PayCharge(1, body) // no lugar do 1 coloque o charge_id certo\n\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(res)\n }\n}\n'))),Object(r.b)(l.a,{value:"ruby",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.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 \nparams = {\n id: 1000\n}\n \nbody = {\n payment: {\n credit_card: {\n installments: 1,\n payment_token: "6426f3abd8688639c6772963669bbb8e0eb3c319",\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: "94271564656",\n birth: "1977-01-15",\n phone_number: "5144916523"\n }\n }\n }\n}\n \ngerencianet = Gerencianet.new(options)\ngerencianet.pay_charge(params: params, body: body)\n'))),Object(r.b)(l.a,{value:"delphi",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction PayChargeWithCard(Id, Token: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction PayChargeWithCard(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 EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize();\n \n PaymentParams := CreateRequestParams( [ 'id='+Id ] ).Text;\n Result := ExecuteGerenciaNetRequest( 'payCharge',PaymentParams,'',Body );\nend;\n")))),Object(r.b)("br",null),Object(r.b)("h3",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used-in-the-requisition"},"a) Hierarchical structure of Schema attributes that can be used in the requisition:"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{}),'"id": "/Pay",\n "payment"\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 "installments"\n "discount"\n "type"\n "percentage",\n "currency"\n "value"\n "billing_address"\n "street"\n "number"\n "neighborhood"\n "zipcode"\n "city"\n "complement"\n "state"\n "payment_token"\n "message"\n')),Object(r.b)("br",null),Object(r.b)("h3",{id:"b-attributes-related-to-credit-card-payment"},"b) Attributes related to credit card payment:"),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"Par\xe2metros da url")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Attribute"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Mandatory"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"id")),Object(r.b)("td",{align:"left"},"transaction identifier (",Object(r.b)("em",null,"charge_id"),")"),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"Object ",Object(r.b)("b",null,"ID"))))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"Objeto")," ",Object(r.b)("strong",{parentName:"p"},"ID")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Attribute"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Mandatory"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"payment")),Object(r.b)("td",{align:"left"},"Root tag"),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"Object ",Object(r.b)("b",null,"Payment"))))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"Object")," ",Object(r.b)("strong",{parentName:"p"},"Payment")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Attribute"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Mandatory"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"credit_card")),Object(r.b)("td",{align:"left"},"Object containing the necessary information for payment via credit card, such as the number of installments and customer data."),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"Object ",Object(r.b)("b",null,"Credit_Card"))))),Object(r.b)("br",null),Object(r.b)("p",null,Object(r.b)("em",{parentName:"p"},"Object")," ",Object(r.b)("strong",{parentName:"p"},"Credit_Card")),Object(r.b)("table",null,Object(r.b)("tbody",null,Object(r.b)("tr",null,Object(r.b)("th",null,"Attribute"),Object(r.b)("th",{align:"center"},"Description"),Object(r.b)("th",{align:"center"},"Mandatory"),Object(r.b)("th",{align:"center"},"Type")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"customer")),Object(r.b)("td",{align:"left"},"Payer's personal data.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Attibutes of customer:"),Object(r.b)("br",null),Object(r.b)("code",null,"name*")," // Name ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"cpf*")," // customer's CPF (no dots, commas or hyphens).",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"email*")," // Customer's valid email address. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"phone_number*")," // Valid customer phone number, no special characters. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"birth*")," // Customer's date of birth (valid date in format YYYY-MM-DD). ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"address")," // Delivery address. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(Object)")," (more information)",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("code",null,"juridical_person")," // Legal person data. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(Object)")," (more information)"),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"Object")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"installments")),Object(r.b)("td",{align:"left"},"Number of installments into which the payment must be divided.",Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Minimum 1 and maximum 12. Integer.")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Integer")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"discount")),Object(r.b)("td",{align:"left"},"Defines discount data about the charge.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Attributes of discount:"),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"type*"),"// Discount type (String).Allowed values: ",Object(r.b)("br",null),Object(r.b)("code",null,"currency"),": the discount will be reported in cents. ",Object(r.b)("code",null,"percentage"),": the discount will be informed in percentage.",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"cnpj*"),"// Company CNPJ. ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Size: 14 characters. String."),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"value*"),"// Discount amount (Integer). If the discount type is ",Object(r.b)("code",null,"currency")," ,the value of this tag must be informed by the integrator in cents (that is, 500 equals to R$ 5,00). If the discount type is ",Object(r.b)("code",null,"percentage"),",the value must be multiplied by 100 (that is, 1500 equals to 15%). Exemples: ",Object(r.b)("br",null),"1)",Object(r.b)("code",null,"currency"),"// must be informed in cents, that is, if the discount will be R$ 5,99,the integrator must inform ",Object(r.b)("code",null,"599"),";",Object(r.b)("br",null)," 2)",Object(r.b)("code",null,"percentage")," // must be informed in cents, that is, if the discount is 15%, the integrator must inform ",Object(r.b)("code",null,"1500"),".",Object(r.b)("br",null),Object(r.b)("br",null)),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Object")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"billing_address")),Object(r.b)("td",{align:"left"},"Billing address (more info)",Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("em",null,"Attributes of billing_address:"),Object(r.b)("br",null),Object(r.b)("code",null,"street*"),"// Street name ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(Object)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"number*"),"// Number ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String/Integer)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"neighborhood*"),"// Neighborhood ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"zipcode*"),"// CEP (without dots or hyphen) ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"city*"),"// City ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"complement"),"// Complement ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(String/null)"),Object(r.b)("br",null),Object(r.b)("br",null)," ",Object(r.b)("code",null,"state*"),"// State (2 caracteres) ",Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"(Object)")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"Object")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"payment_token")),Object(r.b)("td",{align:"left"},"Single payment token obtained in the first step of transaction generation."),Object(r.b)("td",{align:"center"},"Yes"),Object(r.b)("td",{align:"center"},"String")),Object(r.b)("tr",null,Object(r.b)("td",null,Object(r.b)("code",null,"message")),Object(r.b)("td",{align:"left"},'Allows you to include an "observation" in the billing, or in other words, a message to the customer. This message can be seen in the emails related to the billing, in the payment slip or carnet.',Object(r.b)("br",null),Object(r.b)(d,{color:"#009615",mdxType:"Highlight"},"Up to 4 lines containing 100 characters on each line. ",Object(r.b)("br",null),"The operator ",Object(r.b)("code",null,"\\n"),"is used to perform the line break.")),Object(r.b)("td",{align:"center"},"No"),Object(r.b)("td",{align:"center"},"String")))),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"Fields with * represent mandatory values")),Object(r.b)("br",null),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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"})))),"The payment as a Legal Entity (PJ) ")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"The customer associated with the transaction can be a Legal Entity. In this case, the Corporate Name and CNPJ of the paying company must be informed within the ",Object(r.b)("inlineCode",{parentName:"p"},"juridical_person")," attribute."),Object(r.b)("p",{parentName:"div"},"Check this ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"../OutrosRecursos/PessoaJuridica"}),"link"),' for details on how to generate a payment whose payment method is "credit card" for a customer who is a Legal Entity (PJ). '))),Object(r.b)("br",null),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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 status of a transaction ")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"All transactions have their status. Therefore, it is important to know the possible statuses in the API to provide the proper handling in your system. "),Object(r.b)("p",{parentName:"div"},"Check this link for details of all the possible status of transactions. "))),Object(r.b)("br",null),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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"})))),"API transaction callbacks (notifications) to your system ")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"Notifications allow you to be informed when a transaction has changed status. In this way, you will be able to identify when a charge is paid, for example."),Object(r.b)("p",{parentName:"div"},"Check this link for all the details on how to implement your notification URL. "))),Object(r.b)("br",null),Object(r.b)("hr",null),Object(r.b)("h2",{id:"3-other-endpoints"},"3. Other endpoints"),Object(r.b)("p",null,"There are other endpoints and methods related to credit card payment that are available in the API and can be exploited by the integrator. Check out the complete list: "),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"../PagamentoCartao/EndpointsCartao"}),"Cancel certain transaction"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"../PagamentoCartao/EndpointsCartao"}),"Change notification URL (notification_url) and/or the transaction custom_id "))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"../PagamentoCartao/EndpointsCartao"}),"Add information to transaction history "))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"../PagamentoCartao/EndpointsCartao"}),"Return transaction info"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"../PagamentoCartao/EndpointsCartao"}),"List installments, according to the credit card brand")))),Object(r.b)("br",null),Object(r.b)("hr",null),Object(r.b)("h2",{id:"4-videos-creating-transaction-and-paying-via-credit-card"},"4. Videos: Creating transaction and paying via credit card"),Object(r.b)("p",null,'Thinking of offering new means of transmitting information, Gerencianet makes available the following videos in order to explain, in a clear and objective way, how to create a transaction via integration and associate it with the payment method by "credit card".'),Object(r.b)("h3",{id:"41-creating-transaction-via-playground-test-environmentsandbox"},"4.1. Creating transaction via Playground (test environment/sandbox)"),Object(r.b)("iframe",{width:"560",height:"315",src:"https://www.youtube.com/embed/ylqJUpHqwfY",frameborder:"0",allowfullscreen:!0}),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("h3",{id:"42-defining-payment-method-by-credit-card-via-playground"},"4.2. Defining payment method by Credit Card (via Playground)"),Object(r.b)("iframe",{width:"560",height:"315",src:"https://www.youtube.com/embed/vxhkSXV_aX8",frameborder:"0",allowfullscreen:!0}),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("h3",{id:"43-creating-a-transaction-by-integration---payment-by-credit-card"},"4.3. Creating a transaction by integration - Payment by Credit Card"),Object(r.b)("iframe",{width:"560",height:"315",src:"https://www.youtube.com/embed/ucEr_sjp9wQ",frameborder:"0",allowfullscreen:!0}),Object(r.b)("br",null),Object(r.b)("br",null),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.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"})))),"Type")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"For access to other classes, on other subjects, access the Online Course on Integrations page."))),Object(r.b)("br",null),Object(r.b)("hr",null)))}p.isMDXComponent=!0},250:function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p}));var a=n(0),c=n.n(a);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,c=function(e,t){if(null==e)return{};var n,a,c={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}var o=c.a.createContext({}),s=function(e){var t=c.a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return c.a.createElement(o.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return c.a.createElement(c.a.Fragment,{},t)}},m=c.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,b=e.parentName,o=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=a,p=d["".concat(b,".").concat(m)]||d[m]||u[m]||r;return n?c.a.createElement(p,i(i({ref:t},o),{},{components:n})):c.a.createElement(p,i({ref:t},o))}));function p(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,b=new Array(r);b[0]=m;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,b[1]=i;for(var o=2;o<r;o++)b[o]=n[o];return c.a.createElement.apply(null,b)}return c.a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},254:function(e,t,n){"use strict";function a(e){var t,n,c="";if("string"==typeof e||"number"==typeof e)c+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a(e[t]))&&(c&&(c+=" "),c+=n);else for(t in e)e[t]&&(c&&(c+=" "),c+=t);return c}t.a=function(){for(var e,t,n=0,c="";n<arguments.length;)(e=arguments[n++])&&(t=a(e))&&(c&&(c+=" "),c+=t);return c}},255:function(e,t,n){"use strict";var a=n(0);const c=Object(a.createContext)({tabGroupChoices:{},setTabGroupChoices:()=>{},isAnnouncementBarClosed:!1,closeAnnouncementBar:()=>{}});t.a=c},256:function(e,t,n){"use strict";var a=n(0),c=n(255);t.a=function(){return Object(a.useContext)(c.a)}},257:function(e,t,n){"use strict";var a=n(0),c=n.n(a),r=n(256),b=n(254),i=n(92),l=n.n(i);const o=37,s=39;t.a=function(e){const{block:t,children:n,defaultValue:i,values:d,groupId:u}=e,{tabGroupChoices:m,setTabGroupChoices:p}=Object(r.a)(),[O,j]=Object(a.useState)(i);if(null!=u){const e=m[u];null!=e&&e!==O&&d.some(t=>t.value===e)&&j(e)}const h=e=>{j(e),null!=u&&p(u,e)},g=[];return c.a.createElement("div",null,c.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(b.a)("tabs",{"tabs--block":t})},d.map(({value:e,label:t})=>c.a.createElement("li",{role:"tab",tabIndex:"0","aria-selected":O===e,className:Object(b.a)("tabs__item",l.a.tabItem,{"tabs__item--active":O===e}),key:e,ref:e=>g.push(e),onKeyDown:e=>((e,t,n)=>{switch(n.keyCode){case s:((e,t)=>{const n=e.indexOf(t)+1;e[n]?e[n].focus():e[0].focus()})(e,t);break;case o:((e,t)=>{const n=e.indexOf(t)-1;e[n]?e[n].focus():e[e.length-1].focus()})(e,t)}})(g,e.target,e),onFocus:()=>h(e),onClick:()=>h(e)},t))),c.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(n).filter(e=>e.props.value===O)[0]))}},258:function(e,t,n){"use strict";var a=n(0),c=n.n(a);t.a=function(e){return c.a.createElement("div",null,e.children)}},93:function(e,t,n){"use strict";n.r(t);var a=n(0),c=n.n(a);class r extends c.a.Component{constructor(e){super(e),this.state={value:"",desenvolvimento:"",producao:""},this.handleChange=this.handleChange.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}handleChange(e){this.setState({value:e.target.value})}handleSubmit(e){var t=this.state.value;if(null!==t&&""!==t){var n="<script type='text/javascript'>var s=document.createElement('script');s.type='text/javascript';var v=parseInt(Math.random()*1000000);s.src='https://sandbox.gerencianet.com.br/v1/cdn/"+t+"/'+v;s.async=false;s.id='"+t+"';if(!document.getElementById('"+t+"')){document.getElementsByTagName('head')[0].appendChild(s);};$gn={validForm:true,processed:false,done:{},ready:function(fn){$gn.done=fn;}};<\/script>",a="<script type='text/javascript'>var s=document.createElement('script');s.type='text/javascript';var v=parseInt(Math.random()*1000000);s.src='https://api.gerencianet.com.br/v1/cdn/"+t+"/'+v;s.async=false;s.id='"+t+"';if(!document.getElementById('"+t+"')){document.getElementsByTagName('head')[0].appendChild(s);};$gn={validForm:true,processed:false,done:{},ready:function(fn){$gn.done=fn;}};<\/script>",r=c.a.createElement("h2",null,"Desenvolvimento"),b=c.a.createElement("h2",null,"Produ\xe7\xe3o");this.updateContent(n,a,r,b)}else alert("Insira um identificador v\xe1lido");e.preventDefault(),console.log(t)}updateContent(e,t,n,a){this.setState({desenvolvimento:e}),this.setState({producao:t}),this.setState({hdesenvolvimento:n}),this.setState({hproducao:a})}render(){return c.a.createElement("div",null,c.a.createElement("form",{onSubmit:this.handleSubmit},c.a.createElement("label",null,c.a.createElement("input",{type:"text",placeholder:"Identificador da conta",className:"input_account",value:this.state.value,onChange:this.handleChange})),c.a.createElement("input",{type:"submit",className:"button1",value:"Gerar"})),c.a.createElement("div",null,this.state.hdesenvolvimento,this.state.desenvolvimento,c.a.createElement("hr",null),this.state.hproducao,this.state.producao))}}t.default=r}}]);