Skip to content

Commit f5f6848

Browse files
[SDK] Add fundWalletLink prop to x402 responses (#8443)
1 parent 82ba2b2 commit f5f6848

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

.changeset/real-bugs-boil.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Add fundWalletLink prop to x402 responses

packages/thirdweb/src/x402/schemas.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ export type RequestedPaymentRequirements = z.infer<
4141
const FacilitatorSettleResponseSchema = SettleResponseSchema.extend({
4242
network: FacilitatorNetworkSchema,
4343
errorMessage: z.string().optional(),
44+
fundWalletLink: z.string().optional(),
4445
});
4546
export type FacilitatorSettleResponse = z.infer<
4647
typeof FacilitatorSettleResponseSchema
4748
>;
4849

4950
const FacilitatorVerifyResponseSchema = VerifyResponseSchema.extend({
5051
errorMessage: z.string().optional(),
52+
fundWalletLink: z.string().optional(),
5153
});
5254

5355
export type FacilitatorVerifyResponse = z.infer<

packages/thirdweb/src/x402/settle-payment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export async function settlePayment(
167167
error,
168168
errorMessage:
169169
errorMessages?.settlementFailed || settlement.errorMessage,
170+
fundWalletLink: settlement.fundWalletLink,
170171
accepts: paymentRequirements,
171172
},
172173
};

packages/thirdweb/src/x402/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ export type PaymentRequiredResult = {
5858
accepts: RequestedPaymentRequirements[];
5959
/** Optional payer address if verification partially succeeded */
6060
payer?: string;
61+
/** Optional link to a wallet to fund the wallet of the payer */
62+
fundWalletLink?: string;
6163
};
6264
/** Response headers for the error response */
6365
responseHeaders: Record<string, string>;

packages/thirdweb/src/x402/verify-payment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export async function verifyPayment(
112112
error: error,
113113
errorMessage:
114114
errorMessages?.verificationFailed || verification.errorMessage,
115+
fundWalletLink: verification.fundWalletLink,
115116
accepts: paymentRequirements,
116117
},
117118
};

0 commit comments

Comments
 (0)