@zkp2p/pay-shared 0.0.2 → 2.0.0
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.
- package/LICENSE +6 -0
- package/README.md +30 -26
- package/dist/bitcoin.d.ts +1 -0
- package/dist/bitcoin.js +13 -0
- package/dist/buyerTee.d.ts +4 -0
- package/dist/buyerTee.js +3 -0
- package/dist/chains.d.ts +18 -4
- package/dist/chains.js +65 -3
- package/dist/crypto.d.ts +65 -0
- package/dist/crypto.js +291 -0
- package/dist/fees.d.ts +27 -0
- package/dist/fees.js +195 -0
- package/dist/fiatAmount.d.ts +19 -0
- package/dist/fiatAmount.js +58 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -0
- package/dist/paypalSarPhase.d.ts +5 -0
- package/dist/paypalSarPhase.js +8 -0
- package/dist/paypalSarVerify.d.ts +41 -0
- package/dist/paypalSarVerify.js +31 -0
- package/dist/rails.d.ts +137 -0
- package/dist/rails.js +320 -0
- package/dist/types.d.ts +427 -39
- package/dist/types.js +78 -13
- package/package.json +31 -5
- package/dist/chains.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/src/chains.ts +0 -417
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -1
- package/src/index.ts +0 -2
- package/src/types.d.ts +0 -132
- package/src/types.d.ts.map +0 -1
- package/src/types.js +0 -29
- package/src/types.ts +0 -464
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { PayCryptoTokenSymbol } from './crypto.js';
|
|
2
|
+
import type { ProofMode } from './buyerTee.js';
|
|
1
3
|
export declare const PaymentPlatform: {
|
|
2
4
|
readonly VENMO: "venmo";
|
|
3
5
|
readonly CASHAPP: "cashapp";
|
|
@@ -7,8 +9,14 @@ export declare const PaymentPlatform: {
|
|
|
7
9
|
readonly PAYPAL: "paypal";
|
|
8
10
|
readonly MONZO: "monzo";
|
|
9
11
|
readonly N26: "n26";
|
|
12
|
+
readonly CHIME: "chime";
|
|
10
13
|
};
|
|
11
14
|
export type PaymentPlatformType = typeof PaymentPlatform[keyof typeof PaymentPlatform];
|
|
15
|
+
/**
|
|
16
|
+
* Type guard for PaymentPlatform values.
|
|
17
|
+
* Returns true if `value` is one of the known PaymentPlatform enum values.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isPaymentPlatform(value: unknown): value is PaymentPlatformType;
|
|
12
20
|
export declare const SupportedChains: Record<number, string>;
|
|
13
21
|
export type SupportedChainId = keyof typeof SupportedChains;
|
|
14
22
|
export declare const CheckoutMode: {
|
|
@@ -39,14 +47,302 @@ export declare const SessionStatus: {
|
|
|
39
47
|
readonly CREATED: "CREATED";
|
|
40
48
|
readonly ACTIVE: "ACTIVE";
|
|
41
49
|
readonly COMPLETED: "COMPLETED";
|
|
50
|
+
readonly FAILED: "FAILED";
|
|
51
|
+
readonly REFUNDED: "REFUNDED";
|
|
42
52
|
readonly EXPIRED: "EXPIRED";
|
|
43
53
|
readonly CANCELLED: "CANCELLED";
|
|
44
54
|
};
|
|
45
55
|
export type SessionStatusType = typeof SessionStatus[keyof typeof SessionStatus];
|
|
56
|
+
export declare const CheckoutMethod: {
|
|
57
|
+
readonly FIAT: "fiat";
|
|
58
|
+
readonly CRYPTO: "crypto";
|
|
59
|
+
};
|
|
60
|
+
export type CheckoutMethodType = typeof CheckoutMethod[keyof typeof CheckoutMethod];
|
|
61
|
+
export declare const FeePayer: {
|
|
62
|
+
readonly MERCHANT: "MERCHANT";
|
|
63
|
+
readonly PAYEE: "PAYEE";
|
|
64
|
+
};
|
|
65
|
+
export type FeePayerType = typeof FeePayer[keyof typeof FeePayer];
|
|
66
|
+
export declare const MerchantPaymentFlowMode: {
|
|
67
|
+
readonly EXCLUSIVE_SAR: "EXCLUSIVE_SAR";
|
|
68
|
+
readonly PREFER_SAR: "PREFER_SAR";
|
|
69
|
+
readonly PREFER_BUYER_TEE: "PREFER_BUYER_TEE";
|
|
70
|
+
readonly EXCLUSIVE_BUYER_TEE: "EXCLUSIVE_BUYER_TEE";
|
|
71
|
+
};
|
|
72
|
+
export type MerchantPaymentFlowModeType = typeof MerchantPaymentFlowMode[keyof typeof MerchantPaymentFlowMode];
|
|
73
|
+
export declare const CheckoutOrderStatus: {
|
|
74
|
+
readonly CREATED: "CREATED";
|
|
75
|
+
readonly PARTIALLY_FULFILLED: "PARTIALLY_FULFILLED";
|
|
76
|
+
readonly FULFILLED: "FULFILLED";
|
|
77
|
+
readonly CANCELLED: "CANCELLED";
|
|
78
|
+
};
|
|
79
|
+
export type CheckoutOrderStatusType = typeof CheckoutOrderStatus[keyof typeof CheckoutOrderStatus];
|
|
80
|
+
export declare const CheckoutOrderRefundStatus: {
|
|
81
|
+
readonly NONE: "NONE";
|
|
82
|
+
readonly PENDING: "PENDING";
|
|
83
|
+
readonly COMPLETED: "COMPLETED";
|
|
84
|
+
};
|
|
85
|
+
export type CheckoutOrderRefundStatusType = typeof CheckoutOrderRefundStatus[keyof typeof CheckoutOrderRefundStatus];
|
|
86
|
+
export declare const CheckoutPaymentStatus: {
|
|
87
|
+
readonly CREATED: "CREATED";
|
|
88
|
+
readonly SETTLED: "SETTLED";
|
|
89
|
+
readonly CANCELLED: "CANCELLED";
|
|
90
|
+
readonly EXPIRED: "EXPIRED";
|
|
91
|
+
readonly FAILED: "FAILED";
|
|
92
|
+
};
|
|
93
|
+
export type CheckoutPaymentStatusType = typeof CheckoutPaymentStatus[keyof typeof CheckoutPaymentStatus];
|
|
94
|
+
export declare const CheckoutPaymentMemoPolicy: {
|
|
95
|
+
readonly NONE: "NONE";
|
|
96
|
+
readonly REQUIRED: "REQUIRED";
|
|
97
|
+
readonly EMPTY: "EMPTY";
|
|
98
|
+
};
|
|
99
|
+
export type CheckoutPaymentMemoPolicyType = typeof CheckoutPaymentMemoPolicy[keyof typeof CheckoutPaymentMemoPolicy];
|
|
100
|
+
export type ReferralFeeEntry = {
|
|
101
|
+
recipient: string;
|
|
102
|
+
feeBps: number;
|
|
103
|
+
};
|
|
104
|
+
export type ReferralSplitConfig = ReferralFeeEntry[];
|
|
105
|
+
export type SettlementReferralFeeEntry = {
|
|
106
|
+
recipient: string;
|
|
107
|
+
feeUsdc: string;
|
|
108
|
+
};
|
|
109
|
+
type CreateOrderRequestBase = {
|
|
110
|
+
destinationAddress?: string;
|
|
111
|
+
destinationToken?: string;
|
|
112
|
+
destinationChainId?: number;
|
|
113
|
+
feePayer?: FeePayerType;
|
|
114
|
+
enabledRails?: string[];
|
|
115
|
+
successUrl?: string | null;
|
|
116
|
+
cancelUrl?: string | null;
|
|
117
|
+
notes?: Record<string, unknown> | null;
|
|
118
|
+
};
|
|
119
|
+
type CreateOrderRequestWithUsdc = CreateOrderRequestBase & {
|
|
120
|
+
requestedUsdcAmount: string;
|
|
121
|
+
requestedFiatAmount?: never;
|
|
122
|
+
requestedFiatCurrency?: never;
|
|
123
|
+
};
|
|
124
|
+
type CreateOrderRequestWithFiat = CreateOrderRequestBase & {
|
|
125
|
+
requestedUsdcAmount?: never;
|
|
126
|
+
requestedFiatAmount: string;
|
|
127
|
+
requestedFiatCurrency: string;
|
|
128
|
+
};
|
|
129
|
+
export type CreateOrderRequest = CreateOrderRequestWithUsdc | CreateOrderRequestWithFiat;
|
|
130
|
+
export type CheckoutRequest = CreateOrderRequest;
|
|
131
|
+
export type MerchantCheckoutTheme = {
|
|
132
|
+
presetName?: 'default' | 'dark' | 'light' | 'custom';
|
|
133
|
+
pageBackgroundColor?: string | null;
|
|
134
|
+
panelBackgroundColor?: string | null;
|
|
135
|
+
panelTextColor?: string | null;
|
|
136
|
+
panelTextMutedColor?: string | null;
|
|
137
|
+
panelAccentColor?: string | null;
|
|
138
|
+
panelBorderColor?: string | null;
|
|
139
|
+
buttonBackgroundColor?: string | null;
|
|
140
|
+
buttonTextColor?: string | null;
|
|
141
|
+
defaultMaxFeePercentage?: number;
|
|
142
|
+
payWithCryptoEnabled?: boolean;
|
|
143
|
+
[key: string]: unknown;
|
|
144
|
+
};
|
|
145
|
+
export type CheckoutMerchant = {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
logoUrl: string | null;
|
|
149
|
+
environment: MerchantEnvironmentType;
|
|
150
|
+
disableBranding: boolean;
|
|
151
|
+
checkoutTheme: MerchantCheckoutTheme | null;
|
|
152
|
+
defaultPaymentCurrency?: string | null;
|
|
153
|
+
/** Whether the merchant has been verified by ZKP2P. */
|
|
154
|
+
verified: boolean;
|
|
155
|
+
};
|
|
156
|
+
export type CheckoutOrder = {
|
|
157
|
+
id: string;
|
|
158
|
+
merchantId: string;
|
|
159
|
+
status: CheckoutOrderStatusType;
|
|
160
|
+
refundStatus: CheckoutOrderRefundStatusType;
|
|
161
|
+
refundAmountUsdc: string | null;
|
|
162
|
+
refundDepositId: string | null;
|
|
163
|
+
refundTransactionHash: string | null;
|
|
164
|
+
refundMetadata: unknown | null;
|
|
165
|
+
inPersonCheckout: boolean;
|
|
166
|
+
requestedUsdcAmount: string;
|
|
167
|
+
remainingUsdcAmount: string;
|
|
168
|
+
destinationAddress: string;
|
|
169
|
+
destinationToken: string;
|
|
170
|
+
destinationChainId: string;
|
|
171
|
+
feePayer: FeePayerType;
|
|
172
|
+
enabledRails: string[];
|
|
173
|
+
successUrl: string | null;
|
|
174
|
+
cancelUrl: string | null;
|
|
175
|
+
notes: unknown | null;
|
|
176
|
+
metadata: unknown | null;
|
|
177
|
+
bridgeInfo?: OrderBridgeInfo | null;
|
|
178
|
+
referralSplitConfig: ReferralSplitConfig | null;
|
|
179
|
+
cancelledAt: string | null;
|
|
180
|
+
completedAt: string | null;
|
|
181
|
+
createdAt: string;
|
|
182
|
+
updatedAt: string | null;
|
|
183
|
+
};
|
|
184
|
+
export type CheckoutPaymentQuote = {
|
|
185
|
+
conversionRate?: string;
|
|
186
|
+
signalIntent: {
|
|
187
|
+
processorName: string;
|
|
188
|
+
depositId: string;
|
|
189
|
+
amount: string;
|
|
190
|
+
toAddress: string;
|
|
191
|
+
escrowAddress?: string;
|
|
192
|
+
fiatCurrencyCode?: string;
|
|
193
|
+
payeeDetails: string;
|
|
194
|
+
};
|
|
195
|
+
maker?: {
|
|
196
|
+
depositData: Record<string, string>;
|
|
197
|
+
};
|
|
198
|
+
intentHash?: string;
|
|
199
|
+
sellerAutomatedReleaseAvailable?: boolean;
|
|
200
|
+
};
|
|
201
|
+
export type CheckoutQuote = {
|
|
202
|
+
displayAmount: string;
|
|
203
|
+
spreadPercentage: number;
|
|
204
|
+
};
|
|
205
|
+
export type CheckoutQuoteEntry = {
|
|
206
|
+
platform: string;
|
|
207
|
+
displayAmount: string;
|
|
208
|
+
spreadPercentage: number;
|
|
209
|
+
sellerAutomatedReleaseAvailable?: boolean;
|
|
210
|
+
};
|
|
211
|
+
export type CheckoutQuotes = {
|
|
212
|
+
orderId: string;
|
|
213
|
+
fiatCurrency: string;
|
|
214
|
+
platforms: CheckoutQuoteEntry[];
|
|
215
|
+
};
|
|
216
|
+
export type CheckoutPayment = {
|
|
217
|
+
id: string;
|
|
218
|
+
orderId: string;
|
|
219
|
+
status: CheckoutPaymentStatusType;
|
|
220
|
+
rail: string;
|
|
221
|
+
paymentMethodId: string | null;
|
|
222
|
+
proofMode: ProofMode;
|
|
223
|
+
attestation: {
|
|
224
|
+
serviceUrl: string;
|
|
225
|
+
};
|
|
226
|
+
currency: string;
|
|
227
|
+
payTo: string;
|
|
228
|
+
/** Recipient rating in the 1.0–5.0 range, rounded to one decimal. */
|
|
229
|
+
recipientRating: number;
|
|
230
|
+
quote: CheckoutPaymentQuote;
|
|
231
|
+
quoteExpiresAt: string;
|
|
232
|
+
memoPolicy: CheckoutPaymentMemoPolicyType;
|
|
233
|
+
suggestedMemo: string | null;
|
|
234
|
+
paymentAmount: string;
|
|
235
|
+
currencyPerUsdRate: string;
|
|
236
|
+
netSettledUsdcAmount: string | null;
|
|
237
|
+
totalUsdcFeeAmount: string;
|
|
238
|
+
referralFees: SettlementReferralFeeEntry[] | null;
|
|
239
|
+
railIdentifier: string | null;
|
|
240
|
+
fulfillTransaction: string | null;
|
|
241
|
+
errorCode?: string | null;
|
|
242
|
+
errorMessage?: string | null;
|
|
243
|
+
completedAt: string | null;
|
|
244
|
+
createdAt: string;
|
|
245
|
+
updatedAt: string | null;
|
|
246
|
+
};
|
|
247
|
+
export type CheckoutAggregatePayment = Omit<CheckoutPayment, 'paymentMethodId'> & {
|
|
248
|
+
paymentMethodId?: string | null;
|
|
249
|
+
};
|
|
250
|
+
export type CheckoutAggregate = {
|
|
251
|
+
order: CheckoutOrder;
|
|
252
|
+
merchant: CheckoutMerchant;
|
|
253
|
+
currentPayment: CheckoutAggregatePayment | null;
|
|
254
|
+
};
|
|
255
|
+
export type CreateOrderResponse = {
|
|
256
|
+
order: CheckoutOrder;
|
|
257
|
+
orderToken: string;
|
|
258
|
+
};
|
|
259
|
+
export type CreateCheckoutResponse = CreateOrderResponse;
|
|
260
|
+
export type CheckoutCreateResponse = CreateOrderResponse;
|
|
261
|
+
export type CreatePaymentRequest = {
|
|
262
|
+
rail: string;
|
|
263
|
+
paymentMethodId?: string;
|
|
264
|
+
fiatCurrency?: string;
|
|
265
|
+
currency?: string;
|
|
266
|
+
replacementPaymentId?: string;
|
|
267
|
+
quoteLimit?: number;
|
|
268
|
+
excludedPayToValues?: string[];
|
|
269
|
+
};
|
|
270
|
+
export type CheckoutPaymentCreationResponse = CheckoutPayment & {
|
|
271
|
+
relayerTransactionId?: string;
|
|
272
|
+
};
|
|
273
|
+
export type PaymentDeeplinkResponse = {
|
|
274
|
+
paymentId: string;
|
|
275
|
+
orderId: string;
|
|
276
|
+
intentHash: string;
|
|
277
|
+
url: string;
|
|
278
|
+
proofSubmissionUrl: string;
|
|
279
|
+
checkoutReturnUrl: string;
|
|
280
|
+
linkKind?: 'app_clip' | 'deeplink';
|
|
281
|
+
};
|
|
282
|
+
export type CheckoutDeeplinkResponse = PaymentDeeplinkResponse;
|
|
283
|
+
export type MerchantConfig = {
|
|
284
|
+
id: string;
|
|
285
|
+
merchantId: string;
|
|
286
|
+
feePayer: FeePayerType;
|
|
287
|
+
enabledRails: string[];
|
|
288
|
+
defaultPaymentCurrency: string | null;
|
|
289
|
+
destinationChainId: string;
|
|
290
|
+
destinationToken: string;
|
|
291
|
+
sweepEnabled: boolean;
|
|
292
|
+
recipientOverrideEnabled: boolean;
|
|
293
|
+
disableBranding: boolean;
|
|
294
|
+
merchantCheckoutTheme: MerchantCheckoutTheme;
|
|
295
|
+
platformReferralFeeConfig: ReferralFeeConfig | null;
|
|
296
|
+
referralSplitConfig: ReferralSplitConfig | null;
|
|
297
|
+
createdAt: string;
|
|
298
|
+
updatedAt: string | null;
|
|
299
|
+
};
|
|
300
|
+
export declare const DashboardPrivyApp: {
|
|
301
|
+
readonly LEGACY: "LEGACY";
|
|
302
|
+
readonly V1: "V1";
|
|
303
|
+
};
|
|
304
|
+
export type DashboardPrivyAppType = typeof DashboardPrivyApp[keyof typeof DashboardPrivyApp];
|
|
305
|
+
export declare const MerchantMigrationStatus: {
|
|
306
|
+
readonly PENDING: "PENDING";
|
|
307
|
+
readonly MIGRATING: "MIGRATING";
|
|
308
|
+
readonly COMPLETE: "COMPLETE";
|
|
309
|
+
readonly FAILED: "FAILED";
|
|
310
|
+
};
|
|
311
|
+
export type MerchantMigrationStatusType = typeof MerchantMigrationStatus[keyof typeof MerchantMigrationStatus];
|
|
312
|
+
export type MerchantUser = {
|
|
313
|
+
id: string;
|
|
314
|
+
email: string | null;
|
|
315
|
+
privyUserId: string | null;
|
|
316
|
+
v1PrivyUserId: string | null;
|
|
317
|
+
role: 'OWNER' | 'MANAGER' | 'CASHIER';
|
|
318
|
+
merchantId: string | null;
|
|
319
|
+
createdAt: string;
|
|
320
|
+
updatedAt: string | null;
|
|
321
|
+
};
|
|
322
|
+
export type MerchantProfile = {
|
|
323
|
+
id: string;
|
|
324
|
+
name: string;
|
|
325
|
+
logoUrl: string | null;
|
|
326
|
+
industryType: string | null;
|
|
327
|
+
industryOtherText: string | null;
|
|
328
|
+
apiKey: string;
|
|
329
|
+
environment: MerchantEnvironmentType;
|
|
330
|
+
sandboxMerchantId: string | null;
|
|
331
|
+
inPersonCheckoutEnabled: boolean;
|
|
332
|
+
migrationStatus: MerchantMigrationStatusType;
|
|
333
|
+
evmWalletAddress: string | null;
|
|
334
|
+
solanaWalletAddress: string | null;
|
|
335
|
+
v1EvmWalletAddress: string | null;
|
|
336
|
+
v1SolanaWalletAddress: string | null;
|
|
337
|
+
tier: 'FREE' | 'PRO';
|
|
338
|
+
createdAt: string;
|
|
339
|
+
updatedAt: string | null;
|
|
340
|
+
merchantConfig: MerchantConfig | null;
|
|
341
|
+
merchantUsers: MerchantUser[];
|
|
342
|
+
};
|
|
46
343
|
export declare const OrderErrorCode: {
|
|
47
344
|
readonly PROOF_INVALID: "PROOF_INVALID";
|
|
48
345
|
readonly PROOF_EXPIRED: "PROOF_EXPIRED";
|
|
49
|
-
readonly PROOF_AMOUNT_MISMATCH: "PROOF_AMOUNT_MISMATCH";
|
|
50
346
|
readonly PROOF_RECIPIENT_MISMATCH: "PROOF_RECIPIENT_MISMATCH";
|
|
51
347
|
readonly FULFILL_TIMEOUT: "FULFILL_TIMEOUT";
|
|
52
348
|
readonly FULFILL_REVERTED: "FULFILL_REVERTED";
|
|
@@ -55,7 +351,6 @@ export declare const OrderErrorCode: {
|
|
|
55
351
|
readonly RPC_ERROR: "RPC_ERROR";
|
|
56
352
|
readonly RELAYER_ERROR: "RELAYER_ERROR";
|
|
57
353
|
readonly ATTESTATION_ERROR: "ATTESTATION_ERROR";
|
|
58
|
-
readonly BRIDGE_QUOTE_ERROR: "BRIDGE_QUOTE_ERROR";
|
|
59
354
|
readonly BRIDGE_TIMEOUT: "BRIDGE_TIMEOUT";
|
|
60
355
|
readonly FEE_THRESHOLD_EXCEEDED: "FEE_THRESHOLD_EXCEEDED";
|
|
61
356
|
readonly SDK_ERROR: "SDK_ERROR";
|
|
@@ -67,21 +362,60 @@ export declare const MerchantEnvironment: {
|
|
|
67
362
|
readonly SANDBOX: "SANDBOX";
|
|
68
363
|
};
|
|
69
364
|
export type MerchantEnvironmentType = typeof MerchantEnvironment[keyof typeof MerchantEnvironment];
|
|
365
|
+
export declare const TrancheCurrency: {
|
|
366
|
+
readonly USD: "USD";
|
|
367
|
+
readonly USDC: "USDC";
|
|
368
|
+
};
|
|
369
|
+
export type TrancheCurrencyType = typeof TrancheCurrency[keyof typeof TrancheCurrency];
|
|
370
|
+
export type FeeTranche = {
|
|
371
|
+
min: number;
|
|
372
|
+
max: number | null;
|
|
373
|
+
value: number;
|
|
374
|
+
};
|
|
375
|
+
export type ReferralFeeConfig = {
|
|
376
|
+
mode: 'default';
|
|
377
|
+
} | {
|
|
378
|
+
mode: 'exempt';
|
|
379
|
+
} | {
|
|
380
|
+
mode: 'flat';
|
|
381
|
+
currency: 'USDC';
|
|
382
|
+
valueBps: number;
|
|
383
|
+
} | {
|
|
384
|
+
mode: 'tranches';
|
|
385
|
+
currency: 'USDC';
|
|
386
|
+
tranches: FeeTranche[];
|
|
387
|
+
};
|
|
388
|
+
export type MaxFeeConfig = {
|
|
389
|
+
mode: 'flat';
|
|
390
|
+
currency: 'USD';
|
|
391
|
+
valuePercentage: number;
|
|
392
|
+
} | {
|
|
393
|
+
mode: 'tranches';
|
|
394
|
+
currency: 'USD';
|
|
395
|
+
tranches: FeeTranche[];
|
|
396
|
+
};
|
|
70
397
|
export type Merchant = {
|
|
71
398
|
id: string;
|
|
72
399
|
name: string;
|
|
73
400
|
logoUrl?: string | null;
|
|
401
|
+
industryType?: string | null;
|
|
402
|
+
industryOtherText?: string | null;
|
|
74
403
|
disableBranding?: boolean;
|
|
75
404
|
apiKey: string;
|
|
76
405
|
environment?: MerchantEnvironmentType;
|
|
77
406
|
sandboxMerchantId?: string | null;
|
|
407
|
+
privyWalletAddress?: string | null;
|
|
408
|
+
privySolanaAddress?: string | null;
|
|
78
409
|
createdAt: string;
|
|
79
410
|
updatedAt: string;
|
|
80
411
|
defaultChainId?: number | null;
|
|
81
|
-
|
|
82
|
-
defaultFiatCurrency?: string | null;
|
|
412
|
+
defaultDestinationToken?: 'USDC' | 'USDT' | null;
|
|
83
413
|
defaultMaxFeePercentage?: number | null;
|
|
414
|
+
defaultMaxFeeConfig?: MaxFeeConfig | null;
|
|
415
|
+
referralFeeConfig?: ReferralFeeConfig | null;
|
|
84
416
|
enabledPaymentPlatforms?: PaymentPlatformType[] | null;
|
|
417
|
+
payWithCryptoEnabled: boolean;
|
|
418
|
+
relayPayoutsEnabled: boolean;
|
|
85
419
|
};
|
|
86
420
|
export type CreateMerchantRequest = {
|
|
87
421
|
name: string;
|
|
@@ -96,8 +430,15 @@ export type CheckoutSession = {
|
|
|
96
430
|
destinationToken: string;
|
|
97
431
|
recipientAddress: string;
|
|
98
432
|
status: SessionStatusType;
|
|
433
|
+
selectedCheckoutMethod?: CheckoutMethodType | null;
|
|
99
434
|
selectedPaymentPlatform?: PaymentPlatformType | null;
|
|
100
435
|
selectedFiatCurrency?: string | null;
|
|
436
|
+
paymentSentAt?: string | null;
|
|
437
|
+
cryptoRequestId?: string | null;
|
|
438
|
+
cryptoDepositAddress?: string | null;
|
|
439
|
+
cryptoOriginChainId?: number | null;
|
|
440
|
+
cryptoOriginToken?: PayCryptoTokenSymbol | null;
|
|
441
|
+
cryptoOriginAmount?: string | null;
|
|
101
442
|
successUrl?: string | null;
|
|
102
443
|
cancelUrl?: string | null;
|
|
103
444
|
metadata?: Record<string, string> | null;
|
|
@@ -107,8 +448,12 @@ export type CheckoutSession = {
|
|
|
107
448
|
fiatAmount?: string | null;
|
|
108
449
|
fiatCurrency?: string | null;
|
|
109
450
|
maxFeePercentage?: number | null;
|
|
451
|
+
maxFeeConfigSnapshot?: MaxFeeConfig | null;
|
|
452
|
+
requestedNetAmountUsdc?: string | null;
|
|
110
453
|
requiresBridge?: boolean;
|
|
111
454
|
enabledPaymentPlatforms?: PaymentPlatformType[] | null;
|
|
455
|
+
payWithCryptoEnabled: boolean;
|
|
456
|
+
cryptoPayment?: CheckoutCryptoPayment | null;
|
|
112
457
|
createdAt: string;
|
|
113
458
|
updatedAt: string;
|
|
114
459
|
merchant?: {
|
|
@@ -125,6 +470,7 @@ export type QuoteIntent = {
|
|
|
125
470
|
processorName: string;
|
|
126
471
|
amount: string;
|
|
127
472
|
toAddress: string;
|
|
473
|
+
escrowAddress?: string;
|
|
128
474
|
payeeDetails: string;
|
|
129
475
|
processorIntentData: Record<string, unknown>;
|
|
130
476
|
fiatCurrencyCode: string;
|
|
@@ -152,6 +498,7 @@ export type Order = {
|
|
|
152
498
|
paymentPlatform?: PaymentPlatformType | null;
|
|
153
499
|
fiatCurrency?: string | null;
|
|
154
500
|
amountUsdc?: string | null;
|
|
501
|
+
grossAmountUsdc?: string | null;
|
|
155
502
|
netAmountUsdc?: string | null;
|
|
156
503
|
conversionRate?: string | null;
|
|
157
504
|
recipient?: string | null;
|
|
@@ -160,7 +507,7 @@ export type Order = {
|
|
|
160
507
|
bridgeCommitmentData?: string | null;
|
|
161
508
|
bridgeFulfillData?: string | null;
|
|
162
509
|
bridgeDepositTxHash?: string | null;
|
|
163
|
-
bridgeStatus?: 'pending' | '
|
|
510
|
+
bridgeStatus?: 'pending' | 'completed' | 'failed' | null;
|
|
164
511
|
bridgeFilledAt?: string | null;
|
|
165
512
|
bridgeFilledTxHash?: string | null;
|
|
166
513
|
bridgeInfo?: OrderBridgeInfo | null;
|
|
@@ -216,10 +563,6 @@ type CreateSessionExactFiatRequest = CreateSessionBaseRequest & {
|
|
|
216
563
|
maxFeePercentage?: number;
|
|
217
564
|
};
|
|
218
565
|
export type CreateSessionRequest = CreateSessionExactTokenRequest | CreateSessionExactFiatRequest;
|
|
219
|
-
/**
|
|
220
|
-
* Bridge information returned when session requires cross-chain bridging.
|
|
221
|
-
* Amounts are in raw units (6 decimals for USDC).
|
|
222
|
-
*/
|
|
223
566
|
export type BridgeInfo = {
|
|
224
567
|
required: boolean;
|
|
225
568
|
inputAmount?: string | null;
|
|
@@ -234,17 +577,53 @@ export type CreateSessionResponse = {
|
|
|
234
577
|
checkoutUrl: string;
|
|
235
578
|
bridge?: BridgeInfo;
|
|
236
579
|
};
|
|
580
|
+
export type SelectPlatformRequest = {
|
|
581
|
+
checkoutMethod: 'fiat';
|
|
582
|
+
paymentPlatform: PaymentPlatformType;
|
|
583
|
+
fiatCurrency: string;
|
|
584
|
+
} | {
|
|
585
|
+
checkoutMethod: 'crypto';
|
|
586
|
+
};
|
|
237
587
|
export type StartSessionRequest = {
|
|
588
|
+
checkoutMethod: 'fiat';
|
|
238
589
|
paymentPlatform?: PaymentPlatformType;
|
|
239
590
|
fiatCurrency?: string;
|
|
591
|
+
} | {
|
|
592
|
+
checkoutMethod: 'crypto';
|
|
593
|
+
originChainId: number;
|
|
594
|
+
originToken: PayCryptoTokenSymbol;
|
|
595
|
+
};
|
|
596
|
+
export type RelayCryptoPaymentStatus = 'refund' | 'delayed' | 'waiting' | 'failure' | 'pending' | 'success';
|
|
597
|
+
export type CheckoutCryptoPayment = {
|
|
598
|
+
requestId: string;
|
|
599
|
+
status: RelayCryptoPaymentStatus;
|
|
600
|
+
depositAddress: string;
|
|
601
|
+
originChainId: number;
|
|
602
|
+
originToken: PayCryptoTokenSymbol;
|
|
603
|
+
originAmount: string;
|
|
604
|
+
expectedDestinationAmount?: string | null;
|
|
605
|
+
actualDestinationAmount?: string | null;
|
|
606
|
+
sourceTxHash?: string | null;
|
|
607
|
+
destinationTxHash?: string | null;
|
|
608
|
+
errorMessage?: string | null;
|
|
609
|
+
completedAt?: string | null;
|
|
240
610
|
};
|
|
241
|
-
export type
|
|
611
|
+
export type StartFiatSessionResponse = {
|
|
612
|
+
resultType: 'fiat_order';
|
|
242
613
|
session: CheckoutSession;
|
|
243
614
|
order: Order;
|
|
244
615
|
quote: Quote;
|
|
245
|
-
intentHash: string;
|
|
616
|
+
intentHash: string | null;
|
|
246
617
|
expiresAt?: string | null;
|
|
618
|
+
status?: string | null;
|
|
619
|
+
relayerTransactionId?: string | null;
|
|
620
|
+
};
|
|
621
|
+
export type StartCryptoSessionResponse = {
|
|
622
|
+
resultType: 'crypto_quote';
|
|
623
|
+
session: CheckoutSession;
|
|
624
|
+
cryptoPayment: CheckoutCryptoPayment;
|
|
247
625
|
};
|
|
626
|
+
export type StartSessionResponse = StartFiatSessionResponse | StartCryptoSessionResponse;
|
|
248
627
|
export type MarkPaymentSentResponse = {
|
|
249
628
|
order: Order;
|
|
250
629
|
};
|
|
@@ -267,36 +646,43 @@ export type ProofAttemptsResponse = {
|
|
|
267
646
|
proofAttempts: ProofAttempt[];
|
|
268
647
|
};
|
|
269
648
|
export interface BridgeStatusResponse {
|
|
270
|
-
status: 'pending' | '
|
|
649
|
+
status: 'pending' | 'completed' | 'failed' | 'not_applicable';
|
|
271
650
|
destinationChainId?: string;
|
|
272
|
-
|
|
651
|
+
outputAmount?: string;
|
|
652
|
+
estimatedOutputAmount?: string;
|
|
653
|
+
minimumOutputAmount?: string;
|
|
273
654
|
fillTxHash?: string;
|
|
274
655
|
depositTxHash?: string;
|
|
275
|
-
acrossTrackingUrl?: string;
|
|
276
656
|
estimatedFillTime?: number;
|
|
657
|
+
fallbackToOrigin?: boolean;
|
|
658
|
+
failureMessage?: string;
|
|
277
659
|
}
|
|
278
|
-
/**
|
|
279
|
-
* Bridge information included in order responses.
|
|
280
|
-
* Tracks the status of cross-chain bridging via Across Protocol.
|
|
281
|
-
*/
|
|
282
660
|
export interface OrderBridgeInfo {
|
|
283
|
-
status: 'PENDING' | '
|
|
661
|
+
status: 'PENDING' | 'SUBMITTED' | 'COMPLETED' | 'FAILED';
|
|
284
662
|
destinationChainId: string;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
663
|
+
outputAmount?: string;
|
|
664
|
+
estimatedOutputAmount?: string;
|
|
665
|
+
minimumOutputAmount?: string;
|
|
288
666
|
fillTxHash?: string | null;
|
|
289
667
|
estimatedFillTime?: number | null;
|
|
668
|
+
fallbackToOrigin?: boolean;
|
|
669
|
+
failureMessage?: string | null;
|
|
290
670
|
}
|
|
291
671
|
export declare const WebhookEventType: {
|
|
292
|
-
readonly ORDER_CREATED: "
|
|
293
|
-
readonly
|
|
294
|
-
readonly
|
|
295
|
-
readonly
|
|
296
|
-
readonly
|
|
297
|
-
readonly
|
|
298
|
-
readonly
|
|
299
|
-
readonly
|
|
672
|
+
readonly ORDER_CREATED: "ORDER_CREATED";
|
|
673
|
+
readonly ORDER_FULFILLED: "ORDER_FULFILLED";
|
|
674
|
+
readonly ORDER_CANCELLED: "ORDER_CANCELLED";
|
|
675
|
+
readonly PAYMENT_CREATED: "PAYMENT_CREATED";
|
|
676
|
+
readonly PAYMENT_SETTLED: "PAYMENT_SETTLED";
|
|
677
|
+
readonly PAYMENT_CANCELLED: "PAYMENT_CANCELLED";
|
|
678
|
+
readonly PAYMENT_EXPIRED: "PAYMENT_EXPIRED";
|
|
679
|
+
readonly PAYMENT_FAILED: "PAYMENT_FAILED";
|
|
680
|
+
readonly REFUND_PENDING: "REFUND_PENDING";
|
|
681
|
+
readonly REFUND_COMPLETED: "REFUND_COMPLETED";
|
|
682
|
+
readonly PAYMENT_BRIDGE_PENDING: "PAYMENT_BRIDGE_PENDING";
|
|
683
|
+
readonly PAYMENT_BRIDGE_SUBMITTED: "PAYMENT_BRIDGE_SUBMITTED";
|
|
684
|
+
readonly PAYMENT_BRIDGE_COMPLETED: "PAYMENT_BRIDGE_COMPLETED";
|
|
685
|
+
readonly PAYMENT_BRIDGE_FAILED: "PAYMENT_BRIDGE_FAILED";
|
|
300
686
|
};
|
|
301
687
|
export type WebhookEventTypeValue = typeof WebhookEventType[keyof typeof WebhookEventType];
|
|
302
688
|
export declare const WebhookDeliveryStatus: {
|
|
@@ -305,12 +691,17 @@ export declare const WebhookDeliveryStatus: {
|
|
|
305
691
|
readonly FAILED: "FAILED";
|
|
306
692
|
};
|
|
307
693
|
export type WebhookDeliveryStatusType = typeof WebhookDeliveryStatus[keyof typeof WebhookDeliveryStatus];
|
|
694
|
+
export type WebhookHeader = {
|
|
695
|
+
key: string;
|
|
696
|
+
value: string;
|
|
697
|
+
};
|
|
308
698
|
export type Webhook = {
|
|
309
699
|
id: string;
|
|
310
700
|
merchantId: string;
|
|
311
701
|
url: string;
|
|
312
702
|
events: WebhookEventTypeValue[];
|
|
313
703
|
active: boolean;
|
|
704
|
+
customHeaders: WebhookHeader[];
|
|
314
705
|
createdAt: string;
|
|
315
706
|
updatedAt: string;
|
|
316
707
|
};
|
|
@@ -333,26 +724,24 @@ export type WebhookPayload = {
|
|
|
333
724
|
id: string;
|
|
334
725
|
type: WebhookEventTypeValue;
|
|
335
726
|
timestamp: string;
|
|
336
|
-
environment: MerchantEnvironmentType;
|
|
337
727
|
data: {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
code: string;
|
|
343
|
-
message: string;
|
|
344
|
-
} | null;
|
|
728
|
+
order: CheckoutOrder | null;
|
|
729
|
+
payment: CheckoutPayment | null;
|
|
730
|
+
refund: Record<string, unknown> | null;
|
|
731
|
+
paymentBridge: Record<string, unknown> | null;
|
|
345
732
|
};
|
|
346
733
|
};
|
|
347
734
|
export type CreateWebhookRequest = {
|
|
348
735
|
url: string;
|
|
349
736
|
events?: WebhookEventTypeValue[];
|
|
737
|
+
customHeaders?: WebhookHeader[];
|
|
350
738
|
};
|
|
351
739
|
export type CreateWebhookResponse = WebhookWithSecret;
|
|
352
740
|
export type UpdateWebhookRequest = {
|
|
353
741
|
url?: string;
|
|
354
742
|
events?: WebhookEventTypeValue[];
|
|
355
743
|
active?: boolean;
|
|
744
|
+
customHeaders?: WebhookHeader[];
|
|
356
745
|
};
|
|
357
746
|
export type ListWebhooksResponse = {
|
|
358
747
|
webhooks: Webhook[];
|
|
@@ -367,4 +756,3 @@ export type TestWebhookResponse = {
|
|
|
367
756
|
error?: string | null;
|
|
368
757
|
};
|
|
369
758
|
export {};
|
|
370
|
-
//# sourceMappingURL=types.d.ts.map
|