Webhook for Recurring Payments Made with Card
August 03, 2023
Kushki can send events via webhook notifying your application at the time when one of the following events occurs:
- When a charge is successfully made (
succesfullCharge
) - When a scheduled subscription charge retry failed (
failedRetry
) - When all the scheduled subscription charge retries have failed (
lastRetry
) - When a charge of a on-demand subscription is declined (
declinedCharge
) - When a subscription is removed (
subscriptionDelete
)
Structure
The webhooks sent by Kushki will contain the headers listed here.
These are the possible variables that are submitted in the webhook body:
Method: POST
Body: Object
Variable | Type |
---|---|
event | Object |
event.metadata | Object |
event.metadata.key0 | string |
event.metadata.key1 | string |
event.metadata.key2 | string |
event.endDate | number (Unix Timestamp Format) |
event.maxCount | number |
event.contactDetails | Object |
event.contactDetails.firstName | string |
event.contactDetails.lastName | string |
event.contactDetails.email | string |
event.contactDetails.phoneNumber | string |
event.contactDetails.documentType | string |
event.contactDetails.documentNumber | string |
event.lastFourDigits | string |
event.subscriptionStatus | string |
event.active | boolean |
event.dayOfMonth | number |
event.token | string |
event.binInfo | Object |
event.binInfo.bank | string |
event.binInfo.type | string |
event.binInfo.processor | string |
event.binInfo.brand | string |
event.binInfo.bin | string |
event.startDate | number (Unix Timestamp Format) |
event.provider | string |
event.id | string |
event.credentialAlias | string |
event.subscriptionId | string |
event.created | number (Unix Timestamp Format) |
event.credentialMetadata | string |
event.ip | string |
event.lastChargeDate | number |
event.paymentBrand | string |
event.callbackUrl | string |
event.cardType | string |
event.periodicity | string |
event.count | number |
event.retryConfiguration | object |
event.retryConfiguration.retryType | string |
event.retryConfiguration.value | array |
event.retryConfiguration.value.items | integer |
event.month | string |
event.planName | string |
event.dayOfWeek | string |
event.amount | Object |
event.amount.subtotalIva | number |
event.amount.subtotalIva0 | number |
event.amount.iva | number |
event.amount.ice | number |
event.amount.currency | string |
event.amount.extraTaxes | Object |
event.tbkUser | string |
event.credentialId | string |
event.publicCredentialId | string |
event.merchantId | string |
event.transactionMetadata | Object |
event.transactionReference | string |
event.convertedAmount | Object |
event.convertedAmount.totalAmount | number |
event.convertedAmount.amount | Object |
event.convertedAmount.amount.subtotalIva | number |
event.convertedAmount.amount.subtotalIva0 | number |
event.convertedAmount.amount.iva | number |
event.convertedAmount.amount.ice | number |
event.convertedAmount.amount.currency | string |
event.convertedAmount.amount.extraTaxes | Object |
event.approvalCode | string |
event.binCard | string |
event.issuingBank | string |
event.recap | string |
event.ticketNumber | string |
event.retry.type | Object |
event.retry.attempts | number |
event.retry.max | number |
event.retry.firstAttemptDate | number |
event.retry.periodicity | number |
event.retry.daysLeft | array |
event.retry.daysLeft.items | integer |
event.retryCount | number |
event.expirationTime | number |
event.cardHolderName | string |
event.adjustment | object |
event.adjustment.amount | object |
event.adjustment.amount.subtotalIva | number |
event.adjustment.amount.subtotalIva0 | number |
event.adjustment.amount.iva | number |
event.adjustment.amount.ice | number |
event.adjustment.amount.currency | string |
event.adjustment.amount.extraTaxes | object |
event.adjustment.amount.extraTaxes.agenciaDeViaje | number |
event.adjustment.amount.extraTaxes.iac | number |
event.adjustment.amount.extraTaxes.propina | number |
event.adjustment.amount.extraTaxes.tasaAeroportuaria | number |
event.adjustment.periods | number |
event.nextAttemptDay | number |
event.lastRetryDate | number |
event.url | string |
name | "succesfullCharge" "failedRetry" "lastRetry" "declinedCharge" "subscriptionDelete" |
Examples
- JSON
- JSON
- JSON
- JSON
// Approved Transaction{"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"}
// Declined Transaction{"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"}}
// Unsuccessful collection attempt{"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"}}
// Subscription Deleted{"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}}