1. Anexos
  2. Códigos

Anexos

Exemplos de Códigos

Exemplos de requisições a APIs, em diferentes linguagens.

Solicitação

Solicitação para Criar Checkout através da API

cURL
        curl --location 'https://serviceappi.com/basspago-sandbox/api/public/payments/create-payment-paycheckout' \
--header 'Encrypted-Security-Code: 766719440f6963f90b98757481844545d6fbeaf49e808ac7fdb867b6b856b1468190fcfddd1461ad2da464367cd069b7e769f6506750d9bfb147a9d5e80891fa' \
--header 'Content-Type: application/json' \
--data-raw '{
  "amount": "10",
  "externalId": "ABCD00001",
  "externalProductId": "PROD00001",
  "externalProductName": "Produto",
  "key": "19r17NxcQBBZiJsCqydpZvPkr3ZKFsru",
  "solicitacao": "Pagamento de Produto"
  "devedor": {
    "devedorCep": "98300000",
    "devedorEndereco": "Rua Jon Cecato",
    "devedorBairro": "Solar das Missoes",
    "devedorCidade": "Palmeira das Missoes",
    "devedorUf": "RS",
    "devedorDdd": "55",
    "devedorTelefone": "990010035",
    "devedorInscricaoNacional": "60375093072",
    "devedorMail": "[email protected]",
    "devedorNome": "BERNARDO FRANCISCO AGUIRRE"
  },
  "boleto": {
    "dataDeVencimento": "2023-08-18",
    "boletoDescontoDataFixa": "2023-08-14",
    "descontoValorPerc": 0,
    "jurosValorPerc": 0,
    "multaValorPerc": 0,
    "boletoExpired": 10
  },
  "pix": {
    "dataDeVencimento": "2023-08-18",
    "pixDescontoDataFixa": "2023-08-14",
    "descontoValorPerc": 0,
    "jurosValorPerc": 0,
    "multaValorPerc": 0,
    "pixExpired": 5
  }
}'

      
Java - OkHttp
        OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"amount\": \"10\",\r\n  \"externalId\": \"ABCD00001\",\r\n  \"externalProductId\": \"PROD00001\",\r\n  \"externalProductName\": \"Produto\",\r\n  \"key\": \"19r17NxcQBBZiJsCqydpZvPkr3ZKFsru\",\r\n  \"solicitacao\": \"Pagamento de Produto\"\r\n  \"devedor\": {\r\n    \"devedorCep\": \"98300000\",\r\n    \"devedorEndereco\": \"Rua Jon Cecato\",\r\n    \"devedorBairro\": \"Solar das Missoes\",\r\n    \"devedorCidade\": \"Palmeira das Missoes\",\r\n    \"devedorUf\": \"RS\",\r\n    \"devedorDdd\": \"55\",\r\n    \"devedorTelefone\": \"990010035\",\r\n    \"devedorInscricaoNacional\": \"60375093072\",\r\n    \"devedorMail\": \"[email protected]\",\r\n    \"devedorNome\": \"BERNARDO FRANCISCO AGUIRRE\"\r\n  },\r\n  \"boleto\": {\r\n    \"dataDeVencimento\": \"2023-08-18\",\r\n    \"boletoDescontoDataFixa\": \"2023-08-14\",\r\n    \"descontoValorPerc\": 0,\r\n    \"jurosValorPerc\": 0,\r\n    \"multaValorPerc\": 0,\r\n    \"boletoExpired\": 10\r\n  },\r\n  \"pix\": {\r\n    \"dataDeVencimento\": \"2023-08-18\",\r\n    \"pixDescontoDataFixa\": \"2023-08-14\",\r\n    \"descontoValorPerc\": 0,\r\n    \"jurosValorPerc\": 0,\r\n    \"multaValorPerc\": 0,\r\n    \"pixExpired\": 5\r\n  }\r\n}");
Request request = new Request.Builder()
  .url("https://serviceappi.com/basspago-sandbox/api/public/payments/create-payment-paycheckout")
  .method("POST", body)
  .addHeader("Encrypted-Security-Code", "766719440f6963f90b98757481844545d6fbeaf49e808ac7fdb867b6b856b1468190fcfddd1461ad2da464367cd069b7e769f6506750d9bfb147a9d5e80891fa")
  .addHeader("Content-Type", "application/json")
  .build();
Response response = client.newCall(request).execute();

      
PHP - cURL
        <?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://serviceappi.com/basspago-sandbox/api/public/payments/create-payment-paycheckout',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "amount": "10",
  "externalId": "ABCD00001",
  "externalProductId": "PROD00001",
  "externalProductName": "Produto",
  "key": "19r17NxcQBBZiJsCqydpZvPkr3ZKFsru",
  "solicitacao": "Pagamento de Produto"
  "devedor": {
    "devedorCep": "98300000",
    "devedorEndereco": "Rua Jon Cecato",
    "devedorBairro": "Solar das Missoes",
    "devedorCidade": "Palmeira das Missoes",
    "devedorUf": "RS",
    "devedorDdd": "55",
    "devedorTelefone": "990010035",
    "devedorInscricaoNacional": "60375093072",
    "devedorMail": "[email protected]",
    "devedorNome": "BERNARDO FRANCISCO AGUIRRE"
  },
  "boleto": {
    "dataDeVencimento": "2023-08-18",
    "boletoDescontoDataFixa": "2023-08-14",
    "descontoValorPerc": 0,
    "jurosValorPerc": 0,
    "multaValorPerc": 0,
    "boletoExpired": 10
  },
  "pix": {
    "dataDeVencimento": "2023-08-18",
    "pixDescontoDataFixa": "2023-08-14",
    "descontoValorPerc": 0,
    "jurosValorPerc": 0,
    "multaValorPerc": 0,
    "pixExpired": 5
  }
}',
  CURLOPT_HTTPHEADER => array(
    'Encrypted-Security-Code: 766719440f6963f90b98757481844545d6fbeaf49e808ac7fdb867b6b856b1468190fcfddd1461ad2da464367cd069b7e769f6506750d9bfb147a9d5e80891fa',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


      

Anterior <- WebHook
Próximo Erros ->