A API de integração do ClearSale permite que os integradores enviem pedidos para análise de acordo com o tipo de produto contratado. Através da API é possível enviar pedidos e consultar informações relevantes da análise da ClearSale.
The ClearSale's API allows your company to submit orders and consult relevant information from ClearSale's analysis according to the contracted product.
Algumas integrações necessitam ser homologadas. Os dados dos pedidos enviados no ambiente de homologação devem ser fictícios, evitando dados reais dos clientes, mas que atendam as orientações desta documentação.
Some client integrations need to be tested. The order data sent in the sandbox environment must be fictitious, avoiding real customer data, but it must reflects the guidelines in this documentation.
Click here to download Sandbox Steps document.Todas as requisições submetidas à nossa API devem ser realizadas através de um token de 2048 caracteres.
O token é gerado através de um usuário e senha que deve ser fornecido pela ClearSale.
Entre em contato com o seu consultor de vendas para maiores informações.
Na autenticação, além do token retornamos sua data de expiração. É necessário que contemple no seu desenvolvimento o gerenciamento da vida útil do token com base nessa data de expiração.
Para o recebimento desse dado é necessário que reserve um espaço de 2048 caracteres. Só gere um novo token após a expiração do seu token atual.
POST https://api.clearsale.com.br/v1/authenticate HTTP/1.1
Content-Type: application/json
{
"name": "{Your User}",
"password": "{Your Password}"
}
POST https://homologacao.clearsale.com.br/api/v1/authenticate HTTP/1.1
Content-Type: application/json
{
"name": "{Your User}",
"password": "{Your Password}"
}
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"Token": "{Token value}",
"ExpirationDate": "{Token expiration date}"
}
POST https://api.clearsale.com.br/v1/orders/
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"code": "ORDER_EXAMPLE_0_0_1",
"sessionID": "SessionIDValue",
"date": "2017-03-22T13:38:59.9894222",
"email": "email@email.com.br",
"b2bB2c": "B2C",
"itemValue": 10.00,
"totalValue": 15.00,
"numberOfInstallments": 1,
"ip": "192.168.0.1",
"giftMessage": "Message Example",
"observation": "Observation example",
"status": 0,
"origin": "Origin example",
"channelID": "Additional origin information",
"reservationDate": "2017-03-21T22:36:36.0000000",
"product": 1,
"billing": {
"clientID": "Client123",
"type": 1,
"primaryDocument": "12345678910",
"secondaryDocument": "12345678",
"name": "Complete Client Name",
"birthDate": "1990-01-10T00:00:00.000",
"email": "email@email.com.br",
"gender": "M",
"address": {
"street": "Street name example",
"number": "0",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
},
"phones": [{
"type": 1,
"ddi": 55,
"ddd": 11,
"number": 33333333,
"extension": "1111"
}]
},
"shipping": {
"clientID": "Client123",
"type": 1,
"primaryDocument": "12345678910",
"secondaryDocument": "12345678",
"name": "Complete Client Name",
"birthDate": "1990-01-10T00:00:00.000",
"email": "email@email.com.br",
"gender": "M",
"address": {
"street": "Street name example",
"number": "0",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
},
"phones": [{
"type": 1,
"ddi": 55,
"ddd": 11,
"number": 33333333,
"extension": "1111"
}],
"deliveryTime": "2 dias úteis",
"price": 5.00
},
"payments": [{
"sequential": 1,
"date": "2017-03-21T22:36:53.0000000",
"value": 0.00,
"type": 1,
"installments": 1,
"card": {
"number": "123456xxxxxx1234",
"hash": "12345678945612301234569874563210",
"bin": "123456",
"end": "1234",
"type": 1,
"validityDate": "02/2021",
"ownerName": "Owner Card Name",
"document": "12345678910",
"nsu": "12345"
}
}],
"items": [{
"code": "Item Code",
"name": "Item description",
"value": 10.00,
"amount": 1,
"categoryID": 1,
"categoryName": "Item category name",
"sellerName": "Seller Name",
"sellerDocument": "12345678910123",
"isMarketPlace": "true",
"sellerSegment": "Eletronicos"
}],
"passengers": [{
"name": "Passanger name",
"companyMileCard": "Company Name",
"mileCard": "123456789",
"identificationType": 1,
"identificationNumber": "123456789",
"gender": "M",
"birthdate": "1990-01-10T00:00:00.000",
"cpf": "12345678910"
}],
"connections": [{
"company": "JJ",
"identificationNumber": 12345,
"date": "2017-10-10T00:00:00.000",
"seatClass": "Seat Class",
"origin": "GRU",
"destination": "LHR",
"boarding": "2017-10-10T00:00:00.000",
"arriving": "2017-10-10T00:00:00.000",
"fareClass": "First Class"
}]
}
POST https://homologacao.clearsale.com.br/api/v1/orders/
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"code": "ORDER_EXAMPLE_0_0_1",
"sessionID": "SessionIDValue",
"date": "2017-03-22T13:38:59.9894222",
"email": "email@email.com.br",
"b2bB2c": "B2C",
"itemValue": 10.00,
"totalValue": 15.00,
"numberOfInstallments": 1,
"ip": "192.168.0.1",
"giftMessage": "Message Example",
"observation": "Observation example",
"status": 0,
"origin": "Origin example",
"channelID": "Additional origin information",
"reservationDate": "2017-03-21T22:36:36.0000000",
"product": 1,
"billing": {
"clientID": "Client123",
"type": 1,
"primaryDocument": "12345678910",
"secondaryDocument": "12345678",
"name": "Complete Client Name",
"birthDate": "1990-01-10T00:00:00.000",
"email": "email@email.com.br",
"gender": "M",
"address": {
"street": "Street name example",
"number": "0",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
},
"phones": [{
"type": 1,
"ddi": 55,
"ddd": 11,
"number": 33333333,
"extension": "1111"
}]
},
"shipping": {
"clientID": "Client123",
"type": 1,
"primaryDocument": "12345678910",
"secondaryDocument": "12345678",
"name": "Complete Client Name",
"birthDate": "1990-01-10T00:00:00.000",
"email": "email@email.com.br",
"gender": "M",
"address": {
"street": "Street name example",
"number": "0",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
},
"phones": [{
"type": 1,
"ddi": 55,
"ddd": 11,
"number": 33333333,
"extension": "1111"
}],
"deliveryTime": "2 dias úteis",
"price": 5.00
},
"payments": [{
"sequential": 1,
"date": "2017-03-21T22:36:53.0000000",
"value": 0.00,
"type": 1,
"installments": 1,
"card": {
"number": "123456xxxxxx1234",
"hash": "12345678945612301234569874563210",
"bin": "123456",
"end": "1234",
"type": 1,
"validityDate": "02/2021",
"ownerName": "Owner Card Name",
"document": "12345678910",
"nsu": "12345"
}
}],
"items": [{
"code": "Item Code",
"name": "Item description",
"value": 10.00,
"amount": 1,
"categoryID": 1,
"categoryName": "Item category name",
"sellerName": "Seller Name",
"sellerDocument": "12345678910123",
"isMarketPlace": "true",
"sellerSegment": "Eletronicos"
}],
"passengers": [{
"name": "Passanger name",
"companyMileCard": "Company Name",
"mileCard": "123456789",
"identificationType": 1,
"identificationNumber": "123456789",
"gender": "M",
"birthdate": "1990-01-10T00:00:00.000",
"cpf": "12345678910"
}],
"connections": [{
"company": "JJ",
"identificationNumber": 12345,
"date": "2017-10-10T00:00:00.000",
"seatClass": "Seat Class",
"origin": "GRU",
"destination": "LHR",
"boarding": "2017-10-10T00:00:00.000",
"arriving": "2017-10-10T00:00:00.000",
"fareClass": "First Class"
}]
}
Content-Type: application/json
Request-ID: 12J6-11B3-11A7-93C0
{
"packageID": "4825dc1d-5246-45d3-ba32-d2de9bbff478",
"orders": [
{
"code": "{CODIGO_DO_MEU_PEDIDO}",
"status": "APA",
"score": 99.99
}
]
}
All sent requests must be realize through a 2048 char token.
A token is generate through a user login and a password that are sent by ClearSale.
Please contact your sales consultant for more information.
During the authentication, the expiration date is sent. It is necessary that you consider in your development the management of the useful life of the token based on it expiration date.
To receive this data, it is necessary to reserve a space of 2048 characters. Only generate a new token after your current token has expired.
POST https://api.clearsale.com.br/v1/authenticate HTTP/1.1
Content-Type: application/json
{
"name": "{Your User}",
"password": "{Your Password}"
}
POST https://homologacao.clearsale.com.br/api/v1/authenticate HTTP/1.1
Content-Type: application/json
{
"name": "{Your User}",
"password": "{Your Password}"
}
POST https://api.clearsale.com.br/v1/orders/
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"code": "ORDER_EXAMPLE_2_0_1",
"sessionID": "SessionIDValue",
"date": "2017-03-22T13:38:59.9894222",
"email": "email@email.com.br",
"b2bB2c": "B2C",
"itemValue": 10.00,
"totalValue": 15.00,
"numberOfInstallments": 1,
"ip": "192.168.0.1",
"isGift": false,
"giftMessage": "Message Example",
"observation": "Observation example",
"status": 0,
"origin": "Origin example",
"channelID": "Additional origin information",
"reservationDate": "2017-03-21T22:36:36.0000000",
"country": "Brasil",
"nationality": "Brasileiro",
"product": 1,
"customSla": 60,
"bankAuthentication": "Aprovado 3DS",
"subAcquirer": "Sub Acquirer Name",
"list": {
"typeID": 3,
"id": "List Code Example"
},
"purchaseInformation": {
"lastDateInsertedMail": "2015-03-01T02:40:00",
"lastDateChangePassword": "2015-04-02T05:15:00",
"lastDateChangePhone": "2015-05-03T10:45:00",
"lastDateChangeMobilePhone": "2015-06-04T12:05:00",
"lastDateInsertedAddress": "2015-07-05T15:25:00",
"purchaseLogged": false,
"email": "email@pemail.com.br",
"login": "SocialNetworkLogin"
},
"socialNetwork": {
"optInCompreConfie": 1,
"typeSocialNetwork": 2,
"authenticationToken": "123456abcd"
},
"billing": {
"clientID": "Client123",
"type": 1,
"primaryDocument": "12345678910",
"secondaryDocument": "12345678",
"name": "Complete Client Name",
"birthDate": "1990-01-10T00:00:00.000",
"email": "email@email.com.br",
"gender": "M",
"address": {
"street": "Street name example",
"number": "100",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
},
"phones": [{
"type": 1,
"ddi": 55,
"ddd": 11,
"number": 33333333,
"extension": "1111"
}
]
},
"shipping": {
"clientID": "Client123",
"type": 1,
"primaryDocument": "12345678910",
"secondaryDocument": "12345678",
"name": "Complete Client Name",
"birthDate": "1990-01-10T00:00:00.000",
"email": "email@email.com.br",
"gender": "M",
"address": {
"street": "Street name example",
"number": "100",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
},
"phones": [{
"type": 1,
"ddi": 55,
"ddd": 11,
"number": 33333333,
"extension": "1111"
}
],
"deliveryType": "1",
"deliveryTime": "2 dias úteis",
"price": 5.00,
"pickUpStoreDocument": "12345678910"
},
"payments": [{
"sequential": 1,
"date": "2017-03-21T22:36:53.0000000",
"value": 25.00,
"type": 1,
"installments": 1,
"interestRate": 10,
"interestValue": 2.00,
"currency": 986,
"voucherOrderOrigin": "123456",
"card": {
"number": "123456xxxxxx1234",
"hash": "12345678945612301234569874563210",
"bin": "123456",
"end": "1234",
"type": 1,
"validityDate": "02/2021",
"ownerName": "Owner Card Name",
"document": "12345678910",
"nsu": "12345"
},
"address": {
"street": "Street name example",
"number": "10",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
}
}
],
"items": [{
"code": "Item Code",
"name": "Item description",
"barCode": "1234567891012",
"value": 10.00,
"amount": 1,
"categoryID": 1,
"categoryName": "Item category name",
"isGift": true,
"sellerName": "Seller Name",
"sellerDocument": "12345678910123",
"isMarketPlace": "true",
"sellerSegment": "Eletronicos",
"shippingCompany": "Shipping Company Name"
}
],
"passengers": [{
"name": "Passanger name",
"companyMileCard": "Company Name",
"mileCard": "123456789",
"identificationType": 1,
"identificationNumber": "123456789",
"gender": "M",
"birthdate": "1990-01-10T00:00:00.000",
"cpf": "12345678910"
}
],
"connections": [{
"company": "JJ",
"identificationNumber": 12345,
"date": "2017-10-10T00:00:00.000",
"seatClass": "Seat Class",
"origin": "GRU",
"destination": "LHR",
"boarding": "2017-10-10T00:00:00.000",
"arriving": "2017-10-10T00:00:00.000",
"fareClass": "First Class"
}
],
"hotels": [{
"name": "Hotel Name",
"city": "Hotel City",
"state": "Hotel State",
"country": "Hotel Country",
"reservationDate": "2017-10-10T00:00:00.000",
"reserveExpirationDate": "2017-10-10T00:00:00.000",
"checkInDate": "2017-10-10T00:00:00.000",
"checkOutDate": "2017-10-10T00:00:00.000"
}
]
}
POST https://homologacao.clearsale.com.br/api/v1/orders/
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"code": "ORDER_EXAMPLE_2_0_1",
"sessionID": "SessionIDValue",
"date": "2017-03-22T13:38:59.9894222",
"email": "email@email.com.br",
"b2bB2c": "B2C",
"itemValue": 10.00,
"totalValue": 15.00,
"numberOfInstallments": 1,
"ip": "192.168.0.1",
"isGift": false,
"giftMessage": "Message Example",
"observation": "Observation example",
"status": 0,
"origin": "Origin example",
"channelID": "Additional origin information",
"reservationDate": "2017-03-21T22:36:36.0000000",
"country": "Brasil",
"nationality": "Brasileiro",
"product": 1,
"customSla": 60,
"bankAuthentication": "Aprovado 3DS",
"subAcquirer": "Sub Acquirer Name",
"list": {
"typeID": 3,
"id": "List Code Example"
},
"purchaseInformation": {
"lastDateInsertedMail": "2015-03-01T02:40:00",
"lastDateChangePassword": "2015-04-02T05:15:00",
"lastDateChangePhone": "2015-05-03T10:45:00",
"lastDateChangeMobilePhone": "2015-06-04T12:05:00",
"lastDateInsertedAddress": "2015-07-05T15:25:00",
"purchaseLogged": false,
"email": "email@pemail.com.br",
"login": "SocialNetworkLogin"
},
"socialNetwork": {
"optInCompreConfie": 1,
"typeSocialNetwork": 2,
"authenticationToken": "123456abcd"
},
"billing": {
"clientID": "Client123",
"type": 1,
"primaryDocument": "12345678910",
"secondaryDocument": "12345678",
"name": "Complete Client Name",
"birthDate": "1990-01-10T00:00:00.000",
"email": "email@email.com.br",
"gender": "M",
"address": {
"street": "Street name example",
"number": "100",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
},
"phones": [{
"type": 1,
"ddi": 55,
"ddd": 11,
"number": 33333333,
"extension": "1111"
}
]
},
"shipping": {
"clientID": "Client123",
"type": 1,
"primaryDocument": "12345678910",
"secondaryDocument": "12345678",
"name": "Complete Client Name",
"birthDate": "1990-01-10T00:00:00.000",
"email": "email@email.com.br",
"gender": "M",
"address": {
"street": "Street name example",
"number": "100",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
},
"phones": [{
"type": 1,
"ddi": 55,
"ddd": 11,
"number": 33333333,
"extension": "1111"
}
],
"deliveryType": "1",
"deliveryTime": "2 dias úteis",
"price": 5.00,
"pickUpStoreDocument": "12345678910"
},
"payments": [{
"sequential": 1,
"date": "2017-03-21T22:36:53.0000000",
"value": 25.00,
"type": 1,
"installments": 1,
"interestRate": 10,
"interestValue": 2.00,
"currency": 986,
"voucherOrderOrigin": "123456",
"card": {
"number": "123456xxxxxx1234",
"hash": "12345678945612301234569874563210",
"bin": "123456",
"end": "1234",
"type": 1,
"validityDate": "02/2021",
"ownerName": "Owner Card Name",
"document": "12345678910",
"nsu": "12345"
},
"address": {
"street": "Street name example",
"number": "10",
"additionalInformation": "Additional information example",
"county": "County Example",
"city": "City Example",
"state": "SP",
"zipcode": "12345678",
"country": "Brasil",
"reference": "Address reference example"
}
}
],
"items": [{
"code": "Item Code",
"name": "Item description",
"barCode": "1234567891012",
"value": 10.00,
"amount": 1,
"categoryID": 1,
"categoryName": "Item category name",
"isGift": true,
"sellerName": "Seller Name",
"sellerDocument": "12345678910123",
"isMarketPlace": "true",
"sellerSegment": "Eletronicos",
"shippingCompany": "Shipping Company Name"
}
],
"passengers": [{
"name": "Passanger name",
"companyMileCard": "Company Name",
"mileCard": "123456789",
"identificationType": 1,
"identificationNumber": "123456789",
"gender": "M",
"birthdate": "1990-01-10T00:00:00.000",
"cpf": "12345678910"
}
],
"connections": [{
"company": "JJ",
"identificationNumber": 12345,
"date": "2017-10-10T00:00:00.000",
"seatClass": "Seat Class",
"origin": "GRU",
"destination": "LHR",
"boarding": "2017-10-10T00:00:00.000",
"arriving": "2017-10-10T00:00:00.000",
"fareClass": "First Class"
}
],
"hotels": [{
"name": "Hotel Name",
"city": "Hotel City",
"state": "Hotel State",
"country": "Hotel Country",
"reservationDate": "2017-10-10T00:00:00.000",
"reserveExpirationDate": "2017-10-10T00:00:00.000",
"checkInDate": "2017-10-10T00:00:00.000",
"checkOutDate": "2017-10-10T00:00:00.000"
}
]
}
Content-Type: application/json
Request-ID: 12J6-11B3-11A7-93C0
{
"packageID": "4825dc1d-5246-45d3-ba32-d2de9bbff478",
"orders": [
{
"code": "{CODIGO_DO_MEU_PEDIDO}",
"status": "NVO",
"score": null
}
]
}
Sempre que ocorrer alterações no status de um pedido, o Webhook da Clearsale irá enviar uma notificação da alteração (sem o status) para uma URL que deverá ser desenvolvida no lado do integrador.
A URL deverá ser capaz de interpretar a requisição abaixo:
POST {URL_DO_INTEGRADOR}
Content-Type: application/json
{
"code": "{CODIGO_DO_MEU_PEDIDO}",
"date": "2016-01-01T10:30:00.9931909-02:00",
"type": "status"
}
Importante: Assim que a URL for desenvolvida, é necessário que seja enviada a equipe de integração da ClearSale através do e-mail integracao@clear.sale, para que ela seja configurada em nossa base de dados.
O status não será informado na notificação do Webhook e deverá ser consultado via API, vide Consulta de Status.
Se a URL do integrador retornar qualquer status http diferente de 200, o Webhook irá tentar notificar novamente para o pedido.
Webhook is the platform in charge of notifying customers about notifications that may occur within our system. Whenever an event happens, our API sends a HTTP request to the client URL, which contains information related to the event.
POST {CLIENT_URL}
Content-Type: application/json
{
"code": "{ORDER_CODE}",
"date": "2016-01-01T10:30:00.9931909-02:00",
"type": "status"
}
In order to keep this interaction safer, the notification will only notify that something has changed. However, it will not contain specific information about the event. Setup: The Webhook relies on an URL, which must be developed by the Customer/Gateway and capable of translating the HTTP notification, which has the format showed above.
Important: If the URL of the integrator returns any http status other than 200, Webhook will try to notify you again for the request.
For the Realtime Decision product the development of Webhook is optional since the status and score are already obtained in the response of the order submission request.
If you choose this development, as soon as the URL is developed it is necessary to send the address to the integration team via email integracao@clear.sale so that this URL is configured in the Clearsale database.
GET https://api.clearsale.com.br/v1/orders/{CODIGO_DO_MEU_PEDIDO}/status
Accept: application/json
Authorization: Bearer {TOKEN}
GET https://homologacao.clearsale.com.br/api/v1/orders/{CODIGO_DO_MEU_PEDIDO}/status
Accept: application/json
Authorization: Bearer {TOKEN}
Content-Type: application/json
Request-ID: 12J6-11B3-11A7-93C0
{
"code": "{CODIGO_DO_MEU_PEDIDO}",
"status": "APA",
"score": 99.99
}
GET https://api.clearsale.com.br/v1/orders/{ORDER_CODE}/status
Accept: application/json
Authorization: Bearer {TOKEN}
GET https://homologacao.clearsale.com.br/api/v1/orders/{ORDER_CODE}/status
Accept: application/json
Authorization: Bearer {TOKEN}
Content-Type: application/json
Request-ID: 12J6-11B3-11A7-93C0
{
"code": "{ORDER_CODE}",
"status": "APA",
"score": 99.99
}
PUT https://api.clearsale.com.br/v1/orders/{CODIGO_DO_MEU_PEDIDO}/status
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"status": "Sigla do status"
}
PUT https://homologacao.clearsale.com.br/api/v1/orders/{CODIGO_DO_MEU_PEDIDO}/status
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"status": "Sigla do status"
}
Exemplo de status de pagamento
Content-Type: application/json
Request-ID: 12J6-11B3-11A7-93C0
{
"status": "OK",
"message": "Status was changed with success"
}
Importante: Os status de atualização devem ser combinados com a equipe de integração.
PUT https://api.clearsale.com.br/v1/orders/{ORDER_CODE}/status
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"status ": "status initials"
}
PUT https://homologacao.clearsale.com.br/api/v1/orders/{ORDER_CODE}/status
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"status ": "status initials"
}
Content-Type: application/json
Request-ID: 12J6-11B3-11A7-93C0
{
"status": "OK",
"message": "Status was changed with success"
}
Note: The update status must be agreed upon with the integration team.
POST https://api.clearsale.com.br/v1/chargeback
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"message" : "Message example",
"orders" : ["{ORDER_CODE}"]
}
POST https://homologacao.clearsale.com.br/api/v1/chargeback
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"message" : "Message example",
"orders" : ["{ORDER_CODE}"]
}
Content-Type: application/json
Request-ID: 12J6-11B3-11A7-93C0
{
"code": "{ORDER_CODE}",
"status": "Chargeback done"
}
POST https://api.clearsale.com.br/v1/chargeback
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"message" : "Message example",
"orders" : ["{ORDER_CODE}"]
}
POST https://homologacao.clearsale.com.br/api/v1/chargeback
Content-Type: application/json
Authorization: Bearer {TOKEN}
{
"message" : "Message example",
"orders" : ["{ORDER_CODE}"]
}
Content-Type: application/json
Request-ID: 12J6-11B3-11A7-93C0
{
"code": "{ORDER_CODE}",
"status": "Chargeback done"
}
Código | Descrição |
---|---|
0 | Não definido |
1 | Residencial |
2 | Comercial |
3 | Recados |
4 | Cobrança |
5 | Temporário |
6 | Celular |
ID | Description |
---|---|
0 | Undefined |
1 | Home |
2 | Work |
3 | Messages |
4 | Billing Phone |
5 | Temporary |
6 | Mobile |
Código | Descrição |
---|---|
1 | CPF |
2 | CNPJ |
3 | RG |
4 | IE |
5 | Passaporte |
6 | CTPS |
7 | Título Eleitor |
ID | Description |
---|---|
1 | CPF |
2 | CNPJ |
3 | RG |
4 | IE |
5 | Passport |
6 | CTPS |
7 | Voter ID Card |
Código | Descrição |
---|---|
1 | Pessoa Física |
2 | Pessoa Jurídica |
ID | Description |
---|---|
1 | Natural Person |
2 | Legal Person |
Código | Descrição |
---|---|
M | Masculino |
F | Feminino |
ID | Description |
---|---|
M | Male |
F | Female |
Código | Descrição |
---|---|
1 | Cartão de Crédito |
2 | Boleto Bancário |
3 | Débito Bancário |
4 | Débito Bancário - Dinheiro |
5 | Débito Bancário - Cheque |
6 | Transferência Bancária |
7 | Sedex a cobrar |
8 | Cheque |
9 | Dinheiro |
10 | Financiamento |
11 | Fatura |
12 | Cupom |
13 | Multicheque |
14 | Outros |
16 | Vale |
19 | Cartão de Débito |
23 | Vale Alimentação |
27 | PIX |
28 | Cashback |
1041 | Cartão Presente Virtual |
4011 | Cartão de Débito / Transferência Eletrônica (CD) |
ID | Description |
---|---|
1 | Credit Card |
2 | Bank Slip |
3 | Bank Debit |
4 | Bank Debit - Money |
5 | Bank Debit - Check |
6 | Bank Transfer |
7 | Sedex |
8 | Check |
9 | Money |
10 | Financing |
11 | Invoice |
12 | Coupon |
13 | Multicheque |
14 | Other |
16 | Voucher |
19 | Debit Card |
23 | Food voucher |
27 | PIX |
28 | Cashback |
1041 | Virtual gift card |
4011 | Debit Card / Eletronic transfer |
Código | Descrição |
---|---|
1 | Diners |
2 | MasterCard |
3 | Visa |
4 | Outros |
5 | American Express |
6 | HiperCard |
7 | Aura |
10 | Cartão Elo |
40 | NCard |
50 | LeaderCard |
100 | Fortbrasil |
101 | Sorocred |
102 | A Vista |
103 | Cartão Mais |
105 | Cartão C&A |
ID | Description |
---|---|
1 | Diners |
2 | MasterCard |
3 | Visa |
4 | Other |
5 | American Express |
6 | HiperCard |
7 | Aura |
10 | Elo Card |
40 | NCard |
50 | LeaderCard |
100 | Fortbrasil |
101 | Sorocred |
102 | Debit Card |
103 | Mais Card |
105 | C&A Card |
Status | Descrição |
---|---|
APA | (Aprovação Automática) – Pedido foi aprovado automaticamente segundo parâmetros definidos na regra de aprovação automática |
RPA | (Reprovação Automática) – Pedido Reprovado Automaticamente por algum tipo de Regra de Negócio que necessite aplicá-la |
RPP | (Reprovação Por Política) – Pedido reprovado automaticamente por política estabelecida pelo cliente ou Clearsale |
APP | (Aprovação Por Política) – Pedido aprovado automaticamente por política estabelecida pelo cliente ou Clearsale |
ID | Description |
---|---|
APA | Automatic Approval - Order automatically approved based on predefined rule |
RPA | Denied Automatically - Order automatically denied based on predefined rule (Not recommended) |
RPP | Denied by Policies – Order denied due to policies defined by ClearSale or customer |
APP | Approved by Policies – Order approved due to policies defined by ClearSale or customer |
Atenção: Ao enviar o status no pedido é importante ressaltar que este pedido será incluso como histórico e não será analisado pela ClearSale.
Somente os pedidos que forem enviados com o status 0 – NVO ou que não tiverem o status definido que serão analisados pelo ClearSale.
Código | Descrição |
---|---|
0 | Novo (será analisado pelo ClearSale) |
9 | Aprovado (irá ao ClearSale já aprovado e não será analisado) |
41 | Cancelado pelo cliente (irá ao ClearSale já cancelado e não será analisado) |
45 | Reprovado (irá ao ClearSale já reprovado e não será analisado) |
Important: Only orders with status 0 (NVO) or without status will be analyzed. ClearSale will save as history, all the orders that have a different status.
ID | Description |
---|---|
0 | New |
9 | Approved - This order will not be analyzed by Clearsale |
41 | Cancelled by the customer - This order will not be analyzed by Clearsale |
45 | Denied - The order will not be analyzed by Clearsale |
Código | Descrição |
---|---|
PGA | Pedido Aprovado |
PGR | Pedido Reprovado |
ID | Description |
---|---|
PGA | Payment Approved |
PGR | Payment Denied |
ID | Descrição |
---|---|
-1 | Outros |
1 | Application |
3 | Total |
4 | Total Garantido |
9 | Score |
10 | Realtime Decision |
11 | Tickets |
ID | Description |
---|---|
-1 | Other |
1 | Application |
3 | Total |
4 | Total Guaranteed |
9 | Score |
10 | Realtime Decision |
11 | Tickets |
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
code | Código do pedido | String | 50 | S |
sessionID | Identificador único da sessão do usuário | String | 128 | S |
date | Data do pedido | Datetime | S | |
Email do pedido | String | 150 | S | |
b2bB2c | Tipo do ecommerce | String | 3 | N |
itemValue | Valor Total dos Itens | Decimal | 20,4 | N |
totalValue | Valor Total do Pedido | Decimal | 20,4 | S |
numberOfInstallments | Quantidade de Parcelas | Integer | N | |
ip | IP do Pedido | String | 50 | N |
giftMessage | Mensagem de Presente | String | 8000 | N |
observation | Observação do Pedido | String | 8000 | N |
status | Status do Pedido | Integer | N | |
origin | Origem do Pedido | String | 150 | N |
channelID | Origem complementar | String | 150 | N |
reservationDate | Data de reserva de Voo | Datetime | N | |
product | ID do produto | Integer | N | |
billing | Dados de cobrança | billing | S | |
shipping | Dados de entrega | shipping | N | |
payments | Dados de pagamento | Array<payment> | S | |
items | items | Array<item> | S | |
passengers | passengers | Array<passenger> | N | |
connections | connections | Array<connection> | N |
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
code | Order identification | String | 50 | Y |
sessionID | The user session id of the website | String | 128 | Y |
date | Order date | Datetime | Y | |
Order email | String | 150 | Y | |
b2bB2c | Ecommerce type | String | 3 | N |
itemValue | Total value of the items | Decimal | 20,4 | N |
totalValue | Total value of the order | Decimal | 20,4 | Y |
numberOfInstallments | Quantity of installments | Integer | N | |
ip | IP of the user who did | String | 50 | N |
giftMessage | Message of the gift | String | 8000 | N |
observation | Order note | String | 8000 | N |
status | Initial order statusSee the list at Initial Status List | Integer | N | |
origin | Order origin | String | 150 | N |
channelID | Additional order origin info | String | 150 | N |
reservationDate | Flight reservation date | Datetime | N | |
product | Product ID | Integer | N | |
billing | Object billing | billing | Y | |
shipping | Object shipping | shipping | N | |
payments | Object payments | Array<payment> | Y | |
items | Object item | Array<item> | Y | |
passengers | Object passengers | Array<passenger> | N | |
connections | Object connections | Array<connection> | N |
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
clientID | Código do cliente | String | 50 | N |
type | Pessoa Física ou Jurídica | Integer | S | |
primaryDocument | CPF ou CNPJ | String | 100 | S |
secondaryDocument | RG ou Inscrição Estadual | String | 100 | N |
name | Nome do cliente | String | 500 | S |
birthDate | Data de Nascimento | Datetime | N | |
String | 150 | N | ||
gender | Sexo | String | 1 | N |
address | Endereço | address | N | |
phones | Telefones | Array<phone> | N |
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
clientID | Customer ID | String | 50 | N |
type | Natual or Legal Person See the list at Person Type List | Integer | Y | |
primaryDocument | CPF or CNPJ | String | 100 | Y |
secondaryDocument | RG or state registration | String | 100 | N |
name | Customer name | String | 500 | Y |
birthDate | Customer birth date | Datetime | N | |
String | 150 | N | ||
gender | Gender See the list at Gender List | String | 1 | N |
address | Object address | address | N | |
phones | Object Phones | Array<phone> | N |
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
clientID | Código do cliente | String | 50 | N |
type | Pessoa Física ou Jurídica | Integer | N | |
primaryDocument | CPF ou CNPJ | String | 100 | N |
secondaryDocument | RG ou Inscrição Estadual | String | 100 | N |
name | Nome do cliente | String | 500 | N |
birthDate | Data de Nascimento | Datetime | N | |
String | 150 | N | ||
gender | Sexo | String | 1 | N |
address | Endereço | address | N | |
phones | Telefones | Array<phone> | N | |
deliveryTime | Prazo de Entrega | String | 50 | N |
price | Valor do Frete | Decimal | 20,4 | N |
Importante: Se em sua regra de negócio existir entrega física, os dados de entrega (shipping) deverão ser informados.
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
clientID | Customer ID | String | 50 | N |
type | Natural or Legal PersonSee the list at Person Type List | Integer | N | |
primaryDocument | CPF or CNPJ | String | 100 | N |
secondaryDocument | RG or state registration | String | 100 | N |
name | Customer name | String | 500 | N |
birthDate | Customer birth date | Datetime | N | |
String | 150 | N | ||
gender | Gender See the list at Gender List | String | 1 | N |
address | Object Address | address | N | |
phones | Object phones | Array<phone> | N | |
deliveryTime | Delivery Time | String | 50 | N |
price | Shipping Price | Decimal | 20,4 | N |
Note: If in your business rule there is physical delivery, the delivery data (shipping) should be informed.
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
sequential | Sequência de realização do pagamento | Integer | N | |
date | Data do pagamento | Datetime | N | |
value | Valor cobrado neste pagamento | Decimal | 20,4 | N |
type | Tipo de Pagamento | Integer | S | |
installments | Quantidade de Parcelas | Integer | N | |
card | cartão | card | S |
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
sequential | Number indicating the payment sequence | Integer | N | |
date | Payment date | Datetime | N | |
value | Payment value | Decimal | 20,4 | N |
type | Payment type See the list at Payment Type List | Integer | Y | |
installments | Amount of installments | Integer | N | |
card | Object card | card | Y |
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
code | Código do Produto | String | 50 | N |
name | Nome do Produto | String | 150 | Y |
value | Valor Unitário | Decimal | 20,4 | N |
amount | Quantidade | Integer | N | |
categoryID | Código da Categoria do Produto | Integer | N | |
categoryName | Nome da Categoria do Produto | String | 200 | N |
sellerName | Nome fantasia do seller/parceiro | String | 200 | N |
sellerDocument | CNPJ do seller/parceiro | String | 14 | N |
isMarketPlace | Para informar que há dados de seller, o valor deverá ser semprer ”true”. | String | 5 | N |
sellerSegment | Segmento do seller/parceiro. | String | 200 | N |
Importante: Em caso de empresas de passagens aéreas os dados de item não são obrigatórios.
Property | Description | Type | Tamanho | Mandatory |
---|---|---|---|---|
code | Item code | String | 50 | N |
name | Product name | String | 150 | S |
value | Item unitary value | Decimal | 20,4 | N |
amount | Amount of items | Integer | N | |
categoryID | Category ID | Integer | N | |
categoryName | Category Name | String | 200 | N |
Note: In case of airline companies, item data is not required.
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
name | Nome do Passageiro | String | 100 | S |
companyMileCard | Companhia de Milhagem (Fidelidade) | String | 50 | N |
mileCard | Cartão de Milhagem (Fidelidade) | String | 50 | N |
identificationType | Tipo de Documento de Identificação | Integer | N | |
identificationNumber | Número do Documento | String | 50 | N |
gender | Sexo do Passageiro | String | 1 | N |
birthdate | Data de nascimento | Datetime | N | |
cpf | CPF do Passageiro | String | 50 | N |
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
name | Passanger name | String | 100 | Y |
companyMileCard | Company mile card name | String | 50 | N |
mileCard | Number of mile card | String | 50 | N |
identificationType | Legal document type See the list at identification List | Integer | N | |
identificationNumber | Legal document number | String | 50 | N |
gender | Passager gender | String | 1 | N |
birthdate | Passenger birth date | Datetime | N | |
cpf | Passenger CPF | String | 50 | N |
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
company | Nome da companhia de transporte | String | 50 | N |
identificationNumber | Número da viagem | Decimal | 6,0 | N |
date | Data da viagem | Datetime | S | |
seatClass | Classe do Assento | String | 10 | N |
origin | Origem | String | 5 | S |
destination | Destino | String | 5 | S |
boarding | Data de Embarque | Datetime | N | |
arriving | Data de Desembarque | Datetime | N | |
fareClass | Classe Tarifária | String | 25 | N |
Importante: Os objetos passengers e connections são utilizados somente em empresas de passagens aéreas.
Caso não seja o seu caso, favor omitir essas propriedades no json de sua requisição.
No objeto connections informar somente os dados de origem e destino, não informar escalas e conexões.
Por exemplo:
Para um vôo de São Paulo (Guarulhos) para Londres, via New York (JFK), você irá informar apenas GRU-LHR, ao invés de GRU-JFK e JFK-LHR.
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
company | Name of the tourism company | String | 50 | N |
identificationNumber | Travel number | Decimal | 6,0 | N |
date | Travel date | Datetime | Y | |
seatClass | Seat class | String | 10 | N |
origin | Travel origin | String | 5 | Y |
destination | Travel destination | String | 5 | Y |
boarding | Departure date | Datetime | N | |
arriving | Arrival date | Datetime | N | |
fareClass | Fare Class | String | 25 | N |
Important: You should use passengers and connections objects only for tourism companies.
If that is not your case, please omit these objects on the Json requisition.
On the object connections, please, inform us only origin and destination data.Do not send us scales and connections.
Example
For a flight from São Paulo (GRU) to London (LHR) via New York (JFK), yout will send us only GRU-LHR, instead of GRU-JFK and JFK-LHR.
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
street | Nome do logradouro | String | 200 | S |
number | Número do Endereço | String | 15 | S |
additionalInformation | Complemento do Endereço | String | 250 | N |
county | Bairro do Endereço | String | 150 | S |
city | Cidade do Endereço | String | 150 | S |
state | Sigla do Estado do Endereço - UF | String | 2 | S |
country | País do Endereço | String | 150 | N |
zipcode | CEP do Endereço | String | 10 | S |
reference | Referência do Endereço | String | 250 | N |
Importante: O envio do endereço não é obrigatório, porém caso tenha essa informação para envio, deverá respeitar a obrigatoriedade mínima dos campos informados como ‘S’.
Em caso de empresas de passagens aéreas o endereço de entrega não é obrigatório.
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
street | Street name | String | 200 | Y |
number | Address number | String | 15 | Y |
additionalInformation | Address Complement | String | 250 | N |
county | Address district | String | 150 | Y |
city | Address city | String | 150 | Y |
state | Address state initials | String | 2 | Y |
country | Address country | String | 150 | N |
zipcode | Address zip code | String | 10 | Y |
reference | Address reference | String | 250 | N |
Important: It is not mandatory to send us the billing address data, however, if you have these information available, you must provide the minimum required data, which are those marked as mandatory.
In the case of tourism companies, the shipping address is not mandatory.
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
type | Tipo de Telefone | Integer | S | |
ddi | DDI do Telefone | Integer | 3 | N |
ddd | DDD do Telefone | Integer | 2 | S |
number | Número do Telefone | Integer | 9 | S |
extension | Ramal do Telefone | String | 10 | N |
Importante: É obrigatório o envio de pelo menos 1 telefone.
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
type | Phone type See the list at Phone Type List | Integer | Y | |
ddi | Country code | Integer | 3 | N |
ddd | Area code | Integer | 2 | Y |
number | Phone number | Integer | 9 | Y |
extension | Phone extension | String | 10 | N |
Important: It is mandatory to send us at least one phone in the Json requisition.
Propriedade | Descrição | Tipo | Tamanho | Obrigatório |
---|---|---|---|---|
number | Número do Cartão com Máscara | String | 200 | N |
hash | Hash do número do cartão | String | 128 | N |
bin | 6 Primeiros Números do Cartão de Crédito | String | 6 | S |
end | 4 últimos digitos do número de cartão | String | 4 | S |
type | Bandeira do Cartão | Integer | N | |
validityDate | Data da Expiração | String | 50 | N |
ownerName | Nome de Cobrança | String | 150 | S |
document | Documento da Pessoa de Cobrança | String | 100 | N |
nsu | Número identificador único de uma transação de cartão | String | 50 | N |
Os dados do cartão são obrigatórios e devem ser enviados somente quando a forma de pagamento do pedido for cartão de crédito
Property | Description | Type | Size | Mandatory |
---|---|---|---|---|
number | Bank card number | String | 200 | N |
hash | Card number hash | String | 128 | N |
bin | Bank card bin | String | 6 | Y |
end | Last 4 digits of the bank card | String | 4 | Y |
type | Flag type of the bank card See the list at BankCard Flag List | Integer | N | |
validityDate | Expiration date | String | 50 | N |
ownerName | Card holder | String | 150 | Y |
document | Legal document of the card holder | String | 100 | N |
nsu | Transaction identification number of the bank card | String | 50 | N |
The card data are mandatory and must be sent only when the order payment method is credit card
Em todas as requisições realizadas será retornado uma chave no header chamada Request-ID, o valor desta chave conterá 19 caracteres, através de tal valor nosso suporte será capaz de capturar a sua transação e auxiliá-lo na resolução de algum problema.
Ausência de usuário/senha:
HttpCode: | 400 (Bad Request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "< JPath_da_Propriedade >": [ "< Mensagem_Nome_Propriedade_descricao_erro > ] } } |
Post e Put com campos obrigatórios não informados:
HttpCode: | 400 (Bad Request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "< JPath_da_Propriedade >": [ < Mensagem_Nome_Propriedade_descricao_erro> ] } } |
Usuário/senha incorretos:
HttpCode: | 401 (Unauthorized) |
Body: | UserNotFound |
Token expirado:
HttpCode: | 401 (Unauthorized) |
Body: | ExpiredToken |
Post com o pedido existente na base:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "existing-orders": [ "CODIGO_DO_PEDIDO" ] } } |
Put sem pedido existente na base:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "orders-not-found": [ "CODIGO_DO_PEDIDO" ] } } |
Post e Put com status não permitido:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "status-not-allowed": [ "status: "status_enviado" is not allowed" ] } } |
Post e Put com JSON inválido:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "": [ "Não foi possível analisar o Json, erro na Propriedade: {nome_da_propriedade}, Posição: 12345" ] } } |
Post ou Put vazio ou com JSON informado sem valores:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "": [ "Não foi possível analisar o Json, Json não possui valores" ] } } |
Post ou Put onde o JSON é informado sem o valor “code”:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "[0]": [ "Required properties are missing from object: code. Line 1, position 1." ], "": [ "Não foi possível analisar o Json, erro na Propriedade Code é um campo obrigatório." ] } } |
Requisição onde o erro ocorrer dentro do ambiente Clearsale:
HttpCode: | 500 (Internal Server Error) |
Body: | vazio |
All the requests will return a key in the header called Request-ID, the value of this key contains 19 characters. Our support will be able to find your transaction and assist you solving problems, by means of checking the Request-ID.
Missing username/passwrod:
HttpCode: | 400 (Bad Request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "< JPath_da_Propriedade >": [ "< Message_Name_Property_error_description > ] } } |
Post e Put with mandatory fields not informed:
HttpCode: | 400 (Bad Request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "< JPath_da_Propriedade >": [ < Message_Name_Property_error_description> ] } } |
Invalid user/password:
HttpCode: | 401 (Unauthorized) |
Body: | UserNotFound |
Expired token:
HttpCode: | 401 (Unauthorized) |
Body: | ExpiredToken |
Post with existing order in the base:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "existing-orders": [ "ORDER_CODE" ] } } |
Put without existing order in the base:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "orders-not-found": [ "CODIGO_DO_PEDIDO" ] } } |
Post e Put with status not allowed:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "status-not-allowed": [ "status: "sent_status" is not allowed" ] } } |
Post e Put with a invalid JSON:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "": [ "Could not parse Json, Property error: {property_name}, Position: 12345" ] } } |
Post ou Put empty or with a JSON without values:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "": [ "Could not parse Json, Json has no values" ] } } |
Post or Put where JSON is sent without property “code”:
HttpCode: | 400 (Bad request) |
Body: |
{ "Message": "The request is invalid.", "ModelState": { "[0]": [ "Required properties are missing from object: code. Line 1, position 1." ], "": [ "Could not parse Json, property Code is a mandatory field." ] } } |
Request where the error occurs within the Clearsale environment:
HttpCode: | 500 (Internal Server Error) |
Body: | empty |