Exemplos_Recorrencia - POPRecarga/Br-PartnerAPI GitHub Wiki
#Recurring
Metodo | Recurso | Notas |
---|---|---|
PUT | /recurring/{identifier} | Gerar um OTPassword para o cliente. |
POST | /recurring/authorize/{identifier} | Autorizar a aplicação a usar o OCTB com o token recorrente do usuário. |
POST | /recurring/payment | Cria, aprova e executa um pagamento no sistema. |
PUT | /recurring/cancel/{identifier} | Cancela o token de relação OCTB. |
####Aqui estão algumas amostras de requisições e respostas da API Recorrente usando fiddler:
##Requisições
Requisição PUT valida no recurso /recurring/{identifier}:
PUT /recurring/+5511XXXXXXXXX HTTP/1.1
Host: api.sandbox.inpdv.com.br
Content-Type: application/json; charset=utf-8
Authorization: Bearer BNACateSkXmuLt5wKCp2PktcYYMRH5zZtugL0L4WeCpu1079Am…
Content-Length: 2
Requisição POST valida no recurso /recurring/authorize/{identifier}:
POST /recurring/authorize/+5511XXXXXXXXX HTTP/1.1
Host: api.sandbox.inpdv.com.br
Content-Type: application/json; charset=utf-8
Authorization: Bearer BNACateSkXmuLt5wKCp2PktcYYMRH5zZtugL0L4WeCpu1079Am…
Content-Length: 8
"724235"
Requisição POST valida no recurso /recurring/payment request:
POST /recurring/payment HTTP/1.1
Host: api.sandbox.inpdv.com.br
Content-Type: application/json; charset=utf-8
Authorization: Bearer BNACateSkXmuLt5wKCp2PktcYYMRH5zZtugL0L4WeCpu1079Am…
{
"brandId": 1,
"recurringToken": "a8bda4da3da00a4f6829c4ad6812a5bbb922ce2b75827f0d1…",
"identifier": "+5511XXXXXXXXX",
"transaction": {
"amount": 2.50,
"currencyCode": "BRL",
"description": "Compra com 1 Click"
}
}
brandId e currencyCode são opicionais.
Requisição PUT valida no recurso /recurring/cancel:
PUT /recurring/cancel/+5511XXXXXXXXX HTTP/1.1
Host: api.sandbox.inpdv.com.br
Content-Type: application/json
Authorization: Bearer cjXOVgtXnfvt1y18uzKkgpSb6aukJwoVSSBZ_TBHey…
Content-Length: 0
Resposta de sucesso do recurso /recurring/{identifier}:
HTTP/1.1 200 OK
Resposta de sucesso do recurso /recurring/authorize/{identifier}:
HTTP/1.1 200 OK
Content-Length: 130
Content-Type: application/json; charset=utf-8
"a8bda4da3da00a4f6829c4ad6812a5bbb922ce2b74c8e2a5515e822faf6c03ddc65a7f018…"
Resposta de OTPassword errado do recurso /recurring/authorize/{identifier}:
HTTP/1.1 400 Bad Request
Content-Length: 130
Content-Type: application/json; charset=utf-8
{
"code":16,
"codeDescription":"ValidationTokenMisMatch",
"extendedProperties":
{
"mS_LoggedBy":[{}]
},
"message":"token does not match"
}
Resposta de sucesso do recurso /recurring/payment response:
HTTP/1.1 200 OK
Content-Length: 186
Content-Type: application/json; charset=utf-8
{
"id":"c3d6f7e5-1623-45b0-a581-c1f47f201816",
"status":"Finished",
"amount":2.50,
"links":[{"href":"https://inpdv-api-hmg.azurewebsites.net/payments/c3d6f7e5-1623-45b0-a581-c1f47f201816"}]
}
Resposta de sucesso do recurso /recurring/cancel:
HTTP/1.1 200 OK
Content-Length: 0