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étodod: Post

Body: Object

VariableTipo
eventObject
event.metadataObject
event.metadata.key0string
event.metadata.key1string
event.metadata.key2string
event.endDatenumber (Unix Timestamp Format)
event.maxCountnumber
event.contactDetailsObject
event.contactDetails.firstNamestring
event.contactDetails.lastNamestring
event.contactDetails.emailstring
event.contactDetails.phoneNumberstring
event.contactDetails.documentTypestring
event.contactDetails.documentNumberstring
event.lastFourDigitsstring
event.subscriptionStatusstring
event.activeboolean
event.dayOfMonthnumber
event.tokenstring
event.binInfoObject
event.binInfo.bankstring
event.binInfo.typestring
event.binInfo.processorstring
event.binInfo.brandstring
event.binInfo.binstring
event.startDatenumber (Unix Timestamp Format)
event.providerstring
event.idstring
event.credentialAliasstring
event.subscriptionIdstring
event.creatednumber (Unix Timestamp Format)
event.credentialMetadatastring
event.ipstring
event.lastChargeDatenumber
event.paymentBrandstring
event.callbackUrlstring
event.cardTypestring
event.periodicitystring
event.countnumber
event.retryConfigurationobject
event.retryConfiguration.retryTypestring
event.retryConfiguration.valuearray
event.retryConfiguration.value.itemsinteger
event.monthstring
event.planNamestring
event.dayOfWeekstring
event.amountObject
event.amount.subtotalIvanumber
event.amount.subtotalIva0number
event.amount.ivanumber
event.amount.icenumber
event.amount.currencystring
event.amount.extraTaxesObject
event.tbkUserstring
event.credentialIdstring
event.publicCredentialIdstring
event.merchantIdstring
event.transactionMetadataObject
event.transactionReferencestring
event.convertedAmountObject
event.convertedAmount.totalAmountnumber
event.convertedAmount.amountObject
event.convertedAmount.amount.subtotalIvanumber
event.convertedAmount.amount.subtotalIva0number
event.convertedAmount.amount.ivanumber
event.convertedAmount.amount.icenumber
event.convertedAmount.amount.currencystring
event.convertedAmount.amount.extraTaxesObject
event.approvalCodestring
event.binCardstring
event.issuingBankstring
event.recapstring
event.ticketNumberstring
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.cardHolderNamestring
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.nextAttemptDaynumber
event.lastRetryDatenumber
event.urlstring
name"succesfullCharge" "failedRetry" "lastRetry" "declinedCharge" "subscriptionDelete"

Ejemplos

  • JSON
  • JSON
  • JSON
  • JSON
// Transacción aprobada
{
"event": {
"metadata": {
"plan_url": "https://kushki.com/plans",
"plan_id": 231
},
"endDate": 1661985469,
"maxCount": 9,
"contactDetails": {
"firstName": "John",
"lastName": “Doe”,
"phoneNumber": "+5673839304",
"documentType": "RUT",
"email": "johndoe@test.com",
"documentNumber": "873939409-0"
},
"lastFourDigits": "7323",
"subscriptionStatus": "CONFIRMED",
"active": true,
"dayOfMonth": 27,
"token": "9827224051ac9a7c486b1f76a4f98dfa4b0e0c59a89e335b7ff16eb6c29ae6c3",
"binInfo": {
"bank": null,
"processor": null,
"brand": null,
"bin": null
},
"startDate": 1648766269,
"provider": “transbankwebpay”,
"id": "1921607340879500020003638739107324744000",
"credentialAlias": "TEST",
"subscriptionId": "20678807210795000",
"created": 1648766269,
"credentialMetadata": null,
"ip": "23.345.222.297",
"lastChargeDate": 1653650144,
"paymentBrand": "RedCompra",
"callbackUrl": "https://kushki.com",
"cardType": "debit",
"periodicity": "weekly",
"count": 1,
"retryConfiguration": {
"value": [
2
],
"retryType": "scheduled"
},
"month": "*",
"planName": "Plan hogar",
"dayOfWeek": "?",
"amount": {
"subtotalIva0": 0,
"iva": 0.19,
"subtotalIva": 1,
"ice": 0,
"currency": "UF"
},
"tbkUser": "838d76cb-809b-45b8-88c7-67ff1e6e381d",
"credentialId": "879f2002a31b445f883c3c389bbe6ce3",
"publicCredentialId": "01f4cm986b1149dba3dd3544f20798ac",
"merchantId": "9000107313762000",
"transactionMetadata": {},
"transactionReference": "e3338f6d-23d0-6383-21bf-9395ccd9ba23",
"convertedAmount": {
"totalAmount": 48819,
"amount": {
"subtotalIva0": 0,
"iva": 6198,
"subtotalIva": 42621,
"currency": "CLP"
},
"currency": "CLP"
},
"approvalCode": "002021",
"binCard": null,
"issuingBank": null,
"recap": null,
"retryCount": 1,
"ticketNumber": "383838350144339370"
},
"name": "succesfullCharge"
}
// 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
}
}