Skip to content

Commit 94af513

Browse files
Merge pull request #124 from PaystackOSS/feat/add-preauth-events
Add preauth webhook events
2 parents 4104623 + 1feb8e2 commit 94af513

7 files changed

Lines changed: 517 additions & 0 deletions

File tree

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
const preauthorization_capture_failed = `{
2+
"event": "preauthorization.capture.failed",
3+
"data": {
4+
"amount": 1000,
5+
"authorization": {
6+
"account_name": null,
7+
"authorization_code": "AUTH_ove5p6reju",
8+
"bank": "NEDBANK",
9+
"bin": "492213",
10+
"brand": "visa",
11+
"card_type": "visa credit",
12+
"channel": "card",
13+
"country_code": "ZA",
14+
"exp_month": "03",
15+
"exp_year": "2025",
16+
"last4": "6658",
17+
"reusable": true,
18+
"signature": "SIG_9bg7BgE0xiRxNVsil7Yo"
19+
},
20+
"captured_amount": "1000",
21+
"captured_at": null,
22+
"currency": "ZAR",
23+
"customer": {
24+
"id": 1,
25+
"first_name": "John",
26+
"last_name": "Doe",
27+
"email": "john@test.com",
28+
"customer_code": "CUS_yqcuukj44ype5u1",
29+
"phone": "01142272921",
30+
"metadata": null,
31+
"risk_action": "default",
32+
"international_format_phone": null
33+
},
34+
"domain": "live",
35+
"expired_at": null,
36+
"fees": 0,
37+
"message": null,
38+
"id": 3099,
39+
"merchant_id": 412922,
40+
"merchant_name": "Test Business",
41+
"metadata": null,
42+
"reference": "atyntuup5bec03e",
43+
"status": "capture_failed",
44+
"transaction_id": "1504264401",
45+
"expiry_date": "2023-11-19T23:28:52.000Z",
46+
"expire_action": "release"
47+
}
48+
}`
49+
50+
const preauthorization_capture_success = `{
51+
"event": "preauthorization.capture.success",
52+
"data": {
53+
"amount": 1000,
54+
"authorization": {
55+
"account_name": null,
56+
"authorization_code": "AUTH_ove5p6reju",
57+
"bank": "NEDBANK",
58+
"bin": "492213",
59+
"brand": "visa",
60+
"card_type": "visa credit",
61+
"channel": "card",
62+
"country_code": "ZA",
63+
"exp_month": "03",
64+
"exp_year": "2025",
65+
"last4": "6658",
66+
"reusable": true,
67+
"signature": "SIG_9bg7BgE0xiRxNVsil7Yo"
68+
},
69+
"captured_amount": "1000",
70+
"captured_at": "2023-11-10T11:58:44.000Z",
71+
"currency": "ZAR",
72+
"customer": {
73+
"id": 1,
74+
"first_name": "John",
75+
"last_name": "Doe",
76+
"email": "john@test.com",
77+
"customer_code": "CUS_yqcuukj44ype5u1",
78+
"phone": "01142272921",
79+
"metadata": null,
80+
"risk_action": "default",
81+
"international_format_phone": null
82+
},
83+
"domain": "live",
84+
"fees": 0,
85+
"message": "Approved",
86+
"id": 3099,
87+
"merchant_id": 412922,
88+
"merchant_name": "Test Business",
89+
"metadata": null,
90+
"reference": "atyntuup5bec03e",
91+
"status": "captured",
92+
"transaction": {
93+
"currency": "ZAR",
94+
"transaction_date": "2023-11-10T11:58:44.000Z",
95+
"status": "success",
96+
"reference": "atyntuup5bec03e",
97+
"domain": "live",
98+
"metadata": null,
99+
"gateway_response": "Approved",
100+
"message": null,
101+
"channel": "preauth",
102+
"fees": 26,
103+
"id": "1504264401",
104+
"split": {}
105+
},
106+
"transaction_id": "1504264401",
107+
"expiry_date": null,
108+
"expire_action": "capture",
109+
"split_code": null,
110+
"split": null
111+
}
112+
}`
113+
114+
const preauthorization_release_failed = `{
115+
"event": "preauthorization.release.failed",
116+
"data": {
117+
"amount": 1000,
118+
"authorization": {
119+
"account_name": null,
120+
"authorization_code": "AUTH_ove5p6reju",
121+
"bank": "NEDBANK",
122+
"bin": "492213",
123+
"brand": "visa",
124+
"card_type": "visa credit",
125+
"channel": "card",
126+
"country_code": "ZA",
127+
"exp_month": "03",
128+
"exp_year": "2025",
129+
"last4": "6658",
130+
"reusable": true,
131+
"signature": "SIG_9bg7BgE0xiRxNVsil7Yo"
132+
},
133+
"captured_amount": null,
134+
"captured_at": null,
135+
"currency": "ZAR",
136+
"customer": {
137+
"id": 1,
138+
"first_name": "John",
139+
"last_name": "Doe",
140+
"email": "john@test.com",
141+
"customer_code": "CUS_yqcuukj44ype5u1",
142+
"phone": "01142272921",
143+
"metadata": null,
144+
"risk_action": "default",
145+
"international_format_phone": null
146+
},
147+
"domain": "live",
148+
"fees": 100,
149+
"message": "Release failed",
150+
"id": 3118,
151+
"merchant_id": 412922,
152+
"merchant_name": "Test Business",
153+
"metadata": null,
154+
"reference": "h15lgtld6kqlkcm",
155+
"status": "release_failed",
156+
"transaction_id": null,
157+
"expiry_date": "2023-11-19T23:28:52.000Z"
158+
}
159+
}`
160+
161+
const preauthorization_release_success = `{
162+
"event": "preauthorization.release.success",
163+
"data": {
164+
"amount": 1000,
165+
"authorization": {
166+
"account_name": null,
167+
"authorization_code": "AUTH_ove5p6reju",
168+
"bank": "NEDBANK",
169+
"bin": "492213",
170+
"brand": "visa",
171+
"card_type": "visa credit",
172+
"channel": "card",
173+
"country_code": "ZA",
174+
"exp_month": "03",
175+
"exp_year": "2025",
176+
"last4": "6658",
177+
"reusable": true,
178+
"signature": "SIG_9bg7BgE0xiRxNVsil7Yo"
179+
},
180+
"captured_amount": null,
181+
"captured_at": null,
182+
"currency": "ZAR",
183+
"customer": {
184+
"id": 1,
185+
"first_name": "John",
186+
"last_name": "Doe",
187+
"email": "john@test.com",
188+
"customer_code": "CUS_yqcuukj44ype5u1",
189+
"phone": "01142272921",
190+
"metadata": null,
191+
"risk_action": "default",
192+
"international_format_phone": null
193+
},
194+
"domain": "live",
195+
"expired_at": "2023-11-17T12:46:58.000Z",
196+
"fees": 100,
197+
"message": "Release success",
198+
"id": 3101,
199+
"merchant_id": 412922,
200+
"merchant_name": "Test Business",
201+
"metadata": null,
202+
"reference": "pre_11b0qw12",
203+
"status": "released",
204+
"transaction_id": null,
205+
"expiry_date": "2024-11-19T23:28:52.000Z",
206+
"expire_action": "release"
207+
}
208+
}`
209+
210+
const preauthorization_reserve_success = `{
211+
"event": "preauthorization.reserve.success",
212+
"data": {
213+
"id": 543,
214+
"domain": "live",
215+
"status": "authorized",
216+
"reference": "pre_9gjnu6dc",
217+
"amount": 1000,
218+
"message": "Approved",
219+
"currency": "ZAR",
220+
"metadata": null,
221+
"fees": 100,
222+
"authorization": {
223+
"authorization_code": "AUTH_vbvd4qti3m",
224+
"bin": "455027",
225+
"last4": "8016",
226+
"exp_month": "11",
227+
"exp_year": "2026",
228+
"channel": "card",
229+
"card_type": "visa credit",
230+
"bank": "ABSA BANK LIMITED, SOUTH AFRICA",
231+
"country_code": "ZA",
232+
"brand": "visa",
233+
"reusable": true,
234+
"signature": "SIG_1zl7r116ONxGlRFXKn0C",
235+
"account_name": null
236+
},
237+
"customer": {
238+
"id": 1,
239+
"first_name": "John",
240+
"last_name": "Doe",
241+
"email": "john@test.com",
242+
"customer_code": "CUS_yqcuukj44ype5u1",
243+
"phone": "",
244+
"metadata": null,
245+
"risk_action": "default",
246+
"international_format_phone": null
247+
},
248+
"merchant_id": 1077497,
249+
"merchant_name": "Test Business",
250+
"transaction_id": null,
251+
"captured_at": null,
252+
"captured_amount": null,
253+
"expiry_date": "2023-11-19T23:28:52.000Z",
254+
"expire_action": "release",
255+
"split_code": null,
256+
"split": null
257+
}
258+
}`
259+
260+
export {preauthorization_capture_failed, preauthorization_capture_success, preauthorization_release_failed, preauthorization_release_success, preauthorization_reserve_success}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type: event
2+
languages:
3+
- json
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"event": "preauthorization.capture.failed",
3+
"data": {
4+
"amount": 1000,
5+
"authorization": {
6+
"account_name": null,
7+
"authorization_code": "AUTH_ove5p6reju",
8+
"bank": "NEDBANK",
9+
"bin": "492213",
10+
"brand": "visa",
11+
"card_type": "visa credit",
12+
"channel": "card",
13+
"country_code": "ZA",
14+
"exp_month": "03",
15+
"exp_year": "2025",
16+
"last4": "6658",
17+
"reusable": true,
18+
"signature": "SIG_9bg7BgE0xiRxNVsil7Yo"
19+
},
20+
"captured_amount": "1000",
21+
"captured_at": null,
22+
"currency": "ZAR",
23+
"customer": {
24+
"id": 1,
25+
"first_name": "John",
26+
"last_name": "Doe",
27+
"email": "john@test.com",
28+
"customer_code": "CUS_yqcuukj44ype5u1",
29+
"phone": "01142272921",
30+
"metadata": null,
31+
"risk_action": "default",
32+
"international_format_phone": null
33+
},
34+
"domain": "live",
35+
"expired_at": null,
36+
"fees": 0,
37+
"message": null,
38+
"id": 3099,
39+
"merchant_id": 412922,
40+
"merchant_name": "Test Business",
41+
"metadata": null,
42+
"reference": "atyntuup5bec03e",
43+
"status": "capture_failed",
44+
"transaction_id": "1504264401",
45+
"expiry_date": "2023-11-19T23:28:52.000Z",
46+
"expire_action": "release"
47+
}
48+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"event": "preauthorization.capture.success",
3+
"data": {
4+
"amount": 1000,
5+
"authorization": {
6+
"account_name": null,
7+
"authorization_code": "AUTH_ove5p6reju",
8+
"bank": "NEDBANK",
9+
"bin": "492213",
10+
"brand": "visa",
11+
"card_type": "visa credit",
12+
"channel": "card",
13+
"country_code": "ZA",
14+
"exp_month": "03",
15+
"exp_year": "2025",
16+
"last4": "6658",
17+
"reusable": true,
18+
"signature": "SIG_9bg7BgE0xiRxNVsil7Yo"
19+
},
20+
"captured_amount": "1000",
21+
"captured_at": "2023-11-10T11:58:44.000Z",
22+
"currency": "ZAR",
23+
"customer": {
24+
"id": 1,
25+
"first_name": "John",
26+
"last_name": "Doe",
27+
"email": "john@test.com",
28+
"customer_code": "CUS_yqcuukj44ype5u1",
29+
"phone": "01142272921",
30+
"metadata": null,
31+
"risk_action": "default",
32+
"international_format_phone": null
33+
},
34+
"domain": "live",
35+
"fees": 0,
36+
"message": "Approved",
37+
"id": 3099,
38+
"merchant_id": 412922,
39+
"merchant_name": "Test Business",
40+
"metadata": null,
41+
"reference": "atyntuup5bec03e",
42+
"status": "captured",
43+
"transaction": {
44+
"currency": "ZAR",
45+
"transaction_date": "2023-11-10T11:58:44.000Z",
46+
"status": "success",
47+
"reference": "atyntuup5bec03e",
48+
"domain": "live",
49+
"metadata": null,
50+
"gateway_response": "Approved",
51+
"message": null,
52+
"channel": "preauth",
53+
"fees": 26,
54+
"id": "1504264401",
55+
"split": {}
56+
},
57+
"transaction_id": "1504264401",
58+
"expiry_date": null,
59+
"expire_action": "capture",
60+
"split_code": null,
61+
"split": null
62+
}
63+
}

0 commit comments

Comments
 (0)