From 9c934ec5b790282e8322957018ec03bbfc67cf0c Mon Sep 17 00:00:00 2001 From: andrew-paystack Date: Fri, 20 Feb 2026 19:04:42 +0300 Subject: [PATCH 1/3] add preauth webhook events --- .../preauthorization/events/config.yml | 3 ++ .../preauthorization-capture-failed.json | 48 +++++++++++++++++++ .../preauthorization-capture-success.json | 47 ++++++++++++++++++ .../preauthorization-release-failed.json | 46 ++++++++++++++++++ .../preauthorization-release-success.json | 48 +++++++++++++++++++ .../preauthorization-reserve-success.json | 47 ++++++++++++++++++ 6 files changed, 239 insertions(+) create mode 100644 src/doc/payments/preauthorization/events/config.yml create mode 100644 src/doc/payments/preauthorization/events/preauthorization-capture-failed.json create mode 100644 src/doc/payments/preauthorization/events/preauthorization-capture-success.json create mode 100644 src/doc/payments/preauthorization/events/preauthorization-release-failed.json create mode 100644 src/doc/payments/preauthorization/events/preauthorization-release-success.json create mode 100644 src/doc/payments/preauthorization/events/preauthorization-reserve-success.json diff --git a/src/doc/payments/preauthorization/events/config.yml b/src/doc/payments/preauthorization/events/config.yml new file mode 100644 index 0000000..6c7ecb9 --- /dev/null +++ b/src/doc/payments/preauthorization/events/config.yml @@ -0,0 +1,3 @@ +type: event +languages: + - json \ No newline at end of file diff --git a/src/doc/payments/preauthorization/events/preauthorization-capture-failed.json b/src/doc/payments/preauthorization/events/preauthorization-capture-failed.json new file mode 100644 index 0000000..04439d5 --- /dev/null +++ b/src/doc/payments/preauthorization/events/preauthorization-capture-failed.json @@ -0,0 +1,48 @@ +{ + "event": "preauthorization.capture.failed", + "data": { + "amount": 1000, + "authorization": { + "account_name": null, + "authorization_code": "AUTH_ove5p6reju", + "bank": "NEDBANK", + "bin": "492213", + "brand": "visa", + "card_type": "visa credit", + "channel": "card", + "country_code": "ZA", + "exp_month": "03", + "exp_year": "2025", + "last4": "6658", + "reusable": true, + "signature": "SIG_9bg7BgE0xiRxNVsil7Yo" + }, + "captured_amount": "1000", + "captured_at": null, + "currency": "ZAR", + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "01142272921", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "domain": "live", + "expired_at": null, + "fees": 0, + "message": null, + "id": 3099, + "merchant_id": 412922, + "merchant_name": "Test Business", + "metadata": null, + "reference": "atyntuup5bec03e", + "status": "capture_failed", + "transaction_id": "1504264401", + "expiry_date": "2023-11-19T23:28:52.000Z", + "expire_action": "release" + } +} \ No newline at end of file diff --git a/src/doc/payments/preauthorization/events/preauthorization-capture-success.json b/src/doc/payments/preauthorization/events/preauthorization-capture-success.json new file mode 100644 index 0000000..a32c727 --- /dev/null +++ b/src/doc/payments/preauthorization/events/preauthorization-capture-success.json @@ -0,0 +1,47 @@ +{ + "event": "preauthorization.capture.success", + "data": { + "amount": 1000, + "authorization": { + "account_name": null, + "authorization_code": "AUTH_ove5p6reju", + "bank": "NEDBANK", + "bin": "492213", + "brand": "visa", + "card_type": "visa credit", + "channel": "card", + "country_code": "ZA", + "exp_month": "03", + "exp_year": "2025", + "last4": "6658", + "reusable": true, + "signature": "SIG_9bg7BgE0xiRxNVsil7Yo" + }, + "captured_amount": "1000", + "captured_at": "2023-11-10T11:58:44.000Z", + "currency": "ZAR", + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "01142272921", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "domain": "live", + "fees": 0, + "message": "Approved", + "id": 3099, + "merchant_id": 412922, + "merchant_name": "StarterZA", + "metadata": null, + "reference": "atyntuup5bec03e", + "status": "captured", + "transaction_id": "1504264401", + "expiry_date": null, + "expire_action": "capture" + } +} \ No newline at end of file diff --git a/src/doc/payments/preauthorization/events/preauthorization-release-failed.json b/src/doc/payments/preauthorization/events/preauthorization-release-failed.json new file mode 100644 index 0000000..c6d590a --- /dev/null +++ b/src/doc/payments/preauthorization/events/preauthorization-release-failed.json @@ -0,0 +1,46 @@ +{ + "event": "preauthorization.release.failed", + "data": { + "amount": 1000, + "authorization": { + "account_name": null, + "authorization_code": "AUTH_ove5p6reju", + "bank": "NEDBANK", + "bin": "492213", + "brand": "visa", + "card_type": "visa credit", + "channel": "card", + "country_code": "ZA", + "exp_month": "03", + "exp_year": "2025", + "last4": "6658", + "reusable": true, + "signature": "SIG_9bg7BgE0xiRxNVsil7Yo" + }, + "captured_amount": null, + "captured_at": null, + "currency": "ZAR", + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "01142272921", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "domain": "live", + "fees": 100, + "message": "Release failed", + "id": 3118, + "merchant_id": 412922, + "merchant_name": "StarterZA", + "metadata": null, + "reference": "h15lgtld6kqlkcm", + "status": "release_failed", + "transaction_id": null, + "expiry_date": "2023-11-19T23:28:52.000Z" + } +} \ No newline at end of file diff --git a/src/doc/payments/preauthorization/events/preauthorization-release-success.json b/src/doc/payments/preauthorization/events/preauthorization-release-success.json new file mode 100644 index 0000000..4d82be1 --- /dev/null +++ b/src/doc/payments/preauthorization/events/preauthorization-release-success.json @@ -0,0 +1,48 @@ +{ + "event": "preauthorization.release.success", + "data": { + "amount": 1000, + "authorization": { + "account_name": null, + "authorization_code": "AUTH_ove5p6reju", + "bank": "NEDBANK", + "bin": "492213", + "brand": "visa", + "card_type": "visa credit", + "channel": "card", + "country_code": "ZA", + "exp_month": "03", + "exp_year": "2025", + "last4": "6658", + "reusable": true, + "signature": "SIG_9bg7BgE0xiRxNVsil7Yo" + }, + "captured_amount": null, + "captured_at": null, + "currency": "ZAR", + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "01142272921", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "domain": "live", + "expired_at": "2023-11-17T12:46:58.000Z", + "fees": 100, + "message": "Release success", + "id": 3101, + "merchant_id": 412922, + "merchant_name": "Test Business", + "metadata": null, + "reference": "pre_11b0qw12", + "status": "released", + "transaction_id": null, + "expiry_date": "2024-11-19T23:28:52.000Z", + "expire_action": "release" + } +} \ No newline at end of file diff --git a/src/doc/payments/preauthorization/events/preauthorization-reserve-success.json b/src/doc/payments/preauthorization/events/preauthorization-reserve-success.json new file mode 100644 index 0000000..86669be --- /dev/null +++ b/src/doc/payments/preauthorization/events/preauthorization-reserve-success.json @@ -0,0 +1,47 @@ +{ + "event": "preauthorization.reserve.success", + "data": { + "id": 543, + "domain": "live", + "status": "authorized", + "reference": "pre_9gjnu6dc", + "amount": 1000, + "message": "Approved", + "currency": "ZAR", + "metadata": null, + "fees": 100, + "authorization": { + "authorization_code": "AUTH_vbvd4qti3m", + "bin": "455027", + "last4": "8016", + "exp_month": "11", + "exp_year": "2026", + "channel": "card", + "card_type": "visa credit", + "bank": "ABSA BANK LIMITED, SOUTH AFRICA", + "country_code": "ZA", + "brand": "visa", + "reusable": true, + "signature": "SIG_1zl7r116ONxGlRFXKn0C", + "account_name": null + }, + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "merchant_id": 1077497, + "merchant_name": "Test Business", + "transaction_id": null, + "captured_at": null, + "captured_amount": null, + "expiry_date": "2023-11-19T23:28:52.000Z", + "expire_action": "release" + } +} \ No newline at end of file From ec614df536b40f624b9d44915a51909eabe9d37a Mon Sep 17 00:00:00 2001 From: andrew-paystack Date: Fri, 20 Feb 2026 19:14:44 +0300 Subject: [PATCH 2/3] copy update --- .../events/preauthorization-capture-success.json | 2 +- .../events/preauthorization-release-failed.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/payments/preauthorization/events/preauthorization-capture-success.json b/src/doc/payments/preauthorization/events/preauthorization-capture-success.json index a32c727..1da8c3c 100644 --- a/src/doc/payments/preauthorization/events/preauthorization-capture-success.json +++ b/src/doc/payments/preauthorization/events/preauthorization-capture-success.json @@ -36,7 +36,7 @@ "message": "Approved", "id": 3099, "merchant_id": 412922, - "merchant_name": "StarterZA", + "merchant_name": "Test Business", "metadata": null, "reference": "atyntuup5bec03e", "status": "captured", diff --git a/src/doc/payments/preauthorization/events/preauthorization-release-failed.json b/src/doc/payments/preauthorization/events/preauthorization-release-failed.json index c6d590a..fb815ce 100644 --- a/src/doc/payments/preauthorization/events/preauthorization-release-failed.json +++ b/src/doc/payments/preauthorization/events/preauthorization-release-failed.json @@ -36,7 +36,7 @@ "message": "Release failed", "id": 3118, "merchant_id": 412922, - "merchant_name": "StarterZA", + "merchant_name": "Test Business", "metadata": null, "reference": "h15lgtld6kqlkcm", "status": "release_failed", From 1e57f551d0bb32707318c8d558be4c21def92a7d Mon Sep 17 00:00:00 2001 From: andrew-paystack Date: Fri, 20 Feb 2026 19:15:33 +0300 Subject: [PATCH 3/3] build preauth events --- dist/doc/payments/preauthorization/events.js | 242 +++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 dist/doc/payments/preauthorization/events.js diff --git a/dist/doc/payments/preauthorization/events.js b/dist/doc/payments/preauthorization/events.js new file mode 100644 index 0000000..e48cd4c --- /dev/null +++ b/dist/doc/payments/preauthorization/events.js @@ -0,0 +1,242 @@ +const preauthorization_capture_failed = `{ + "event": "preauthorization.capture.failed", + "data": { + "amount": 1000, + "authorization": { + "account_name": null, + "authorization_code": "AUTH_ove5p6reju", + "bank": "NEDBANK", + "bin": "492213", + "brand": "visa", + "card_type": "visa credit", + "channel": "card", + "country_code": "ZA", + "exp_month": "03", + "exp_year": "2025", + "last4": "6658", + "reusable": true, + "signature": "SIG_9bg7BgE0xiRxNVsil7Yo" + }, + "captured_amount": "1000", + "captured_at": null, + "currency": "ZAR", + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "01142272921", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "domain": "live", + "expired_at": null, + "fees": 0, + "message": null, + "id": 3099, + "merchant_id": 412922, + "merchant_name": "Test Business", + "metadata": null, + "reference": "atyntuup5bec03e", + "status": "capture_failed", + "transaction_id": "1504264401", + "expiry_date": "2023-11-19T23:28:52.000Z", + "expire_action": "release" + } +}` + +const preauthorization_capture_success = `{ + "event": "preauthorization.capture.success", + "data": { + "amount": 1000, + "authorization": { + "account_name": null, + "authorization_code": "AUTH_ove5p6reju", + "bank": "NEDBANK", + "bin": "492213", + "brand": "visa", + "card_type": "visa credit", + "channel": "card", + "country_code": "ZA", + "exp_month": "03", + "exp_year": "2025", + "last4": "6658", + "reusable": true, + "signature": "SIG_9bg7BgE0xiRxNVsil7Yo" + }, + "captured_amount": "1000", + "captured_at": "2023-11-10T11:58:44.000Z", + "currency": "ZAR", + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "01142272921", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "domain": "live", + "fees": 0, + "message": "Approved", + "id": 3099, + "merchant_id": 412922, + "merchant_name": "Test Business", + "metadata": null, + "reference": "atyntuup5bec03e", + "status": "captured", + "transaction_id": "1504264401", + "expiry_date": null, + "expire_action": "capture" + } +}` + +const preauthorization_release_failed = `{ + "event": "preauthorization.release.failed", + "data": { + "amount": 1000, + "authorization": { + "account_name": null, + "authorization_code": "AUTH_ove5p6reju", + "bank": "NEDBANK", + "bin": "492213", + "brand": "visa", + "card_type": "visa credit", + "channel": "card", + "country_code": "ZA", + "exp_month": "03", + "exp_year": "2025", + "last4": "6658", + "reusable": true, + "signature": "SIG_9bg7BgE0xiRxNVsil7Yo" + }, + "captured_amount": null, + "captured_at": null, + "currency": "ZAR", + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "01142272921", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "domain": "live", + "fees": 100, + "message": "Release failed", + "id": 3118, + "merchant_id": 412922, + "merchant_name": "Test Business", + "metadata": null, + "reference": "h15lgtld6kqlkcm", + "status": "release_failed", + "transaction_id": null, + "expiry_date": "2023-11-19T23:28:52.000Z" + } +}` + +const preauthorization_release_success = `{ + "event": "preauthorization.release.success", + "data": { + "amount": 1000, + "authorization": { + "account_name": null, + "authorization_code": "AUTH_ove5p6reju", + "bank": "NEDBANK", + "bin": "492213", + "brand": "visa", + "card_type": "visa credit", + "channel": "card", + "country_code": "ZA", + "exp_month": "03", + "exp_year": "2025", + "last4": "6658", + "reusable": true, + "signature": "SIG_9bg7BgE0xiRxNVsil7Yo" + }, + "captured_amount": null, + "captured_at": null, + "currency": "ZAR", + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "01142272921", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "domain": "live", + "expired_at": "2023-11-17T12:46:58.000Z", + "fees": 100, + "message": "Release success", + "id": 3101, + "merchant_id": 412922, + "merchant_name": "Test Business", + "metadata": null, + "reference": "pre_11b0qw12", + "status": "released", + "transaction_id": null, + "expiry_date": "2024-11-19T23:28:52.000Z", + "expire_action": "release" + } +}` + +const preauthorization_reserve_success = `{ + "event": "preauthorization.reserve.success", + "data": { + "id": 543, + "domain": "live", + "status": "authorized", + "reference": "pre_9gjnu6dc", + "amount": 1000, + "message": "Approved", + "currency": "ZAR", + "metadata": null, + "fees": 100, + "authorization": { + "authorization_code": "AUTH_vbvd4qti3m", + "bin": "455027", + "last4": "8016", + "exp_month": "11", + "exp_year": "2026", + "channel": "card", + "card_type": "visa credit", + "bank": "ABSA BANK LIMITED, SOUTH AFRICA", + "country_code": "ZA", + "brand": "visa", + "reusable": true, + "signature": "SIG_1zl7r116ONxGlRFXKn0C", + "account_name": null + }, + "customer": { + "id": 1, + "first_name": "John", + "last_name": "Doe", + "email": "john@test.com", + "customer_code": "CUS_yqcuukj44ype5u1", + "phone": "", + "metadata": null, + "risk_action": "default", + "international_format_phone": null + }, + "merchant_id": 1077497, + "merchant_name": "Test Business", + "transaction_id": null, + "captured_at": null, + "captured_amount": null, + "expiry_date": "2023-11-19T23:28:52.000Z", + "expire_action": "release" + } +}` + +export {preauthorization_capture_failed, preauthorization_capture_success, preauthorization_release_failed, preauthorization_release_success, preauthorization_reserve_success} \ No newline at end of file