O Webhooks é a prática de recebimento de informações de forma passiva através de uma URL http/https (Localizador padrão de recursos). Com o Webhooks da maxiPago! o recebimento será sobre status das transações.
ATENÇÃO:
A URL de recebimento das informações deve ser criada e enviada para a maxiPago! para cadastro.
A URL deve ter status 200 OK, qualquer status diferente impossibilitará o funcionamento do Webhooks.
URL de webhook não pode conter IP em sua composição.
A URL deverá seguir o seguinte exemplo de estrutura: https://sualoja.com/suasvendas/resultados
Funcionamento
Para funcionamento do Webhooks, a URL de callback deve ser criada e ficar online constantemente. Essa URL precisa ser informada ao time de Suporte e Integração para validação (suporte.mp@userede.com.br) e posterior publicação no ambiente de produção.
A maxiPago! faz o envio das informações utilizando uma comunicação http/https enviando um XML dentro de um objeto chamado “XML” através do método POST com o Header “content-type: x-www-form-urlencoded”, portanto, a URL deve estar preparada para este tipo de requisição:
Abaixo, um modelo de requisição que será enviado pela maxiPago!:
Headers
Content-type: x-www-form-urlencoded
Pragma: no-cache
Cache-control: no-cache
Connection: keep-alive
User-agent: xxxx
Host: xxxx
Accept: xxx
Content-length: xxx
Tipos de Transações Reportadas
O Webhooks da maxiPago! envia informações para a URL cadastrada sobre os seguintes tipos de transações:
Body
Cartão de crédito (captura – response para Adquirente Rede)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <brandMessage>Success.</brandMessage> <brandCode>00</brandCode> <processorCode>00</processorCode> <transactionStatus>3</transactionStatus> <transactionType>CreditCardCapture</transactionType> <transactionID>520330398</transactionID> <tid>11182212131744289937</tid> <brandTid></brandTid> <orderID>0A0115CD:01850D44AB52:262C:156EDFB5</orderID> <transactionState>Captured</transactionState> <transactionDate>12-13-2022 17:54:46</transactionDate> <nsu>384248853</nsu> <merchantId>36xxx</merchantId> <referenceNumber>2022121317515887</referenceNumber> <transactionAmount>1</transactionAmount> <processorMessage>Success.</processorMessage> </transaction-event> </Request>
Cartão de crédito (Captura – response para demais Adquirentes)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <processorCode>00</processorCode> <transactionStatus>3</transactionStatus> <transactionType>CreditCardCapture</transactionType> <transactionID>520330398</transactionID> <tid>11182212131744289937</tid> <brandTid></brandTid> <orderID>0A0115CD:01850D44AB52:262C:156EDFB5</orderID> <transactionState>Captured</transactionState> <transactionDate>12-13-2022 17:54:46</transactionDate> <nsu>384248853</nsu> <merchantId>3xxxx</merchantId> <referenceNumber>2022121317515887</referenceNumber> <transactionAmount>1</transactionAmount> <processorMessage>Success.</processorMessage> </transaction-event> </Request>
Cartão de crédito (Declinado – response para Adquirente Rede)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <brandMessage>Affiliation: Invalid parameter format.</brandMessage> <brandCode>25</brandCode> <processorCode>25</processorCode> <transactionStatus>7</transactionStatus> <transactionType>CreditCardSale</transactionType> <transactionID>13958523</transactionID> <tid></tid> <brandTid></brandTid> <orderID>0A010497:0184F87F5A52:9816:5079CE74</orderID> <transactionState>Declined</transactionState> <transactionDate>12-09-2022 17:06:46</transactionDate> <nsu></nsu> <merchantId>1xxxxx</merchantId> <referenceNumber>Order-202212099255</referenceNumber> <transactionAmount>10.00</transactionAmount> <processorMessage>Affiliation: Invalid parameter format.</processorMessage> </transaction-event> </Request>
Cartão de crédito (Declinado – response para demais Adquirentes)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <processorCode>25</processorCode> <transactionStatus>7</transactionStatus> <transactionType>CreditCardSale</transactionType> <transactionID>13958523</transactionID> <tid></tid> <brandTid></brandTid> <orderID>0A010497:0184F87F5A52:9816:5079CE74</orderID> <transactionState>Declined</transactionState> <transactionDate>12-09-2022 17:06:46</transactionDate> <nsu></nsu> <merchantId>1xxxxx</merchantId> <referenceNumber>Order-202212099255</referenceNumber> <transactionAmount>10.00</transactionAmount> <processorMessage>Affiliation: Invalid parameter format.</processorMessage> </transaction-event> </Request>
Cartão de crédito (Cancelamento)
xml=<?xml version="1.0" encoding="UTF-8"?> <transaction-response> <authCode/> <orderID/> <referenceNum>4040764123</referenceNum> <transactionID>460312421</transactionID> <transactionTimestamp/> <responseCode>0</responseCode> <responseMessage>VOIDED</responseMessage> <avsResponseCode/> <cvvResponseCode/> <processorCode>173</processorCode> <processorMessage>Authorization expired.</processorMessage> <processorName>REDE</processorName> <errorMessage/> <creditCardScheme>Visa</creditCardScheme> </transaction-response>
Boleto Bancário (visualizado)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <transactionStatus>34</transactionStatus> <transactionType>30</transactionType> <transactionID>501043</transactionID> <orderID>7F000101:015DF791E89B:C66D:79BA05A3</orderID> <transactionState>Viewed</transactionState> <transactionDate>08-19-2017 00:56:27</transactionDate> <merchantId>1xxx1</merchantId> <transactionAmount>24.00</transactionAmount> <referenceNumber>20200001</referenceNumber> </transaction-event>
Boleto Bancário (pago)
xml=<?xml version="1.0" encoding="UTF-8"?><Request> <transaction-event> <transactionStatus>10</transactionStatus> <transactionType>30</transactionType> <transactionID>501043</transactionID> <orderID>7F000101:015DF791E89B:C66D:79BA05A3</orderID> <transactionState>Settled</transactionState> <transactionDate>08-19-2017 00:56:27</transactionDate> <merchantId>1xxx</merchantId> <transactionAmount>24.00</transactionAmount> <referenceNumber>20200001</referenceNumber> </transaction-event>
Recorrência (operação acatada)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <orderID>0A0115CD:01850D44AB52:262C:156EDFB5</orderID> <merchantId>716413</merchantId> <recurringFlag>Y</recurringFlag> <transactionDate>08-13-2024 17:54:46</transactionDate> <brandCode>00</brandCode> <brandTid>MBKRL4UJX0510</brandTid> <referenceNumber>29506_CARTAO_1715282846.271611</referenceNumber> <transactionType>CreditCardSale</transactionType> <nsu>84248853</nsu> <transactionStatus>3</transactionStatus> <transactionID>621326149</transactionID> <processorCode>00</processorCode> <transactionAmount>0.01</transactionAmount> <brandMessage>Success.</brandMessage> <tid>10482405100408363699</tid> <transactionState>Captured</transactionState> <recurring> <status>ACTIVE</status> <failedThreshold>3</failedThreshold> <onFailureAction>skip</onFailureAction> <runCount>2</runCount> <numberOfFailures>0</numberOfFailures> <numberOfInstallments>-1</numberOfInstallments> </recurring> <processorMessage>Success.</processorMessage> </transaction-event> </Request>
Recorrência (operação declinada)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <orderID>0A0115CD:01850D44AB52:262C:156EDFB5</orderID> <merchantId>716413</merchantId> <recurringFlag>Y</recurringFlag> <transactionDate>08-13-2024 17:54:46</transactionDate> <brandCode>00</brandCode> <brandTid>MBKRL4UJX0510</brandTid> <referenceNumber>29506_CARTAO_1715282846.271611</referenceNumber> <transactionType>CreditCardSale</transactionType> <nsu>84248853</nsu> <transactionStatus>7</transactionStatus> <transactionID>621326149</transactionID> <processorCode>00</processorCode> <transactionAmount>0.01</transactionAmount> <brandMessage>Declined by Rede: Issuer will never approve</brandMessage> <tid>10482405100408363699</tid> <transactionState>Declined</transactionState> <recurring> <status>ACTIVE</status> <failedThreshold>3</failedThreshold> <onFailureAction>skip</onFailureAction> <runCount>2</runCount> <numberOfFailures>0</numberOfFailures> <numberOfInstallments>-1</numberOfInstallments> </recurring> <processorMessage>Unauthorized. Contact Rede.</processorMessage> </transaction-event> </Request>
Fraude (aprovada)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <transactionStatus>44</transactionStatus> <transactionType>CreditCardSale</transactionType> <transactionID>501043</transactionID> <tid>1006993069000AC96D2A</tid> <orderID>7F000101:015DF791E89B:C66D:79BA05A3</orderID> <transactionState>Fraud Approved</transactionState> <transactionDate>08-19-2017 00:56:27</transactionDate> <nsu>310802</nsu> <merchantId>1xxxx</merchantId> <transactionAmount>24.00</transactionAmount> <referenceNumber>20200001</referenceNumber> </transaction-event>
Fraude (declinada)
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <transactionStatus>45</transactionStatus> <transactionType>CreditCardSale</transactionType> <transactionID>501043</transactionID> <tid>1006993069000AC96D2A</tid> <orderID>7F000101:015DF791E89B:C66D:79BA05A3</orderID> <transactionState>Fraud Declined</transactionState> <transactionDate>08-19-2017 00:56:27</transactionDate> <nsu>310802</nsu> <merchantId>1xxxx</merchantId> <transactionAmount>24.00</transactionAmount> <referenceNumber>20200001</referenceNumber> </transaction-event> </Request>
Pix
xml=<?xml version="1.0" encoding="UTF-8"?> <Request> <transaction-event> <transactionStatus>3</transactionStatus> <transactionType>PixSale</transactionType> <orderID>0A01049C:017D4824A517:6280:5556432E</orderID> <transactionState>Captured</transactionState> <transactionDate>08-19-2017 00:56:27</transactionDate> <merchantId>1xxxx</merchantId> <transactionAmount>24.00</transactionAmount> <referenceNumber>20200001</referenceNumber> </transaction-event> </Request>