-
Notifications
You must be signed in to change notification settings - Fork 0
/
12b93229.f3b7a297.js
1 lines (1 loc) · 51.8 KB
/
12b93229.f3b7a297.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{111:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return l})),n.d(t,"metadata",(function(){return s})),n.d(t,"Highlight",(function(){return b})),n.d(t,"rightToc",(function(){return d})),n.d(t,"default",(function(){return m}));var a=n(2),r=n(6),i=(n(0),n(250)),c=n(257),o=n(258),l={id:"CriandoLink",title:"Criando link de pagamento",hide_title:!0,sidebar_label:"Creating payment link"},s={id:"LinkdePagamento/CriandoLink",isDocsHomePage:!1,title:"Criando link de pagamento",description:"Creating payment link",source:"@site/docs\\LinkdePagamento\\CriarLink.md",permalink:"/documentation/docs/LinkdePagamento/CriandoLink",sidebar_label:"Creating payment link",sidebar:"someSidebar",previous:{title:"Introdu\xe7\xe3o",permalink:"/documentation/docs/LinkdePagamento/Introducao"},next:{title:"Outros endpoints",permalink:"/documentation/docs/LinkdePagamento/EndpointsLink"}},b=function(e){var t=e.children;e.color;return Object(i.b)("span",{style:{borderRadius:"2px",color:"#009615",padding:"0.2rem"}},t)},d=[{value:"1. Create the transaction",id:"1-create-the-transaction",children:[]},{value:"2. Creating a payment link",id:"2-creating-a-payment-link",children:[{value:"a) Attributes that can be used to create a payment link:",id:"a-attributes-that-can-be-used-to-create-a-payment-link",children:[]},{value:"b) Hierarchical structure of Schema attributes that can be used:",id:"b-hierarchical-structure-of-schema-attributes-that-can-be-used",children:[]},{value:"c) Customizing your payment screen:",id:"c-customizing-your-payment-screen",children:[]},{value:"d) Testing in test environment (Playground):",id:"d-testing-in-test-environment-playground",children:[]}]},{value:"3. Other endpoints and methods",id:"3-other-endpoints-and-methods",children:[]},{value:"4. Video: Creating transaction via Playground (test environment/sandbox)",id:"4-video-creating-transaction-via-playground-test-environmentsandbox",children:[]}],u={Highlight:b,rightToc:d};function m(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},u,n,{components:t,mdxType:"MDXLayout"}),Object(i.b)("h1",{className:"titulo"},"Creating payment link"),Object(i.b)("div",{className:"subtitulo"},Object(i.b)("p",null,"Learn how to create a link to a Gerencianet payment screen for your customers to make payments. To create it is very simple and requires only two steps:"),Object(i.b)("ol",null,Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},"First, ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"#1-crie-a-transa%C3%A7%C3%A3o"}),"create the transaction"),", informing the item/product/service, value, quantity, etc;")),Object(i.b)("li",{parentName:"ol"},Object(i.b)("p",{parentName:"li"},"Now to ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"#2-criando-um-link-de-pagamento"}),"create payment link"),", inform the ",Object(i.b)("code",null,"charge_id")," of the transaction created earlier."))),Object(i.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(i.b)("a",Object(a.a)({parentName:"p"},{href:"../Instalacao/introducao"}),"Make sure the Gerencianet SDK has been installed"),"."),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"Bolix")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"If you have activated Bolix in your Gerencianet account, the charges generated by our module/plugin will already come with the pix on the ticket.\nMore details about Bolix and how to activate it, click ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../Bolix/bolix"}),"here"),"."))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"1-create-the-transaction"},"1. Create the transaction"),Object(i.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(i.b)("p",null,"After creating it, the ",Object(i.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(i.b)("p",null,"As soon as this transaction is created, it receives the status ",Object(i.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(i.b)("p",null,"To generate a transaction, you must send a ",Object(i.b)("code",null,"POST")," request to the ",Object(i.b)("code",null,"/v1/charge")," route."),Object(i.b)("p",null,"If you want, you can explore and learn more about this feature ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes#post-v1charge"}),"using our Playground"),"."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available:"),Object(i.b)(c.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(o.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.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(i.b)(o.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-py"}),"from 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 \nresponse = gn.create_charge(body=body)\nprint(response)\n"))),Object(i.b)(o.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n \nvar Gerencianet = require('gn-api-sdk-node');\n \nvar clientId = 'informe_seu_client_id';\nvar clientSecret = 'informe_seu_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(i.b)(o.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.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(i.b)(o.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.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(i.b)(o.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-go"}),'package main\n\nimport (\n "fmt"\n "github.com/gerencianet/gn-api-sdk-go/gerencianet"\n "github.com/gerencianet/gn-api-sdk-go/_examples/configs"\n)\n\nfunc main(){\n \n credentials := configs.Credentials\n gn := gerencianet.NewGerencianet(credentials)\n\n body := map[string]interface{} {\n "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(i.b)(o.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.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(i.b)(o.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.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(i.b)("br",null),Object(i.b)("h4",{id:"a-hierarchical-structure-of-schema-attributes-that-can-be-used"},"a) Hierarchical structure of Schema attributes that can be used:"),Object(i.b)("pre",null,Object(i.b)("code",Object(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(i.b)("p",null,"To check ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes#post-v1charge"}),"more details"),", go here and explore in our Playground."),Object(i.b)("br",null),Object(i.b)("h4",{id:"b-attributes-that-can-be-used-to-create-a-transaction"},"b) Attributes that can be used to create a transaction:"),Object(i.b)("p",null,Object(i.b)("em",{parentName:"p"},"Objeto")," ",Object(i.b)("strong",{parentName:"p"},"items")),Object(i.b)("table",null,Object(i.b)("tbody",null,Object(i.b)("tr",null,Object(i.b)("th",null,"Attribute"),Object(i.b)("th",{align:"center"},"Description"),Object(i.b)("th",{align:"center"},"Mandatory"),Object(i.b)("th",{align:"center"},"Type")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"items")),Object(i.b)("td",{align:"left"},"item being sold. The same transaction can have unlimited items. ",Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("em",null,"Item attributes:"),Object(i.b)("br",null),Object(i.b)("code",null,"name*"),"// Name of the item, product or service. ",Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Minimum of 1 character and maximum of 255 characters (String)."),Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("code",null,"value*"),"// Value, in cents. Ex: R$ 10,00 = 1000. ",Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Integer"),Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("code",null,"amount")," ",Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Integer")),Object(i.b)("td",{align:"center"},"Yes"),Object(i.b)("td",{align:"center"},"Array")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"shippings")),Object(i.b)("td",{align:"left"},"Determines the shipping amount(s) for a transaction. The same transaction can have unlimited shipping values. ",Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("em",null,"Shipping attributes:"),Object(i.b)("br",null),Object(i.b)("code",null,"name*"),"// R\xf3tulo do frete. ",Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 characters. String."),Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("code",null,"value*"),"// Freight value, in cents (1990 is equivalent to R$19.90). ",Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Integer")),Object(i.b)("td",{align:"center"},"No"),Object(i.b)("td",{align:"center"},"Array")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"metadata")),Object(i.b)("td",{align:"left"},"Define transaction-specific data",Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("em",null,"Metadata attributes:"),Object(i.b)("br",null),Object(i.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(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 characters. String/null."),Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("code",null,"notification_url"),"// Address of your valid URL that will receive transaction status change notifications. ",Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Maximum of 255 characters. String/null.")),Object(i.b)("td",{align:"center"},"No"),Object(i.b)("td",{align:"center"},"Object")))),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"Fields with * represent mandatory values"),"\nNow that the transaction has been created and you already have the ",Object(i.b)("inlineCode",{parentName:"p"},"charge_id"),", you need to associate it to get the payment link."),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"2-creating-a-payment-link"},"2. Creating a payment link"),Object(i.b)("p",null,"To create a payment link you need to have ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes#post-v1charge"}),"generated the transaction"),", that is, that you already have the charge identifier ",Object(i.b)("code",null,"charge_id"),", as you will need to inform it."),Object(i.b)("p",null,"Then simply send a ",Object(i.b)("code",null,"POST")," request to the ",Object(i.b)("code",null,"/v1/charge/:id/link")," route to generate a payment link, where the ",Object(i.b)("code",null,":id")," corresponds to the ",Object(i.b)("code",null,"charge_id")," of the transaction created."),Object(i.b)("p",null,"If you want, you can explore and learn more about this resource ",Object(i.b)("a",{href:"../PlaygroundTransacoes#post-v1chargeidlink",target:"_blank"},"using our Playground"),"."),Object(i.b)("p",null,"The example below shows how this can be done, using the SDK's available:"),Object(i.b)(c.a,{defaultValue:"php",values:[{label:"PHP",value:"php"},{label:"Python",value:"python"},{label:"NodeJS",value:"js"},{label:".NET",value:"c"},{label:"Java",value:"java"},{label:"GO",value:"go"},{label:"Ruby",value:"ruby"},{label:"Delphi",value:"delphi"}],mdxType:"Tabs"},Object(i.b)(o.a,{value:"php",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.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// $charge_id refere-se ao ID da transa\xe7\xe3o gerada anteriormente\n$params = [\n 'id' => $charge_id\n];\n\n$body = [\n 'billet_discount' => 5000, // desconto, em reais, caso o pagador escolha boleto (5000 equivale a R$ 50,00)\n 'card_discount' => 3000, // desconto, em reais, caso o pagador escolha cart\xe3o (3000 equivale a R$ 30,00)\n 'message' => '', // mensagem para o pagador com at\xe9 80 caracteres\n 'expire_at' => '2022-12-20', // data de vencimento da tela de pagamento e do pr\xf3prio boleto\n 'request_delivery_address' => false, // solicitar endere\xe7o de entrega do comprador?\n 'payment_method' => 'all' // formas de pagamento dispon\xedveis\n];\n\ntry {\n $api = new Gerencianet($options);\n $response = $api->linkCharge($params, $body);\n print_r($response);\n} catch (GerencianetException $e) {\n print_r($e->code);\n print_r($e->error);\n print_r($e->errorDescription);\n} catch (Exception $e) {\n print_r($e->getMessage());\n}\n"))),Object(i.b)(o.a,{value:"python",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-py"}),"# encoding: utf-8\n\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\nlink = {\n 'billet_discount': 0,\n 'card_discount': 0,\n 'message': '',\n 'expire_at': '2022-12-12',\n 'request_delivery_address': false,\n 'payment_method': 'all'\n}\n\n\nparams = {\n 'id': 'charge_id'\n}\n\nresponse = gn.link_charge(params=params, body=link)\nprint(response)\n"))),Object(i.b)(o.a,{value:"js",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),"'use strict';\n\nvar moment = require('moment');\nvar Gerencianet = require('gn-api-sdk-node');\nvar credentials = require('./credentials');\n\nvar options = {\n client_id: credentials.client_id,\n client_secret: credentials.client_secret,\n sandbox: true\n};\n\nvar expireAt = moment()\n .add(3, 'days')\n .format('YYYY-MM-DD');\n\nvar params = {\n id: 0\n};\n\nvar body = {\n message: '',\n expire_at: expireAt,\n request_delivery_address: false,\n payment_method: 'all'\n};\n\nvar gerencianet = new Gerencianet(options);\n\ngerencianet\n .chargeLink(params, body)\n .then(console.log)\n .catch(console.log)\n .done();\n"))),Object(i.b)(o.a,{value:"c",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'using System;\n\nnamespace Gerencianet.SDK.Examples\n{\n class LinkCharge\n {\n public static void Execute()\n {\n dynamic endpoints = new Endpoints(Credentials.Default.ClientId, Credentials.Default.ClientSecret, Credentials.Default.Sandbox);\n\n var param = new\n {\n id = 1000\n };\n\n var body = new\n {\n billet_discount = 0,\n card_discount = 0,\n message = "",\n expire_at = DateTime.Now.AddDays(3).ToString("yyyy-MM-dd"),\n request_delivery_address = false,\n payment_method = "all"\n };\n\n try\n {\n var response = endpoints.LinkCharge(param, body);\n Console.WriteLine(response);\n }\n catch (GnException e)\n {\n Console.WriteLine(e.ErrorType);\n Console.WriteLine(e.Message);\n }\n }\n }\n}\n'))),Object(i.b)(o.a,{value:"java",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.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/Link.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/Link.java\n\n*/\n'))),Object(i.b)(o.a,{value:"go",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.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 "billet_discount": 1,\n "card_discount": 1,\n "message": "teste",\n "expire_at": "2022-12-12",\n "request_delivery_address": false,\n "payment_method": "all",\n }\n\n res, err := gn.ChargeLink(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(i.b)(o.a,{value:"ruby",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-js"}),'require "gerencianet"\nrequire "date"\nrequire_relative "./credentials"\n\noptions = {\n client_id: CREDENTIALS::CLIENT_ID,\n client_secret: CREDENTIALS::CLIENT_SECRET,\n sandbox: true\n}\n\nexpireAt = Date.today + 3\n\nparams = {\n id: 1000\n}\n\nbody = {\n billet_discount: 0,\n card_discount: 0,\n message: "",\n expire_at: expireAt.strftime,\n request_delivery_address: false,\n payment_method: "all"\n}\n\ngerencianet = Gerencianet.new(options)\nputs gerencianet.link_charge(params: params, body: body)\n'))),Object(i.b)(o.a,{value:"delphi",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),"interface\nfunction LinkCharge(Id: String): String;\n\nimplementation\nuses uGerenciaClient, uGerenciaNetClientUtilities;\n{... your code ... }\n\nfunction LinkCharge(Id: String): String;\nvar\n Params: String;\n Body : String;\nbegin\n EnableService( 'GerenciaNet.dll' ); \n ConfigureService( ToPAnsiChar( 'client_id' ),ToPAnsiChar( 'client_secret' ),'sandbox','config.json',''); \n GerenciaNetAuthorize();\n\n Params := CreateRequestParams( [ 'id='+Id ] ).Text;\n Body := '{\"billet_discount\": 10,'+\n '\"card_discount\": 10,'+\n '\"message\": \"link test\",'+\n '\"expire_at\": \"2022-12-12\",'+\n '\"request_delivery_address\": false,'+\n '\"payment_method\": \"all\"}';\n Result := ExecuteGerenciaNetRequest( 'linkCharge',Params, '', Body );\nend;\n")))),Object(i.b)("br",null),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.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(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},'To create a "payment link" (',Object(i.b)("inlineCode",{parentName:"p"},"chargeLink"),'), a previously created "transaction" (',Object(i.b)("inlineCode",{parentName:"p"},"createCharge"),") must be informed. Therefore, if there is an attempt to pay and, for some reason, the payment confirmation is not successful (ex: card declined, customer wants to pay in another way, etc.), a new transaction must be generated and associated with a new payment, as the previous transaction will be in a waiting or unpaid status, which means that due to the payment attempt, it has already been linked to a payment method."))),Object(i.b)("br",null),Object(i.b)("h3",{id:"a-attributes-that-can-be-used-to-create-a-payment-link"},"a) Attributes that can be used to create a payment link:"),Object(i.b)("table",null,Object(i.b)("tbody",null,Object(i.b)("tr",null,Object(i.b)("th",null,"Attribute"),Object(i.b)("th",{align:"center"},"Description"),Object(i.b)("th",{align:"center"},"Mandatory"),Object(i.b)("th",{align:"center"},"Type")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"billet_discount")),Object(i.b)("td",{align:"left"},"Defines a discount, in reais, if the payer chooses a boleto banc\xe1rio as the payment method (inform the entire amount, in reais).",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"5000 is equivalent to R$ 50,00")),Object(i.b)("td",{align:"center"},"No"),Object(i.b)("td",{align:"center"},"Integer")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"card_discount")),Object(i.b)("td",{align:"left"},"Defines a discount, in reais, if the payer chooses a credit card as the payment method (enter Integer value).",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"5000 equals to R$ 50,00")),Object(i.b)("td",{align:"center"},"No"),Object(i.b)("td",{align:"center"},"Integer")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"conditional_discount")),Object(i.b)("td",{align:"left"},"Defines conditional discount that is valid until a specific date. If payment is not made by that date, the discount is invalidated.",Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("em",null,"Conditional discount attributes:"),Object(i.b)("br",null),Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"type*"),"// Discount type (String). Allowed values: ",Object(i.b)("br",null),Object(i.b)("code",null,"currency"),": the discount will be reported in cents. ",Object(i.b)("br",null),Object(i.b)("code",null,"percentage"),":the discount will be informed in percentage.",Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("code",null,"cnpj*")," ",Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Size: 14 characters. String."),Object(i.b)("br",null),Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"value*"),"// discount amount (Integer). If the discount type is ",Object(i.b)("code",null,"currency")," , the value of this tag must be informed by the integrator in cents (ie 500 is equivalent to R$ 5.00). If the discount type is ",Object(i.b)("code",null,"percentage"),", the value must be multiplied by 100 (ie 1500 equals 15%). Examples: ",Object(i.b)("br",null),"1)",Object(i.b)("code",null,"currency"),"// must be informed in cents, that is, if the discount will be R$ 5.99, the integrator must inform ",Object(i.b)("code",null,"599"),";",Object(i.b)("br",null)," 2)",Object(i.b)("code",null,"percentage")," // must be informed in cents, that is, if the discount is 15%, the integrator must inform ",Object(i.b)("code",null,"1500"),".",Object(i.b)("br",null),Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"until_date*"),", // Maximum date the discount will be granted. (String).",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Format: YYYY-MM-DD")),Object(i.b)("td",{align:"center"},"No"),Object(i.b)("td",{align:"center"},"Object")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"message")),Object(i.b)("td",{align:"left"},"Defines a message for the payer. The message appears on the payment screen, in the billing-related emails and on the boleto, if this is the chosen payment method.",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Minimum of 3 and maximum of 80 characters.")),Object(i.b)("td",{align:"center"},"No"),Object(i.b)("td",{align:"center"},"String")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"expire_at")),Object(i.b)("td",{align:"left"},"Defines the due date of the payment screen and of the ticket itself, if this is the chosen payment method.",Object(i.b)("br",null),Object(i.b)(b,{color:"#009615",mdxType:"Highlight"},"Format: YYYY-MM-DD")),Object(i.b)("td",{align:"center"},"Yes"),Object(i.b)("td",{align:"center"},"String")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"request_delivery_address")),Object(i.b)("td",{align:"left"},"Defines whether the payment screen should ask the payer to enter a delivery address. There are two possible values: ",Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("ul",null,Object(i.b)("li",null,Object(i.b)("code",null,"true")),Object(i.b)("li",null,Object(i.b)("code",null,"false")))),Object(i.b)("td",{align:"center"},"Yes"),Object(i.b)("td",{align:"center"},"Boolean")),Object(i.b)("tr",null,Object(i.b)("td",null,Object(i.b)("code",null,"payment_method")),Object(i.b)("td",{align:"left"},"Defines the payment methods that must be available on the screen for your customer to choose, which can be: ",Object(i.b)("br",null),Object(i.b)("br",null)," ",Object(i.b)("ul",null,Object(i.b)("li",null,Object(i.b)("code",null,"banking_billet")," (boleto banc\xe1rio)"),Object(i.b)("li",null,Object(i.b)("code",null,"credit_card")," (cart\xe3o de cr\xe9dito)"),Object(i.b)("li",null,Object(i.b)("code",null,"all")," (allow payment via boleto and card)"))),Object(i.b)("td",{align:"center"},"Yes"),Object(i.b)("td",{align:"center"},"Object")))),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"Fields with * represent mandatory values")),Object(i.b)("br",null),Object(i.b)("p",null,"When consuming the ",Object(i.b)("code",null,"/charge/:id/link")," endpoint, or through the Playground, the charge gains ",Object(i.b)("code",null,"link")," status. In this way, the integrator can distinguish common charges that have not yet had a defined payment method (status ",Object(i.b)("code",null,"new"),") from charges that have been associated with a payment link (status ",Object(i.b)("code",null,"link"),")."),Object(i.b)("p",null,"The integrator only needs to redirect the payer to the link returned in the ",Object(i.b)("code",null,"payment_url")," tag and everything else will be done on the Gerencianet payment screen."),Object(i.b)("p",null,'Then, through the "Input Data" tab, a simple JSON that can be used to create the payment link. Also, you can see the predicted output and validation schema with all tags (mandatory and optional) available for this method. Remembering that you also need to inform the ',Object(i.b)("code",null,"charge_id")," input parameter of the transaction created:"),Object(i.b)(c.a,{defaultValue:"entrada",values:[{label:"Dados de Entrada",value:"entrada"},{label:"Dados de Sa\xedda",value:"saida"},{label:"Schema",value:"schema"}],mdxType:"Tabs"},Object(i.b)(o.a,{value:"entrada",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "message": "Write here, if you want, a message to your customer, limit of 80 characters",\n "payment_method": "all",\n "expire_at": "2022-12-20",\n "request_delivery_address": false,\n "billet_discount": 5000,\n "card_discount": 3000\n}\n'))),Object(i.b)(o.a,{value:"saida",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "code": 200,\n "data": {\n "charge_id": 148003,\n "status": "link",\n "total": 5990,\n "custom_id": null,\n "payment_url": "https://pagamento.gerencianet.com.br/:identificador",\n "payment_method": "all",\n "created_at": "2022-12-14 11:31:37"\n }\n}\n'))),Object(i.b)(o.a,{value:"schema",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "id": "/ChargeLink",\n "type": "object",\n "properties": {\n "billet_discount": {\n "type": "integer",\n "minimum": 1,\n "maximum": 99999999\n },\n "card_discount": {\n "type": "integer",\n "minimum": 1,\n "maximum": 99999999\n },\n "message": {\n "type": "string",\n "minLength": 3,\n "maxLength": 80\n },\n "expire_at": {\n "type": "string",\n "pattern": "^[12][0-9]{3}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$"\n },\n "request_delivery_address": {\n "type": "boolean"\n },\n "payment_method": {\n "enum": [\n "banking_billet",\n "credit_card",\n "all"\n ]\n }\n },\n "required": [\n "request_delivery_address",\n "expire_at",\n "payment_method"\n ]\n}\n')))),Object(i.b)("p",null,'This JSON, present in the "Input Data" tab, defines the following information when creating the payment link:'),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"message"),": defines a message to the payer. The message appears on the payment screen, in the billing-related emails and on the payment slip, if this is the chosen payment method (maximum 80 characters);"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"payment_method"),": defines the payment methods that must be available on the screen (",Object(i.b)("code",null,"banking_billet"),", ",Object(i.b)("code",null,"credit_card")," ou ",Object(i.b)("code",null,"all"),");"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"expire_at"),": defines the payment methods that must be available on the screen"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"request_delivery_address"),": defines whether the payment screen should ask the payer to enter a delivery address (",Object(i.b)("code",null,"true")," ou ",Object(i.b)("code",null,"false"),");"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"billet_discount"),": defines a discount, in cents, if the payer chooses a bank slip as the payment method (enter Integer value);"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("code",null,"card_discount"),": defines a discount, in cents, if the payer chooses a credit card as the payment method (enter Integer value).")),Object(i.b)("br",null),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"List of all possible statuses of a transaction")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},'All transactions have status, which represents the "status" of that transaction. Therefore, it is important to know the possible statuses in the API to provide the proper handling in your system.'),Object(i.b)("p",{parentName:"div"},"Check out ",Object(i.b)("a",{href:"../VisaoGeral/statusTransacoes",target:"_blank",title:"Link Interno"},"this link")," all the details of the possible status of the transactions."))),Object(i.b)("br",null),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.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(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.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(i.b)("p",{parentName:"div"},"Check out ",Object(i.b)("a",{href:"../Notificacoes/RecebendoNotificacoes",target:"_blank",title:"Link Interno"},"this link")," all the details on how to implement your notification URL."))),Object(i.b)("br",null),Object(i.b)("h3",{id:"b-hierarchical-structure-of-schema-attributes-that-can-be-used"},"b) Hierarchical structure of Schema attributes that can be used:"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{}),'"id": "/ChargeLink"\n "billet_discount"\n "card_discount"\n "conditional_discount"\n "type"\n "percentage",\n "currency"\n "value"\n "until_date"\n "message"\n "expire_at"\n "request_delivery_address"\n "payment_method"\n "banking_billet"\n "credit_card"\n "all"\n')),Object(i.b)("p",null,"For more details, ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../AmbienteTestes/PlaygroundTransacoes"}),"click here")," and explore in our Playground."),Object(i.b)("h3",{id:"c-customizing-your-payment-screen"},"c) Customizing your payment screen:"),Object(i.b)("p",null,"You can set a color and logo for your screen. For that, ",Object(i.b)("a",{href:"https://gerencianet.com.br/#login",target:"_blank",title:"Log into your Gerencianet account"},"Log into your Gerencianet account")," and access the menu ",Object(i.b)("code",null,"Minha Conta > Tela de Pagamento"),"."),Object(i.b)("p",null,"Even if you prefer to use your own screen, the information defined here will also be used in emails triggered by the API. So we recommend that you do the customization anyway."),Object(i.b)("h3",{id:"d-testing-in-test-environment-playground"},"d) Testing in test environment (Playground):"),Object(i.b)("p",null,"To create a payment link, you must first create a charge in the API, consuming the ",Object(i.b)("code",null,"POST /v1/charge")," endpoint. This endpoint returns, among other information, an identifier for the charge. The initial status of a charge is ",Object(i.b)("code",null,"new"),":"),Object(i.b)(c.a,{defaultValue:"entrada",values:[{label:"Entrada",value:"entrada"}],mdxType:"Tabs"},Object(i.b)(o.a,{value:"entrada",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "message": "Write here, if you want, a message to your customer, limit of 80 characters",\n "payment_method": "all",\n "expire_at": "2022-12-20",\n "request_delivery_address": false,\n "billet_discount": 5000,\n "card_discount": 3000\n}\n')))),Object(i.b)("br",null),Object(i.b)("p",null,"Just below, the expected output data according to the input made above:"),Object(i.b)(c.a,{defaultValue:"saida",values:[{label:"Sa\xedda",value:"saida"}],mdxType:"Tabs"},Object(i.b)(o.a,{value:"saida",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{ \n "code":200,\n "data":{ \n "charge_id":121062,\n "status":"new",\n "total":1000,\n "custom_id":null,\n "created_at":"2022-10-31 10:43:57"\n }\n}\n')))),Object(i.b)("p",null,"Knowing the charge identifier, just consume the POST endpoint /v1/charge/:id/link to generate a payment link."),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"3-other-endpoints-and-methods"},"3. Other endpoints and methods"),Object(i.b)("p",null,"There are other payment link related endpoints and methods that are available in the API and can be exploited by the integrator. Check out the complete list:"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../LinkdePagamento/EndpointsLink"}),"Change certain parameters/attributes of an existing payment link"))),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../LinkdePagamento/EndpointsLink"}),"cancel certain transaction"))),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../LinkdePagamento/EndpointsLink"}),"Change notification URL (notification_url) and/or transaction custom_id"))),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../LinkdePagamento/EndpointsLink"}),"Add information to transaction history"))),Object(i.b)("li",{parentName:"ul"},Object(i.b)("p",{parentName:"li"},Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"../LinkdePagamento/EndpointsLink"}),"Return transaction information")))),Object(i.b)("br",null),Object(i.b)("hr",null),Object(i.b)("h2",{id:"4-video-creating-transaction-via-playground-test-environmentsandbox"},"4. Video: Creating transaction via Playground (test environment/sandbox)"),Object(i.b)("p",null,"Thinking about offering new ways of transmitting information, Gerencianet makes the following video available in order to explain, in a clear and objective way, how to create a transaction via playground (sandbox)."),Object(i.b)("iframe",{width:"560",height:"315",src:"https://www.youtube.com/embed/ylqJUpHqwfY",frameborder:"0",allowfullscreen:!0}),Object(i.b)("br",null),Object(i.b)("br",null),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"Complete Course on Integration with the Gerencianet API")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"For access to other classes, on other subjects, access the page ",Object(i.b)("a",{href:"../CursosIntegracao/CursoOnline",title:"Link Interno"},"Integrations Online Course"),".")))))}m.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),r=n.n(a);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(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 o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(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,r=function(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=r.a.createContext({}),b=function(e){var t=r.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=b(e.components);return r.a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},m=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=b(n),m=a,p=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?r.a.createElement(p,o(o({ref:t},s),{},{components:n})):r.a.createElement(p,o({ref:t},s))}));function p(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,c=new Array(i);c[0]=m;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:a,c[1]=o;for(var s=2;s<i;s++)c[s]=n[s];return r.a.createElement.apply(null,c)}return r.a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},254:function(e,t,n){"use strict";function a(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}t.a=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a(e))&&(r&&(r+=" "),r+=t);return r}},255:function(e,t,n){"use strict";var a=n(0);const r=Object(a.createContext)({tabGroupChoices:{},setTabGroupChoices:()=>{},isAnnouncementBarClosed:!1,closeAnnouncementBar:()=>{}});t.a=r},256:function(e,t,n){"use strict";var a=n(0),r=n(255);t.a=function(){return Object(a.useContext)(r.a)}},257:function(e,t,n){"use strict";var a=n(0),r=n.n(a),i=n(256),c=n(254),o=n(92),l=n.n(o);const s=37,b=39;t.a=function(e){const{block:t,children:n,defaultValue:o,values:d,groupId:u}=e,{tabGroupChoices:m,setTabGroupChoices:p}=Object(i.a)(),[h,g]=Object(a.useState)(o);if(null!=u){const e=m[u];null!=e&&e!==h&&d.some(t=>t.value===e)&&g(e)}const j=e=>{g(e),null!=u&&p(u,e)},O=[];return r.a.createElement("div",null,r.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(c.a)("tabs",{"tabs--block":t})},d.map(({value:e,label:t})=>r.a.createElement("li",{role:"tab",tabIndex:"0","aria-selected":h===e,className:Object(c.a)("tabs__item",l.a.tabItem,{"tabs__item--active":h===e}),key:e,ref:e=>O.push(e),onKeyDown:e=>((e,t,n)=>{switch(n.keyCode){case b:((e,t)=>{const n=e.indexOf(t)+1;e[n]?e[n].focus():e[0].focus()})(e,t);break;case s:((e,t)=>{const n=e.indexOf(t)-1;e[n]?e[n].focus():e[e.length-1].focus()})(e,t)}})(O,e.target,e),onFocus:()=>j(e),onClick:()=>j(e)},t))),r.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(n).filter(e=>e.props.value===h)[0]))}},258:function(e,t,n){"use strict";var a=n(0),r=n.n(a);t.a=function(e){return r.a.createElement("div",null,e.children)}}}]);