fairsure-checkout-sdk 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,10 +16,8 @@ export default function Checkout({ requestId, customerEmail, customerName, custo
16
16
  handleClose();
17
17
  }, (result) => {
18
18
  onPending === null || onPending === void 0 ? void 0 : onPending(result);
19
- handleClose();
20
19
  }, (error) => {
21
20
  onError === null || onError === void 0 ? void 0 : onError(error);
22
- handleClose();
23
21
  });
24
22
  const handleClose = () => {
25
23
  checkout.resetForm();
@@ -98,7 +98,8 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
98
98
  setLoading(true);
99
99
  const payload = {
100
100
  amount,
101
- requestId,
101
+ reference: requestId,
102
+ isBill: true,
102
103
  bankCode: selectedBank === null || selectedBank === void 0 ? void 0 : selectedBank.code,
103
104
  };
104
105
  try {
@@ -110,7 +111,6 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
110
111
  "User-Agent": "PostmanRuntime/7.51.0",
111
112
  },
112
113
  });
113
- console.log("USSD GENERATION RES", JSON.stringify(res.data.data, null, 2));
114
114
  setUssdBankResponse((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data);
115
115
  }
116
116
  catch (error) {
@@ -125,8 +125,8 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
125
125
  try {
126
126
  setLoading(true);
127
127
  const payload = {
128
- codeReference: ussdBankResponse === null || ussdBankResponse === void 0 ? void 0 : ussdBankResponse.codeRef,
129
128
  amount: ussdBankResponse === null || ussdBankResponse === void 0 ? void 0 : ussdBankResponse.amount,
129
+ codeReference: ussdBankResponse === null || ussdBankResponse === void 0 ? void 0 : ussdBankResponse.codeRef,
130
130
  };
131
131
  const res = await axios.post("https://api.fairsurepay.com/api/pub/ussd-status", payload, {
132
132
  headers: {
@@ -149,41 +149,12 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
149
149
  }
150
150
  }
151
151
  catch (error) {
152
- console.log("FETCH ERROR:", error);
153
152
  onError === null || onError === void 0 ? void 0 : onError(error);
154
153
  }
155
154
  finally {
156
155
  setLoading(false);
157
156
  }
158
157
  };
159
- // const verifyUssd = async () => {
160
- // try {
161
- // setLoading(true);
162
- // const payload = {
163
- // codeReference: ussdBankResponse?.codeRef,
164
- // amount: ussdBankResponse?.amount,
165
- // };
166
- // const res = await axios.post(
167
- // "https://api.fairsurepay.com/api/pub/ussd-status",
168
- // payload,
169
- // {
170
- // headers: {
171
- // Accept: "application/json",
172
- // "Content-Type": "application/json",
173
- // publickey: "LIVE_7AXSCCY8R3HABAN14QP7",
174
- // "User-Agent": "PostmanRuntime/7.51.0",
175
- // },
176
- // },
177
- // );
178
- // console.log("USSD PAYMENT RESPONSE", res);
179
- // onSuccess?.(cardDetails.transactionRef);
180
- // setLoading(false);
181
- // } catch (error) {
182
- // console.log("FETCH ERROR:", error);
183
- // } finally {
184
- // setLoading(false);
185
- // }
186
- // };
187
158
  useEffect(() => {
188
159
  if (selectedBank) {
189
160
  generateUssdCode();
@@ -258,17 +229,48 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
258
229
  }
259
230
  return v;
260
231
  };
232
+ const checkCardPaymentStatus = async (transactionRef, amount) => {
233
+ var _a, _b;
234
+ console.log("TRANSACTION REF", transactionRef, amount);
235
+ try {
236
+ const res = await axios.get(`https://api.fairsurepay.com/api/pub/verify-transaction?transaction_ref=${transactionRef}&amount=${amount}`, {
237
+ headers: {
238
+ Accept: "application/json",
239
+ "Content-Type": "application/json",
240
+ publickey: "LIVE_7AXSCCY8R3HABAN14QP7",
241
+ "User-Agent": "PostmanRuntime/7.36.0",
242
+ },
243
+ });
244
+ const result = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data;
245
+ const code = result === null || result === void 0 ? void 0 : result.responseCode;
246
+ console.log("RESPONSE", JSON.stringify(result, null, 2));
247
+ if (code === "00") {
248
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transferDetail.transactionReference);
249
+ }
250
+ else if (PENDING_CODES.includes(code)) {
251
+ onPending === null || onPending === void 0 ? void 0 : onPending(result);
252
+ }
253
+ else {
254
+ // includes "Z0" (Transaction not Completed) until confirmed otherwise
255
+ onError === null || onError === void 0 ? void 0 : onError((_b = result === null || result === void 0 ? void 0 : result.responseDescription) !== null && _b !== void 0 ? _b : "Transfer could not be verified");
256
+ }
257
+ return res === null || res === void 0 ? void 0 : res.data;
258
+ }
259
+ catch (error) {
260
+ onError === null || onError === void 0 ? void 0 : onError(error);
261
+ }
262
+ };
261
263
  const completeCard = async (data) => {
262
264
  var _a, _b, _c;
263
265
  setLoading(true);
264
266
  try {
265
267
  const payload = {
266
- customerId: customerEmail,
268
+ customerId: "08164493471_airtime_fairsurepay_com",
267
269
  amount: String(amount),
268
270
  transactionRef: requestId,
269
271
  currency: "NGN",
270
- callbackUrl: "https://yourcallbackurl.com",
271
- isBill: "true",
272
+ callBackUrl: "https://checkout.fairsurepay.com/",
273
+ isBill: true,
272
274
  data: data,
273
275
  deviceInformation: {
274
276
  deviceChannel: "MOBILE",
@@ -341,17 +343,19 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
341
343
  }
342
344
  };
343
345
  const verifyCardPayment = async () => {
344
- var _a, _b, _c, _d;
346
+ var _a;
345
347
  setLoading(true);
346
348
  try {
347
349
  const payload = {
348
350
  transactionId: cardDetails === null || cardDetails === void 0 ? void 0 : cardDetails.transactionRef,
349
351
  paymentId: cardDetails === null || cardDetails === void 0 ? void 0 : cardDetails.paymentId,
352
+ // eciFlag: "07",
350
353
  otp: otp,
351
354
  customerName,
352
355
  customerPhone,
353
- customerEmail,
356
+ customerEmail: "08164493471_airtime_fairsurepay_com",
354
357
  };
358
+ console.log("Payload:", payload);
355
359
  const res = await axios.post("https://api.fairsurepay.com/api/pub/submit-otp", payload, {
356
360
  headers: {
357
361
  Accept: "application/json",
@@ -360,59 +364,17 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
360
364
  "User-Agent": "PostmanRuntime/7.36.0",
361
365
  },
362
366
  });
363
- const result = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data;
364
- const status = (_c = (_b = result === null || result === void 0 ? void 0 : result.message) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : "";
365
- if (status.includes("pending")) {
366
- onPending === null || onPending === void 0 ? void 0 : onPending(result);
367
- }
368
- else if (status.includes("success") || (result === null || result === void 0 ? void 0 : result.paid)) {
369
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(cardDetails.transactionRef);
370
- }
371
- else {
372
- onError === null || onError === void 0 ? void 0 : onError((_d = result === null || result === void 0 ? void 0 : result.message) !== null && _d !== void 0 ? _d : "Card payment could not be verified");
373
- }
367
+ console.log("RESPONSEhhhhhhh", JSON.stringify((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data, null, 2));
368
+ // await checkCardPaymentStatus(res?.data?.data?.transactionRef, amount);s
369
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transferDetail.transactionReference);
370
+ setLoading(false);
374
371
  return res === null || res === void 0 ? void 0 : res.data;
375
372
  }
376
373
  catch (error) {
377
- console.log("ERROR", error);
378
- onError === null || onError === void 0 ? void 0 : onError(error);
379
- }
380
- finally {
381
374
  setLoading(false);
375
+ console.log("ERROR", error);
382
376
  }
383
377
  };
384
- // const verifyCardPayment = async () => {
385
- // setLoading(true);
386
- // try {
387
- // const payload = {
388
- // transactionId: cardDetails?.transactionRef,
389
- // paymentId: cardDetails?.paymentId,
390
- // // eciFlag: "07",
391
- // otp: otp,
392
- // customerName,
393
- // customerPhone,
394
- // customerEmail,
395
- // };
396
- // const res = await axios.post(
397
- // "https://api.fairsurepay.com/api/pub/submit-otp",
398
- // payload,
399
- // {
400
- // headers: {
401
- // Accept: "application/json",
402
- // "Content-Type": "application/json",
403
- // publickey: "LIVE_7AXSCCY8R3HABAN14QP7",
404
- // "User-Agent": "PostmanRuntime/7.36.0",
405
- // },
406
- // },
407
- // );
408
- // onSuccess?.(transferDetail.transactionReference);
409
- // setLoading(false);
410
- // return res?.data;
411
- // } catch (error) {
412
- // setLoading(false);
413
- // console.log("ERROR", error);
414
- // }
415
- // };
416
378
  // const verifyTransfer = async () => {
417
379
  // setLoading(true);
418
380
  // try {
@@ -428,7 +390,7 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
428
390
  // },
429
391
  // },
430
392
  // );
431
- // console.log("RESPONSE", res);
393
+ // console.log("RESPONSE", res?.data?.data);
432
394
  // onSuccess?.(transferDetail.transactionReference);
433
395
  // return res?.data;
434
396
  // } catch (error: any) {
@@ -437,8 +399,9 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
437
399
  // setLoading(false);
438
400
  // }
439
401
  // };
402
+ const PENDING_CODES = ["00", "01", "02", "03"];
440
403
  const verifyTransfer = async () => {
441
- var _a, _b, _c, _d, _e;
404
+ var _a, _b, _c;
442
405
  setLoading(true);
443
406
  try {
444
407
  const res = await axios.get(`https://api.fairsurepay.com/api/pub/transfer-status?transactionReference=${transferDetail === null || transferDetail === void 0 ? void 0 : transferDetail.transactionReference}`, {
@@ -447,24 +410,25 @@ export function usePaymentCheckout(amount, requestId, customerEmail, customerNam
447
410
  Accept: "application/json",
448
411
  "Content-Type": "application/json",
449
412
  publickey: "LIVE_7AXSCCY8R3HABAN14QP7",
450
- "User-Agent": "PostmanRuntime/7.36.0",
451
413
  },
452
414
  });
453
415
  const result = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.data;
454
- const status = (_c = (_b = result === null || result === void 0 ? void 0 : result.message) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : "";
455
- if (status.includes("pending")) {
456
- onPending === null || onPending === void 0 ? void 0 : onPending(result);
457
- }
458
- else if (status.includes("success") || (result === null || result === void 0 ? void 0 : result.paid)) {
416
+ const code = result === null || result === void 0 ? void 0 : result.responseCode;
417
+ console.log("RESPONSE", JSON.stringify(result, null, 2));
418
+ if (code === "00") {
459
419
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(transferDetail.transactionReference);
460
420
  }
421
+ else if (PENDING_CODES.includes(code)) {
422
+ onPending === null || onPending === void 0 ? void 0 : onPending(result);
423
+ }
461
424
  else {
462
- onError === null || onError === void 0 ? void 0 : onError((_d = result === null || result === void 0 ? void 0 : result.message) !== null && _d !== void 0 ? _d : "Transfer could not be verified");
425
+ // includes "Z0" (Transaction not Completed) until confirmed otherwise
426
+ onError === null || onError === void 0 ? void 0 : onError((_b = result === null || result === void 0 ? void 0 : result.responseDescription) !== null && _b !== void 0 ? _b : "Transfer could not be verified");
463
427
  }
464
428
  return res === null || res === void 0 ? void 0 : res.data;
465
429
  }
466
430
  catch (error) {
467
- console.log("Failed to Verify transfer", (_e = error.response) === null || _e === void 0 ? void 0 : _e.data);
431
+ console.log("Failed to Verify transfer", (_c = error.response) === null || _c === void 0 ? void 0 : _c.data);
468
432
  onError === null || onError === void 0 ? void 0 : onError(error);
469
433
  }
470
434
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fairsure-checkout-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -58,11 +58,9 @@ export default function Checkout({
58
58
  },
59
59
  (result) => {
60
60
  onPending?.(result);
61
- handleClose();
62
61
  },
63
62
  (error) => {
64
63
  onError?.(error);
65
- handleClose();
66
64
  },
67
65
  );
68
66
 
@@ -118,7 +118,8 @@ export function usePaymentCheckout(
118
118
  setLoading(true);
119
119
  const payload = {
120
120
  amount,
121
- requestId,
121
+ reference: requestId,
122
+ isBill: true,
122
123
  bankCode: selectedBank?.code,
123
124
  };
124
125
 
@@ -135,11 +136,6 @@ export function usePaymentCheckout(
135
136
  },
136
137
  },
137
138
  );
138
- console.log(
139
- "USSD GENERATION RES",
140
- JSON.stringify(res.data.data, null, 2),
141
- );
142
-
143
139
  setUssdBankResponse(res?.data?.data);
144
140
  } catch (error) {
145
141
  console.log("FETCH ERROR:", error);
@@ -152,9 +148,10 @@ export function usePaymentCheckout(
152
148
  try {
153
149
  setLoading(true);
154
150
  const payload = {
155
- codeReference: ussdBankResponse?.codeRef,
156
151
  amount: ussdBankResponse?.amount,
152
+ codeReference: ussdBankResponse?.codeRef,
157
153
  };
154
+
158
155
  const res = await axios.post(
159
156
  "https://api.fairsurepay.com/api/pub/ussd-status",
160
157
  payload,
@@ -169,6 +166,7 @@ export function usePaymentCheckout(
169
166
  );
170
167
 
171
168
  const result = res?.data?.data;
169
+
172
170
  const status = result?.message?.toLowerCase() ?? "";
173
171
  if (status.includes("pending")) {
174
172
  onPending?.(result);
@@ -178,43 +176,12 @@ export function usePaymentCheckout(
178
176
  onError?.(result?.message ?? "Payment could not be verified");
179
177
  }
180
178
  } catch (error) {
181
- console.log("FETCH ERROR:", error);
182
179
  onError?.(error);
183
180
  } finally {
184
181
  setLoading(false);
185
182
  }
186
183
  };
187
184
 
188
- // const verifyUssd = async () => {
189
- // try {
190
- // setLoading(true);
191
- // const payload = {
192
- // codeReference: ussdBankResponse?.codeRef,
193
- // amount: ussdBankResponse?.amount,
194
- // };
195
- // const res = await axios.post(
196
- // "https://api.fairsurepay.com/api/pub/ussd-status",
197
- // payload,
198
- // {
199
- // headers: {
200
- // Accept: "application/json",
201
- // "Content-Type": "application/json",
202
- // publickey: "LIVE_7AXSCCY8R3HABAN14QP7",
203
- // "User-Agent": "PostmanRuntime/7.51.0",
204
- // },
205
- // },
206
- // );
207
- // console.log("USSD PAYMENT RESPONSE", res);
208
-
209
- // onSuccess?.(cardDetails.transactionRef);
210
- // setLoading(false);
211
- // } catch (error) {
212
- // console.log("FETCH ERROR:", error);
213
- // } finally {
214
- // setLoading(false);
215
- // }
216
- // };
217
-
218
185
  useEffect(() => {
219
186
  if (selectedBank) {
220
187
  generateUssdCode();
@@ -300,16 +267,55 @@ export function usePaymentCheckout(
300
267
  return v;
301
268
  };
302
269
 
270
+ const checkCardPaymentStatus = async (
271
+ transactionRef: string,
272
+ amount: number,
273
+ ) => {
274
+ console.log("TRANSACTION REF", transactionRef, amount);
275
+
276
+ try {
277
+ const res = await axios.get(
278
+ `https://api.fairsurepay.com/api/pub/verify-transaction?transaction_ref=${transactionRef}&amount=${amount}`,
279
+ {
280
+ headers: {
281
+ Accept: "application/json",
282
+ "Content-Type": "application/json",
283
+ publickey: "LIVE_7AXSCCY8R3HABAN14QP7",
284
+ "User-Agent": "PostmanRuntime/7.36.0",
285
+ },
286
+ },
287
+ );
288
+ const result = res?.data?.data;
289
+ const code = result?.responseCode;
290
+
291
+ console.log("RESPONSE", JSON.stringify(result, null, 2));
292
+
293
+ if (code === "00") {
294
+ onSuccess?.(transferDetail.transactionReference);
295
+ } else if (PENDING_CODES.includes(code)) {
296
+ onPending?.(result);
297
+ } else {
298
+ // includes "Z0" (Transaction not Completed) until confirmed otherwise
299
+ onError?.(
300
+ result?.responseDescription ?? "Transfer could not be verified",
301
+ );
302
+ }
303
+ return res?.data;
304
+ } catch (error) {
305
+ onError?.(error);
306
+ }
307
+ };
308
+
303
309
  const completeCard = async (data: string) => {
304
310
  setLoading(true);
305
311
  try {
306
312
  const payload = {
307
- customerId: customerEmail,
313
+ customerId: "08164493471_airtime_fairsurepay_com",
308
314
  amount: String(amount),
309
315
  transactionRef: requestId,
310
316
  currency: "NGN",
311
- callbackUrl: "https://yourcallbackurl.com",
312
- isBill: "true",
317
+ callBackUrl: "https://checkout.fairsurepay.com/",
318
+ isBill: true,
313
319
  data: data,
314
320
  deviceInformation: {
315
321
  deviceChannel: "MOBILE",
@@ -323,6 +329,7 @@ export function usePaymentCheckout(
323
329
  httpBrowserTimeDifference: `${-new Date().getTimezoneOffset()}`,
324
330
  },
325
331
  };
332
+
326
333
  const res = await axios.post(
327
334
  "https://api.fairsurepay.com/api/pub/card-payment",
328
335
  payload,
@@ -373,6 +380,7 @@ export function usePaymentCheckout(
373
380
  },
374
381
  },
375
382
  );
383
+
376
384
  const data = await completeCard(res?.data?.data);
377
385
  setMessage(data?.data?.message);
378
386
  setCardDetails(data?.data);
@@ -393,11 +401,14 @@ export function usePaymentCheckout(
393
401
  const payload = {
394
402
  transactionId: cardDetails?.transactionRef,
395
403
  paymentId: cardDetails?.paymentId,
404
+ // eciFlag: "07",
396
405
  otp: otp,
397
406
  customerName,
398
407
  customerPhone,
399
- customerEmail,
408
+ customerEmail: "08164493471_airtime_fairsurepay_com",
400
409
  };
410
+ console.log("Payload:", payload);
411
+
401
412
  const res = await axios.post(
402
413
  "https://api.fairsurepay.com/api/pub/submit-otp",
403
414
  payload,
@@ -411,56 +422,17 @@ export function usePaymentCheckout(
411
422
  },
412
423
  );
413
424
 
414
- const result = res?.data?.data;
415
- const status = result?.message?.toLowerCase() ?? "";
416
-
417
- if (status.includes("pending")) {
418
- onPending?.(result);
419
- } else if (status.includes("success") || result?.paid) {
420
- onSuccess?.(cardDetails.transactionRef);
421
- } else {
422
- onError?.(result?.message ?? "Card payment could not be verified");
423
- }
425
+ console.log("RESPONSEhhhhhhh", JSON.stringify(res?.data?.data, null, 2));
426
+ // await checkCardPaymentStatus(res?.data?.data?.transactionRef, amount);s
427
+ onSuccess?.(transferDetail.transactionReference);
428
+ setLoading(false);
424
429
  return res?.data;
425
430
  } catch (error) {
426
- console.log("ERROR", error);
427
- onError?.(error);
428
- } finally {
429
431
  setLoading(false);
432
+ console.log("ERROR", error);
430
433
  }
431
434
  };
432
- // const verifyCardPayment = async () => {
433
- // setLoading(true);
434
- // try {
435
- // const payload = {
436
- // transactionId: cardDetails?.transactionRef,
437
- // paymentId: cardDetails?.paymentId,
438
- // // eciFlag: "07",
439
- // otp: otp,
440
- // customerName,
441
- // customerPhone,
442
- // customerEmail,
443
- // };
444
- // const res = await axios.post(
445
- // "https://api.fairsurepay.com/api/pub/submit-otp",
446
- // payload,
447
- // {
448
- // headers: {
449
- // Accept: "application/json",
450
- // "Content-Type": "application/json",
451
- // publickey: "LIVE_7AXSCCY8R3HABAN14QP7",
452
- // "User-Agent": "PostmanRuntime/7.36.0",
453
- // },
454
- // },
455
- // );
456
- // onSuccess?.(transferDetail.transactionReference);
457
- // setLoading(false);
458
- // return res?.data;
459
- // } catch (error) {
460
- // setLoading(false);
461
- // console.log("ERROR", error);
462
- // }
463
- // };
435
+
464
436
  // const verifyTransfer = async () => {
465
437
  // setLoading(true);
466
438
  // try {
@@ -476,9 +448,10 @@ export function usePaymentCheckout(
476
448
  // },
477
449
  // },
478
450
  // );
479
- // console.log("RESPONSE", res);
451
+ // console.log("RESPONSE", res?.data?.data);
480
452
 
481
453
  // onSuccess?.(transferDetail.transactionReference);
454
+
482
455
  // return res?.data;
483
456
  // } catch (error: any) {
484
457
  // console.log("Failed to Verify transfer", error.response?.data);
@@ -487,6 +460,7 @@ export function usePaymentCheckout(
487
460
  // }
488
461
  // };
489
462
 
463
+ const PENDING_CODES: string[] = ["00", "01", "02", "03"];
490
464
  const verifyTransfer = async () => {
491
465
  setLoading(true);
492
466
  try {
@@ -498,20 +472,24 @@ export function usePaymentCheckout(
498
472
  Accept: "application/json",
499
473
  "Content-Type": "application/json",
500
474
  publickey: "LIVE_7AXSCCY8R3HABAN14QP7",
501
- "User-Agent": "PostmanRuntime/7.36.0",
502
475
  },
503
476
  },
504
477
  );
505
478
 
506
479
  const result = res?.data?.data;
507
- const status = result?.message?.toLowerCase() ?? "";
480
+ const code = result?.responseCode;
508
481
 
509
- if (status.includes("pending")) {
510
- onPending?.(result);
511
- } else if (status.includes("success") || result?.paid) {
482
+ console.log("RESPONSE", JSON.stringify(result, null, 2));
483
+
484
+ if (code === "00") {
512
485
  onSuccess?.(transferDetail.transactionReference);
486
+ } else if (PENDING_CODES.includes(code)) {
487
+ onPending?.(result);
513
488
  } else {
514
- onError?.(result?.message ?? "Transfer could not be verified");
489
+ // includes "Z0" (Transaction not Completed) until confirmed otherwise
490
+ onError?.(
491
+ result?.responseDescription ?? "Transfer could not be verified",
492
+ );
515
493
  }
516
494
  return res?.data;
517
495
  } catch (error: any) {
@@ -521,6 +499,7 @@ export function usePaymentCheckout(
521
499
  setLoading(false);
522
500
  }
523
501
  };
502
+
524
503
  const resetForm = () => {
525
504
  setCardNumber("");
526
505
  setExpiryDate("");