Webhook para pagos recurrentes con tarjeta

Kushki puede enviar eventos vía webhook que notifican a tu aplicación en el momento en que uno de los siguientes eventos ocurra:

  1. Cuando un cobro es exitoso (succesfullCharge)
  2. Cuando un intento de cobro de la suscripción calendarizada falló (failedRetry)
  3. Cuando todos los intentos de cobro de la suscripción calendarizada fallan (lastRetry)
  4. Cuando un cobro de una suscripción bajo demanda es declinado (declinedCharge)
  5. Cuando se elimina una suscripción (subscriptionDelete)

Estructura

Los webhooks enviados por Kushki contendrán los encabezados (headers) aquí listados.
Estas son las posibles variables que se entregan en el webhook:

Método: POST

Body: Object

VariableTipo
name"succesfullCharge" "failedRetry" "lastRetry" "declinedCharge" "subscriptionDelete"
eventObject
event.idstring
event.metadataObject
event.metadata.key0string
event.metadata.key1string
event.metadata.key2string
event.subscriptionIdnumber
event.cardHolderNamestring
event.amountObject
event.amount.subtotalIvanumber
event.amount.subtotalIva0number
event.amount.ivanumber
event.amount.icenumber
event.amount.currencystring
event.amount.extraTaxesObject
event.amount.extraTaxes.agenciaDeViajenumber
event.amount.extraTaxes.iacnumber
event.amount.extraTaxes.propinanumber
event.amount.extraTaxes.tasaAeroportuarianumber
event.periodicitystring
event.contactDetailsObject
event.contactDetails.firstNamestring
event.contactDetails.lastNamestring
event.contactDetails.emailstring
event.tokenstring
event.merchantIdstring
event.startDatenumber (Unix Timestamp Format)
event.endDatenumber (Unix Timestamp Format)
event.creatednumber (Unix Timestamp Format)
event.planNamestring
event.binInfoObject
event.binInfo.bankstring
event.binInfo.typestring
event.binInfo.processorstring
event.binInfo.brandstring
event.dayOfMonthnumber
event.monthstring
event.dayOfWeekstring
event.retry.typeObject
event.retry.attemptsnumber
event.retry.maxnumber
event.retry.firstAttemptDatenumber
event.retry.periodicitynumber
event.retry.daysLeftarray
event.retry.daysLeft.itemsinteger
event.retryCountnumber
event.expirationTimenumber
event.activeboolean
event.lastFourDigitsstring
event.adjustmentobject
event.adjustment.amountobject
event.adjustment.amount.subtotalIvanumber
event.adjustment.amount.subtotalIva0number
event.adjustment.amount.ivanumber
event.adjustment.amount.icenumber
event.adjustment.amount.currencystring
event.adjustment.amount.extraTaxesobject
event.adjustment.amount.extraTaxes.agenciaDeViajenumber
event.adjustment.amount.extraTaxes.iacnumber
event.adjustment.amount.extraTaxes.propinanumber
event.adjustment.amount.extraTaxes.tasaAeroportuarianumber
event.adjustment.periodsnumber
event.retryConfigurationobject
event.retryConfiguration.retryTypestring
event.retryConfiguration.valuearray
event.retryConfiguration.value.itemsinteger
event.nextAttemptDaynumber
event.lastRetryDatenumber
event.urlstring
event.approvalCodestring
event.ticketNumberstring
event.lastChargeDatenumber

Ejemplos

  • JSON
  • JSON
  • JSON
  • JSON
// Transacción aprobada
{
"name": "succesfullCharge",
"event": {
"userAgent": "Go-http-client/1.1",
"metadata": {
"plan": {
"fitness": {
"pool": "include",
"rumba": "include",
"cardio": "include"
}
}
},
"subscriptionId": "1602024113521000",
"created": 1602024113,
"ip": "35.193.164.95",
"lastChargeDate": 1602024176,
"contactDetails": {
"firstName": "Diego",
"lastName": "Cadena",
"phoneNumber": "+593988734644",
"documentType": "CC",
"documentNumber": "1009283738",
"email": "test@test.com"
},
"periodicity": "monthly",
"lastFourDigits": "4242",
"active": true,
"dayOfMonth": 6,
"token": "da44953475f74c02abca31c5371e1792",
"binInfo": {
"bank": null,
"brand": "VISA",
"processor": "NA",
"bin": "424242",
"info": {
"country": {
"emoji": "🇺🇸",
"latitude": 38,
"alpha2": "US",
"name": "United States of America",
"numeric": "840",
"currency": "USD",
"longitude": -97
},
"number": {},
"bank": {},
"scheme": "visa",
"type": "credit"
}
},
"cardHolderName": "Pruebas",
"maskedCardNumber": "424242XXXXXX4242",
"month": "*",
"planName": "Premium",
"dayOfWeek": "?",
"startDate": 1601942400,
"amount": {
"currency": "USD",
"ice": 0,
"subtotalIva0": 0,
"iva": 0.14,
"subtotalIva": 1
},
"id": "160202411352100020000000XXXXXXXX2000",
"plccMetadataId": "187169a42eed456a9964dab5e7ec9468",
"merchantId": "20000000XXXXXXXX2000",
"transactionReference": "9eb4ec3d-5e83-4450-8d90-5047121bddbf",
"approvalCode": "000000",
"binCard": "424242",
"issuingBank": null,
"ticketNumber": "646245907500066871"
}
}
// Transacción rechazada
{
"name": "declinedCharge",
"event": {
"userAgent": "Go-http-client/1.1",
"metadata": {
"plan": {
"fitness": {
"pool": "include",
"rumba": "include",
"cardio": "include"
}
}
},
"subscriptionId": "1602024884332000",
"created": 1602024884,
"ip": "35.193.164.95",
"contactDetails": {
"firstName": "Diego",
"lastName": "Cadena",
"phoneNumber": "+593988734644",
"documentType": "CC",
"documentNumber": "1009283738",
"email": "test@test.com"
},
"periodicity": "monthly",
"lastFourDigits": "7015",
"active": true,
"dayOfMonth": 6,
"token": "1637f3a2be6849cbbf2095693f7367c1",
"binInfo": {
"bank": "BANCO DE LA PRODUCCION S.A. (PRODUBANCO)",
"brand": "VISA",
"processor": "NA",
"bin": "434900",
"info": {
"country": {
"emoji": "🇪🇨",
"latitude": -2,
"alpha2": "EC",
"name": "Ecuador",
"numeric": "218",
"currency": "USD",
"longitude": -77.5
},
"number": {
"length": 16,
"luhn": true
},
"bank": {
"name": "BANCO DE LA PRODUCCION,S.A. (PRODUBANCO)"
},
"scheme": "visa",
"prepaid": false,
"type": "CREDIT",
"brand": "Traditional"
}
},
"cardHolderName": "Pruebas",
"maskedCardNumber": "434900XXXXXX7015",
"planName": "Premium",
"month": "*",
"dayOfWeek": "?",
"startDate": 1601942400,
"amount": {
"currency": "USD",
"ice": 0,
"subtotalIva0": 0,
"iva": 0.14,
"subtotalIva": 1
},
"plccMetadataId": "baae19a29bc64382b1cbdfd374cfaba6",
"id": "160202488433200020000000XXXXXXXX2000",
"merchantId": "20000000XXXXXXXX2000",
"transactionReference": "4eeec12b-6554-469e-87b8-a432ab9c3106"
}
}
// Intento de cobro fallido
{
"name": "failedRetry",
"event": {
"userAgent": "Go-http-client/1.1",
"metadata": {
"plan": {
"fitness": {
"pool": "include",
"rumba": "include",
"cardio": "include"
}
}
},
"subscriptionId": "1602024884332000",
"created": 1602024884,
"ip": "35.193.164.95",
"contactDetails": {
"firstName": "Diego",
"lastName": "Cadena",
"phoneNumber": "+593988734644",
"documentType": "CC",
"documentNumber": "1009283738",
"email": "test@test.com"
},
"periodicity": "monthly",
"lastFourDigits": "7015",
"active": true,
"dayOfMonth": 6,
"token": "1637f3a2be6849cbbf2095693f7367c1",
"binInfo": {
"bank": "BANCO DE LA PRODUCCION S.A. (PRODUBANCO)",
"brand": "VISA",
"processor": "NA",
"bin": "434900",
"info": {
"country": {
"emoji": "🇪🇨",
"latitude": -2,
"alpha2": "EC",
"name": "Ecuador",
"numeric": "218",
"currency": "USD",
"longitude": -77.5
},
"number": {
"length": 16,
"luhn": true
},
"bank": {
"name": "BANCO DE LA PRODUCCION,S.A. (PRODUBANCO)"
},
"scheme": "visa",
"prepaid": false,
"type": "CREDIT",
"brand": "Traditional"
}
},
"cardHolderName": "Pruebas",
"maskedCardNumber": "434900XXXXXX7015",
"planName": "Premium",
"month": "*",
"dayOfWeek": "?",
"startDate": 1601942400,
"amount": {
"currency": "USD",
"ice": 0,
"subtotalIva0": 0,
"iva": 0.14,
"subtotalIva": 1
},
"plccMetadataId": "baae19a29bc64382b1cbdfd374cfaba6",
"id": "160202411352100020000000XXXXXXXX2000m",
"merchantId": "20000000XXXXXXXX2000",
"transactionReference": "9b85ba91-1a97-4964-bf6a-472a9b0cb813"
}
}
// Suscripción borrada
{
"name": "subscriptionDelete",
"event": {
"amount": {
"subtotalIva0": 0,
"iva": 0.14,
"subtotalIva": 1,
"currency": "USD",
"ice": 0
},
"metadata": {
"plan": {
"fitness": {
"rumba": "include",
"pool": "include",
"cardio": "include"
}
}
},
"cardHolderName": "Pruebas",
"deleteAt": 1602024462,
"created": 1602024113,
"plccMetadataId": "187169a42eed456a9964dab5e7ec9468",
"ip": "35.193.164.95",
"active": false,
"planName": "Premium",
"userAgent": "Go-http-client/1.1",
"contactDetails": {
"firstName": "Diego",
"lastName": "Cadena",
"phoneNumber": "+593988734644",
"documentType": "CC",
"documentNumber": "1009283738",
"email": "test@test.com"
},
"lastChargeDate": 1602024176,
"maskedCardNumber": "424242XXXXXX4242",
"token": "da44953475f74c02abca31c5371e1792",
"dayOfWeek": "?",
"month": "*",
"binInfo": {
"bank": null,
"bin": "424242",
"brand": "VISA",
"processor": "NA",
"info": {
"country": {
"emoji": "🇺🇸",
"latitude": 38,
"alpha2": "US",
"name": "United States of America",
"numeric": "840",
"currency": "USD",
"longitude": -97
},
"number": {},
"bank": {},
"scheme": "visa",
"type": "credit"
}
},
"dayOfMonth": 6,
"lastFourDigits": "4242",
"merchantId": "20000000XXXXXXXX2000",
"periodicity": "monthly",
"id": "160202411352100020000000XXXXXXXX2000m",
"subscriptionId": "1602024113521000",
"startDate": 1601942400
}
}