@clikgate/node 0.0.0-stage → 2.0.1

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.
Files changed (119) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/LICENSE +21 -0
  3. package/README.md +311 -2
  4. package/SECURITY.md +34 -0
  5. package/dist/cjs/ads-hashing.d.ts +37 -0
  6. package/dist/cjs/ads-hashing.js +67 -0
  7. package/dist/cjs/click-ids.d.ts +184 -0
  8. package/dist/cjs/click-ids.js +535 -0
  9. package/dist/cjs/client.d.ts +191 -0
  10. package/dist/cjs/client.js +291 -0
  11. package/dist/cjs/config.d.ts +12 -0
  12. package/dist/cjs/config.js +87 -0
  13. package/dist/cjs/core.d.ts +15 -0
  14. package/dist/cjs/core.js +100 -0
  15. package/dist/cjs/customer-id.d.ts +26 -0
  16. package/dist/cjs/customer-id.js +52 -0
  17. package/dist/cjs/enums.d.ts +48 -0
  18. package/dist/cjs/enums.js +47 -0
  19. package/dist/cjs/errors.d.ts +117 -0
  20. package/dist/cjs/errors.js +257 -0
  21. package/dist/cjs/express.d.ts +49 -0
  22. package/dist/cjs/express.js +44 -0
  23. package/dist/cjs/fastify.d.ts +47 -0
  24. package/dist/cjs/fastify.js +35 -0
  25. package/dist/cjs/generated/index.d.ts +17793 -0
  26. package/dist/cjs/generated/index.js +8896 -0
  27. package/dist/cjs/goals.d.ts +116 -0
  28. package/dist/cjs/goals.js +381 -0
  29. package/dist/cjs/guard.d.ts +17 -0
  30. package/dist/cjs/guard.js +40 -0
  31. package/dist/cjs/http.d.ts +16 -0
  32. package/dist/cjs/http.js +148 -0
  33. package/dist/cjs/identity.d.ts +42 -0
  34. package/dist/cjs/identity.js +133 -0
  35. package/dist/cjs/index.d.ts +34 -0
  36. package/dist/cjs/index.js +70 -0
  37. package/dist/cjs/known-customers.d.ts +45 -0
  38. package/dist/cjs/known-customers.js +95 -0
  39. package/dist/cjs/logger.d.ts +9 -0
  40. package/dist/cjs/logger.js +8 -0
  41. package/dist/cjs/money.d.ts +16 -0
  42. package/dist/cjs/money.js +51 -0
  43. package/dist/cjs/next.d.ts +81 -0
  44. package/dist/cjs/next.js +103 -0
  45. package/dist/cjs/package.json +1 -0
  46. package/dist/cjs/payments.d.ts +174 -0
  47. package/dist/cjs/payments.js +485 -0
  48. package/dist/cjs/resources.d.ts +109 -0
  49. package/dist/cjs/resources.js +189 -0
  50. package/dist/cjs/shutdown.d.ts +2 -0
  51. package/dist/cjs/shutdown.js +51 -0
  52. package/dist/cjs/transport.d.ts +14 -0
  53. package/dist/cjs/transport.js +204 -0
  54. package/dist/cjs/types.d.ts +218 -0
  55. package/dist/cjs/types.js +2 -0
  56. package/dist/cjs/user-agent.d.ts +1 -0
  57. package/dist/cjs/user-agent.js +53 -0
  58. package/dist/cjs/version.d.ts +2 -0
  59. package/dist/cjs/version.js +5 -0
  60. package/dist/cjs/webhooks.d.ts +36 -0
  61. package/dist/cjs/webhooks.js +108 -0
  62. package/dist/esm/ads-hashing.d.ts +37 -0
  63. package/dist/esm/ads-hashing.js +62 -0
  64. package/dist/esm/click-ids.d.ts +184 -0
  65. package/dist/esm/click-ids.js +526 -0
  66. package/dist/esm/client.d.ts +191 -0
  67. package/dist/esm/client.js +287 -0
  68. package/dist/esm/config.d.ts +12 -0
  69. package/dist/esm/config.js +82 -0
  70. package/dist/esm/core.d.ts +15 -0
  71. package/dist/esm/core.js +96 -0
  72. package/dist/esm/customer-id.d.ts +26 -0
  73. package/dist/esm/customer-id.js +47 -0
  74. package/dist/esm/enums.d.ts +48 -0
  75. package/dist/esm/enums.js +44 -0
  76. package/dist/esm/errors.d.ts +117 -0
  77. package/dist/esm/errors.js +234 -0
  78. package/dist/esm/express.d.ts +49 -0
  79. package/dist/esm/express.js +40 -0
  80. package/dist/esm/fastify.d.ts +47 -0
  81. package/dist/esm/fastify.js +32 -0
  82. package/dist/esm/generated/index.d.ts +17793 -0
  83. package/dist/esm/generated/index.js +8833 -0
  84. package/dist/esm/goals.d.ts +116 -0
  85. package/dist/esm/goals.js +371 -0
  86. package/dist/esm/guard.d.ts +17 -0
  87. package/dist/esm/guard.js +36 -0
  88. package/dist/esm/http.d.ts +16 -0
  89. package/dist/esm/http.js +138 -0
  90. package/dist/esm/identity.d.ts +42 -0
  91. package/dist/esm/identity.js +125 -0
  92. package/dist/esm/index.d.ts +34 -0
  93. package/dist/esm/index.js +23 -0
  94. package/dist/esm/known-customers.d.ts +45 -0
  95. package/dist/esm/known-customers.js +90 -0
  96. package/dist/esm/logger.d.ts +9 -0
  97. package/dist/esm/logger.js +5 -0
  98. package/dist/esm/money.d.ts +16 -0
  99. package/dist/esm/money.js +48 -0
  100. package/dist/esm/next.d.ts +81 -0
  101. package/dist/esm/next.js +96 -0
  102. package/dist/esm/package.json +1 -0
  103. package/dist/esm/payments.d.ts +174 -0
  104. package/dist/esm/payments.js +476 -0
  105. package/dist/esm/resources.d.ts +109 -0
  106. package/dist/esm/resources.js +183 -0
  107. package/dist/esm/shutdown.d.ts +2 -0
  108. package/dist/esm/shutdown.js +47 -0
  109. package/dist/esm/transport.d.ts +14 -0
  110. package/dist/esm/transport.js +166 -0
  111. package/dist/esm/types.d.ts +218 -0
  112. package/dist/esm/types.js +1 -0
  113. package/dist/esm/user-agent.d.ts +1 -0
  114. package/dist/esm/user-agent.js +16 -0
  115. package/dist/esm/version.d.ts +2 -0
  116. package/dist/esm/version.js +2 -0
  117. package/dist/esm/webhooks.d.ts +36 -0
  118. package/dist/esm/webhooks.js +105 -0
  119. package/package.json +128 -4
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatValue = formatValue;
4
+ const errors_js_1 = require("./errors.js");
5
+ const DECIMAL = /^[0-9]+(\.[0-9]+)?$/;
6
+ function plain(n) {
7
+ const s = String(n);
8
+ if (!/e/i.test(s))
9
+ return s;
10
+ if (Number.isInteger(n))
11
+ return BigInt(n).toString();
12
+ return n.toFixed(20).replace(/0+$/, '').replace(/\.$/, '');
13
+ }
14
+ /**
15
+ * Format a money value for the wire: always a plain decimal string (SPEC section 8).
16
+ *
17
+ * - strings are trimmed and must look like `2000000` or `1500.50` (no signs, exponents or separators);
18
+ * - integers and bigints are sent as their digits;
19
+ * - non-integer numbers are sent as their shortest decimal form, with an `inexact_number` warning.
20
+ *
21
+ * @throws {InvalidRequestError} code `invalid_value` for anything else.
22
+ * @example
23
+ * formatValue('1500.50'); // '1500.50'
24
+ * formatValue(2_000_000); // '2000000'
25
+ * formatValue(10n ** 18n); // '1000000000000000000'
26
+ */
27
+ function formatValue(value, warn) {
28
+ const bad = (why) => (0, errors_js_1.localError)('invalid_value', `value ${why}. Pass a decimal string in normal units, like '1500.50'.`, 'value');
29
+ if (typeof value === 'string') {
30
+ const s = value.trim();
31
+ if (!DECIMAL.test(s))
32
+ throw bad('must be a non-negative decimal number');
33
+ return s;
34
+ }
35
+ if (typeof value === 'bigint') {
36
+ if (value < 0n)
37
+ throw bad('must not be negative');
38
+ return value.toString();
39
+ }
40
+ if (typeof value === 'number') {
41
+ if (!Number.isFinite(value))
42
+ throw bad('must be a finite number');
43
+ if (value < 0)
44
+ throw bad('must not be negative');
45
+ if (Number.isSafeInteger(value))
46
+ return String(value);
47
+ warn?.(`value ${String(value)} is a floating-point number and may not be exact; pass a decimal string, like '1500.50', for exact values.`);
48
+ return plain(value);
49
+ }
50
+ throw bad(`has unsupported type ${value === null ? 'null' : typeof value}`);
51
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Next.js add-on: keeps the click ID (SPEC section 17). Next.js 16 calls request middleware a
3
+ * "proxy" (`proxy.ts`, exporting `proxy`); `middleware.ts` still works but is deprecated.
4
+ *
5
+ * @example
6
+ * // proxy.ts (Next.js 16+)
7
+ * export { clikgateProxy as proxy } from '@clikgate/node/next';
8
+ * export const config = { matcher: ['/((?!_next/|api/webhooks/).*)'] };
9
+ *
10
+ * // app/signup/route.ts
11
+ * import { cookies } from 'next/headers';
12
+ * import { getClickId } from '@clikgate/node/next';
13
+ * const clickId = getClickId(await cookies());
14
+ *
15
+ * @packageDocumentation
16
+ */
17
+ import { NextResponse, type NextRequest } from 'next/server.js';
18
+ import { type KeepRoute, type KeepRouteOptions, type PersistOptions } from './click-ids.js';
19
+ /** A cookie store: `request.cookies` or the awaited `cookies()` from `next/headers`. */
20
+ export interface CookieStoreLike {
21
+ get(name: string): {
22
+ value: string;
23
+ } | undefined;
24
+ }
25
+ /** Options for {@link createClikgateProxy}. */
26
+ export interface ClikgateProxyOptions extends PersistOptions {
27
+ /** The click-ID parameter (default `process.env.CLIKGATE_CLICK_ID_PARAM`, else `cgid`). */
28
+ clickIdParam?: string;
29
+ }
30
+ /**
31
+ * Add the click-ID cookie to an existing response when the request's query string carries a click ID.
32
+ * Use it inside your own proxy.
33
+ *
34
+ * @example
35
+ * export function proxy(request: NextRequest) {
36
+ * const response = NextResponse.next();
37
+ * applyClikgate(request, response);
38
+ * return response;
39
+ * }
40
+ */
41
+ export declare function applyClikgate(request: NextRequest, response: NextResponse, options?: ClikgateProxyOptions): string | null;
42
+ /**
43
+ * Build a proxy (or legacy middleware) function with options.
44
+ *
45
+ * @example
46
+ * export const proxy = createClikgateProxy({ days: 30, clickIdParam: 'ref' });
47
+ */
48
+ export declare function createClikgateProxy(options?: ClikgateProxyOptions): (request: NextRequest) => NextResponse;
49
+ /**
50
+ * The ready-made proxy for `proxy.ts`: stores a click ID from the query string in the `_cg_<param>` cookie.
51
+ *
52
+ * @example
53
+ * export { clikgateProxy as proxy } from '@clikgate/node/next';
54
+ */
55
+ export declare const clikgateProxy: (request: NextRequest) => NextResponse;
56
+ /**
57
+ * The same function for the deprecated `middleware.ts` (`export { clikgateMiddleware as middleware }`).
58
+ */
59
+ export declare const clikgateMiddleware: (request: NextRequest) => NextResponse;
60
+ /**
61
+ * Read the kept click ID from a cookie store, e.g. `getClickId(await cookies())` in a route handler or
62
+ * server action, or `getClickId(request.cookies)`.
63
+ *
64
+ * @example
65
+ * import { cookies } from 'next/headers';
66
+ * const clickId = getClickId(await cookies());
67
+ */
68
+ export declare function getClickId(store: CookieStoreLike, clickIdParam?: string): string | null;
69
+ /**
70
+ * The `/cg/keep` route handler without a client, using the same click-ID parameter as the proxy
71
+ * (`clickIdParam`, else `process.env.CLIKGATE_CLICK_ID_PARAM`, else `cgid`). With a client, use
72
+ * `clikgate.clickIds.keepRoute()` instead.
73
+ *
74
+ * @example
75
+ * // app/cg/keep/route.ts
76
+ * import { keepRoute } from '@clikgate/node/next';
77
+ * export const POST = keepRoute({ days: 90 });
78
+ */
79
+ export declare function keepRoute(options?: KeepRouteOptions & {
80
+ clickIdParam?: string;
81
+ }): KeepRoute;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clikgateMiddleware = exports.clikgateProxy = void 0;
4
+ exports.applyClikgate = applyClikgate;
5
+ exports.createClikgateProxy = createClikgateProxy;
6
+ exports.getClickId = getClickId;
7
+ exports.keepRoute = keepRoute;
8
+ /**
9
+ * Next.js add-on: keeps the click ID (SPEC section 17). Next.js 16 calls request middleware a
10
+ * "proxy" (`proxy.ts`, exporting `proxy`); `middleware.ts` still works but is deprecated.
11
+ *
12
+ * @example
13
+ * // proxy.ts (Next.js 16+)
14
+ * export { clikgateProxy as proxy } from '@clikgate/node/next';
15
+ * export const config = { matcher: ['/((?!_next/|api/webhooks/).*)'] };
16
+ *
17
+ * // app/signup/route.ts
18
+ * import { cookies } from 'next/headers';
19
+ * import { getClickId } from '@clikgate/node/next';
20
+ * const clickId = getClickId(await cookies());
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+ const server_js_1 = require("next/server.js");
25
+ const click_ids_js_1 = require("./click-ids.js");
26
+ function helpersFor(param) {
27
+ const name = param ?? (typeof process !== 'undefined' ? process.env.CLIKGATE_CLICK_ID_PARAM : undefined) ?? 'cgid';
28
+ return new click_ids_js_1.ClickIds(() => name);
29
+ }
30
+ /**
31
+ * Add the click-ID cookie to an existing response when the request's query string carries a click ID.
32
+ * Use it inside your own proxy.
33
+ *
34
+ * @example
35
+ * export function proxy(request: NextRequest) {
36
+ * const response = NextResponse.next();
37
+ * applyClikgate(request, response);
38
+ * return response;
39
+ * }
40
+ */
41
+ function applyClikgate(request, response, options = {}) {
42
+ const { clickIdParam, ...cookie } = options;
43
+ const helpers = helpersFor(clickIdParam);
44
+ const fromQuery = request.nextUrl.searchParams.getAll(helpers.paramName).find((v) => helpers.isValid(v)) ?? null;
45
+ if (fromQuery) {
46
+ const secure = cookie.secure ?? request.nextUrl.protocol === 'https:';
47
+ response.headers.append('set-cookie', helpers.cookieHeader(fromQuery, { ...cookie, secure }));
48
+ response.headers.append('set-cookie', (0, click_ids_js_1.keptMarkerHeader)({ ...cookie, secure }));
49
+ return fromQuery;
50
+ }
51
+ return helpers.fromRequest({ url: request.nextUrl.href, headers: request.headers });
52
+ }
53
+ /**
54
+ * Build a proxy (or legacy middleware) function with options.
55
+ *
56
+ * @example
57
+ * export const proxy = createClikgateProxy({ days: 30, clickIdParam: 'ref' });
58
+ */
59
+ function createClikgateProxy(options = {}) {
60
+ return (request) => {
61
+ const response = server_js_1.NextResponse.next();
62
+ applyClikgate(request, response, options);
63
+ return response;
64
+ };
65
+ }
66
+ /**
67
+ * The ready-made proxy for `proxy.ts`: stores a click ID from the query string in the `_cg_<param>` cookie.
68
+ *
69
+ * @example
70
+ * export { clikgateProxy as proxy } from '@clikgate/node/next';
71
+ */
72
+ exports.clikgateProxy = createClikgateProxy();
73
+ /**
74
+ * The same function for the deprecated `middleware.ts` (`export { clikgateMiddleware as middleware }`).
75
+ */
76
+ exports.clikgateMiddleware = exports.clikgateProxy;
77
+ /**
78
+ * Read the kept click ID from a cookie store, e.g. `getClickId(await cookies())` in a route handler or
79
+ * server action, or `getClickId(request.cookies)`.
80
+ *
81
+ * @example
82
+ * import { cookies } from 'next/headers';
83
+ * const clickId = getClickId(await cookies());
84
+ */
85
+ function getClickId(store, clickIdParam) {
86
+ const helpers = helpersFor(clickIdParam);
87
+ const value = store.get(helpers.cookieName)?.value;
88
+ return helpers.isValid(value) ? value : null;
89
+ }
90
+ /**
91
+ * The `/cg/keep` route handler without a client, using the same click-ID parameter as the proxy
92
+ * (`clickIdParam`, else `process.env.CLIKGATE_CLICK_ID_PARAM`, else `cgid`). With a client, use
93
+ * `clikgate.clickIds.keepRoute()` instead.
94
+ *
95
+ * @example
96
+ * // app/cg/keep/route.ts
97
+ * import { keepRoute } from '@clikgate/node/next';
98
+ * export const POST = keepRoute({ days: 90 });
99
+ */
100
+ function keepRoute(options = {}) {
101
+ const { clickIdParam, ...rest } = options;
102
+ return helpersFor(clickIdParam).keepRoute(rest);
103
+ }
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,174 @@
1
+ import { Provider } from './enums.js';
2
+ import { type RequestOptions } from './http.js';
3
+ import { type MoneyInput } from './money.js';
4
+ /** Normalised payment statuses. */
5
+ export type PaymentStatus = 'success' | 'partial' | 'pending' | 'failed' | 'refunded' | 'reversed';
6
+ /** Parameters of `payments.confirm` (SPEC 22.2): the result of your own server's verification with the gateway. */
7
+ export interface PaymentConfirmParams {
8
+ /**
9
+ * The payment provider, e.g. `Provider.Paystack` (every gateway in `GET /v1/payment-gateways`). A provider key
10
+ * string works too, for a gateway added after this SDK release; the API checks it.
11
+ */
12
+ provider: Provider | (string & {});
13
+ /** The gateway's canonical payment reference, 1-128 characters. */
14
+ reference: string;
15
+ /** The gateway's verified status, normalised. */
16
+ status: PaymentStatus;
17
+ /** Amount in normal units (`'7500.00'` is ₦7,500). Prefer a decimal string. Not together with `amountMinor`. */
18
+ amount?: MoneyInput | null;
19
+ /** Amount in ISO 4217 minor units, instead of `amount`. */
20
+ amountMinor?: number | bigint | null;
21
+ /** ISO 4217 code (`NGN`, `usd`). */
22
+ currency?: string | null;
23
+ /** When the payment happened (default: now, on the server). */
24
+ occurredAt?: Date | string | null;
25
+ /** Up to 5 other references of the same payment (Stripe `cs_...`, Flutterwave transaction id). */
26
+ aliases?: string[] | null;
27
+ /** The click ID you stored in the gateway metadata (`cg_click_id`), used when no report arrives. */
28
+ clickId?: string | null;
29
+ /** A payment goal key (else the report's goal, else your default payment goal). */
30
+ goal?: string | null;
31
+ /** `true` for a gateway test payment; must match the API key's mode. */
32
+ test?: boolean | null;
33
+ /** Additional wire fields, merged last (forward compatibility). Refused in private mode. */
34
+ extra?: Record<string, unknown>;
35
+ }
36
+ /** Options of the gateway helpers. */
37
+ export interface PaymentHelperOptions {
38
+ /** A payment goal key. */
39
+ goal?: string | null;
40
+ /** A click ID you have yourself; wins over the `cg_click_id` in the gateway metadata. */
41
+ clickId?: string | null;
42
+ }
43
+ /** The wire body of `POST /v1/payments/confirmations`, as the builders return it. */
44
+ export interface PaymentConfirmationBody {
45
+ provider: Provider | (string & {});
46
+ reference: string;
47
+ status: PaymentStatus;
48
+ aliases?: string[];
49
+ amount?: string;
50
+ amount_minor?: number | bigint;
51
+ currency?: string;
52
+ occurred_at?: string;
53
+ test?: boolean;
54
+ click_id?: string;
55
+ goal?: string;
56
+ [key: string]: unknown;
57
+ }
58
+ /** The `payment_confirmation` object. */
59
+ export interface PaymentConfirmation {
60
+ object: 'payment_confirmation';
61
+ id: string;
62
+ /** A `Provider` value (or a newer gateway's key). */
63
+ provider: Provider | (string & {});
64
+ reference: string;
65
+ status: PaymentStatus;
66
+ amount: string | null;
67
+ amount_minor: number | null;
68
+ currency: string | null;
69
+ occurred_at: string;
70
+ route: string;
71
+ match_status: string;
72
+ report_id: string | null;
73
+ goal_event_id: string | null;
74
+ test: boolean;
75
+ duplicate: boolean | null;
76
+ [key: string]: unknown;
77
+ }
78
+ /**
79
+ * Build the confirmation body from a Paystack `GET /transaction/verify/{reference}` response (or its `data`),
80
+ * without sending it. Returns null when there is nothing to send. Reads only the reference, status, amount,
81
+ * currency, time, `domain` and `metadata.cg_click_id`.
82
+ *
83
+ * @example
84
+ * const body = buildFromPaystack(verifyResponse); // { provider: 'paystack', reference, status: 'success', amount: '7500', ... }
85
+ */
86
+ export declare function buildFromPaystack(response: unknown, options?: PaymentHelperOptions): PaymentConfirmationBody | null;
87
+ /**
88
+ * Build the confirmation body from a Flutterwave v3 verify response (`GET /v3/transactions/{id}/verify` or
89
+ * `verify_by_reference`, or its `data`), without sending it. Returns null when there is nothing to send.
90
+ *
91
+ * @example
92
+ * const body = buildFromFlutterwave(verifyResponse);
93
+ */
94
+ export declare function buildFromFlutterwave(response: unknown, options?: PaymentHelperOptions): PaymentConfirmationBody | null;
95
+ /**
96
+ * Build the confirmation body from a Monnify transaction status response (`GET /api/v2/transactions/{ref}` or
97
+ * the `query?paymentReference=` call, or its `responseBody`; a webhook's `eventData` works too), without sending it.
98
+ * Returns null when there is nothing to send.
99
+ *
100
+ * @example
101
+ * const body = buildFromMonnify(statusResponse);
102
+ */
103
+ export declare function buildFromMonnify(response: unknown, options?: PaymentHelperOptions): PaymentConfirmationBody | null;
104
+ /**
105
+ * Build the confirmation body from a Stripe PaymentIntent (`pi_...`) or Checkout Session (`cs_...`) object,
106
+ * without sending it. Returns null when there is nothing to send (for example a session with
107
+ * `payment_status: 'no_payment_required'`).
108
+ *
109
+ * @example
110
+ * const body = buildFromStripe(paymentIntent);
111
+ */
112
+ export declare function buildFromStripe(object: unknown, options?: PaymentHelperOptions): PaymentConfirmationBody | null;
113
+ /**
114
+ * Payments confirmed by your server. Call these **right after your own server has verified the payment with the
115
+ * gateway**, never with data from the browser or the app. Clikgate matches the confirmation with the Payment goal
116
+ * your website or app reported (`clikgate.goal('order_paid', { provider, reference })`) and counts it with the
117
+ * confirmed amount. Never pass a gateway key: these methods only talk to Clikgate.
118
+ */
119
+ export declare class Payments {
120
+ private readonly core;
121
+ /**
122
+ * Confirm a payment your server has verified (`POST /v1/payments/confirmations`). Also for refunds
123
+ * (`status: 'refunded'`, `amount` = the refunded amount).
124
+ *
125
+ * @example
126
+ * // after your own verification with the gateway:
127
+ * await clikgate.payments.confirm({ provider: Provider.Paystack, reference: 'T_ref_001', status: 'success', amount: '7500.00', currency: 'NGN' });
128
+ */
129
+ confirm(params: PaymentConfirmParams, requestOptions?: RequestOptions): Promise<PaymentConfirmation>;
130
+ private send;
131
+ /**
132
+ * Send a Paystack verify response, right after your own `GET /transaction/verify/{reference}` call.
133
+ * Only the reference, status, amount (÷ 100), currency, time, test flag and `metadata.cg_click_id` are sent.
134
+ * Returns null when there is nothing to send.
135
+ *
136
+ * @example
137
+ * const verify = await paystack.get(`/transaction/verify/${reference}`); // your own call, with your key
138
+ * await clikgate.payments.fromPaystack(verify, { goal: 'order_paid' });
139
+ */
140
+ fromPaystack(response: unknown, options?: PaymentHelperOptions, requestOptions?: RequestOptions): Promise<PaymentConfirmation | null>;
141
+ /**
142
+ * Send a Flutterwave verify response, right after your own `GET /v3/transactions/{id}/verify` call.
143
+ *
144
+ * @example
145
+ * const verify = await flutterwave.get(`/v3/transactions/${id}/verify`);
146
+ * await clikgate.payments.fromFlutterwave(verify);
147
+ */
148
+ fromFlutterwave(response: unknown, options?: PaymentHelperOptions, requestOptions?: RequestOptions): Promise<PaymentConfirmation | null>;
149
+ /**
150
+ * Send a Monnify transaction status response, right after your own `GET /api/v2/transactions/{ref}` call.
151
+ *
152
+ * @example
153
+ * const status = await monnify.get(`/api/v2/transactions/${encodeURIComponent(transactionReference)}`);
154
+ * await clikgate.payments.fromMonnify(status);
155
+ */
156
+ fromMonnify(response: unknown, options?: PaymentHelperOptions, requestOptions?: RequestOptions): Promise<PaymentConfirmation | null>;
157
+ /**
158
+ * Send a Stripe PaymentIntent or Checkout Session you have retrieved or received in a webhook you verified.
159
+ * A session with `no_payment_required` sends nothing and returns null.
160
+ *
161
+ * @example
162
+ * const intent = await stripe.paymentIntents.retrieve(id);
163
+ * await clikgate.payments.fromStripe(intent);
164
+ */
165
+ fromStripe(object: unknown, options?: PaymentHelperOptions, requestOptions?: RequestOptions): Promise<PaymentConfirmation | null>;
166
+ /** {@inheritDoc buildFromPaystack} */
167
+ buildFromPaystack(response: unknown, options?: PaymentHelperOptions): PaymentConfirmationBody | null;
168
+ /** {@inheritDoc buildFromFlutterwave} */
169
+ buildFromFlutterwave(response: unknown, options?: PaymentHelperOptions): PaymentConfirmationBody | null;
170
+ /** {@inheritDoc buildFromMonnify} */
171
+ buildFromMonnify(response: unknown, options?: PaymentHelperOptions): PaymentConfirmationBody | null;
172
+ /** {@inheritDoc buildFromStripe} */
173
+ buildFromStripe(object: unknown, options?: PaymentHelperOptions): PaymentConfirmationBody | null;
174
+ }