Cancela um seguro viagem
curl --request POST \
--url https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"observations": "A viagem foi cancelada."
}
'import requests
url = "https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel"
payload = { "observations": "A viagem foi cancelada." }
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Accept: '<accept>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({observations: 'A viagem foi cancelada.'})
};
fetch('https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'observations' => 'A viagem foi cancelada.'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel"
payload := strings.NewReader("{\n \"observations\": \"A viagem foi cancelada.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "<accept>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"observations\": \"A viagem foi cancelada.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"observations\": \"A viagem foi cancelada.\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Seguro cancelado com sucesso"
}{
"message": "Unauthenticated."
}{
"message": "Resource not found."
}{
"message": "The given data was invalid.",
"errors": {
"credit_card": [
"validation.required_if"
],
"credit_card.number": [
"validation.required_if"
],
"credit_card.expirate_at": [
"validation.required_if"
],
"credit_card.cvv": [
"validation.required_if"
]
}
}{
"message": "Internal server error."
}Visão Geral
Cancela o PayPerUse
Por vezes algum contratempo na viagem do cliente pode fazê-lo querer cancelar a sua viagem, bem como os seguros atrelados a esta. Este endpoint cuida de cancelar um determinado seguro viagem para o dispositivo móvel, obedecendo a seguinte política:
- Faz-se necessário que o cancelamento seja executado até um dia antes da sua viagem;
- O cancelamento não é permitido em caso de a contratação ter acontecido há mais de 30 dias corridos.
Na requisição de cancelamento pode-se, porém não é obrigatório, enviar uma observação, seja para especificar o motivo do cancelamento ou qualquer natureza de comentário que possa ser um insumo interessante para que fique registrado.
POST
/
payperuse
/
travels
/
insurances
/
{id}
/
cancel
Cancela um seguro viagem
curl --request POST \
--url https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"observations": "A viagem foi cancelada."
}
'import requests
url = "https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel"
payload = { "observations": "A viagem foi cancelada." }
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Accept: '<accept>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({observations: 'A viagem foi cancelada.'})
};
fetch('https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'observations' => 'A viagem foi cancelada.'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel"
payload := strings.NewReader("{\n \"observations\": \"A viagem foi cancelada.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "<accept>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"observations\": \"A viagem foi cancelada.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://homolog.clubfix.com.br/webservice/payperuse/travels/insurances/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"observations\": \"A viagem foi cancelada.\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Seguro cancelado com sucesso"
}{
"message": "Unauthenticated."
}{
"message": "Resource not found."
}{
"message": "The given data was invalid.",
"errors": {
"credit_card": [
"validation.required_if"
],
"credit_card.number": [
"validation.required_if"
],
"credit_card.expirate_at": [
"validation.required_if"
],
"credit_card.cvv": [
"validation.required_if"
]
}
}{
"message": "Internal server error."
}integer
required
ID do seguro viagem que será cancelado. Este ID é retornado após a contratação do seguro.
string
required
Cabeçalho que indica o tipo de conteúdo aceito na resposta. Deve ser sempre
application/json.Authorizations
Token de autenticação obtido através do endpoint de autenticação
Headers
Path Parameters
ID do seguro viagem
Example:
6
Body
application/json
Observações sobre o cancelamento
Example:
"A viagem foi cancelada."
Response
Seguro cancelado com sucesso
Example:
"Seguro cancelado com sucesso"
Was this page helpful?
