Skip to content

Commit d84c7c1

Browse files
committed
Update x402 default payment validity window
Allows for systems with retries to process at their own pace, and guards against slightly descynced block.timestamp
1 parent dcef3f4 commit d84c7c1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/thirdweb/src/x402/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export async function decodePaymentRequest(
107107
description: description ?? "",
108108
mimeType: mimeType ?? "application/json",
109109
payTo: getAddress(facilitator.address), // always pay to the facilitator address first
110-
maxTimeoutSeconds: maxTimeoutSeconds ?? 300,
110+
maxTimeoutSeconds: maxTimeoutSeconds ?? 86400,
111111
asset: getAddress(asset.address),
112112
outputSchema: {
113113
input: {

packages/thirdweb/src/x402/sign.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function preparePaymentHeader(
3232
nonce: Hex,
3333
): UnsignedPaymentPayload {
3434
const validAfter = BigInt(
35-
Math.floor(Date.now() / 1000) - 600, // 10 minutes before
35+
Math.floor(Date.now() / 1000) - 86400, // 24h before in case weird block timestamp behavior
3636
).toString();
3737
const validBefore = BigInt(
3838
Math.floor(Date.now() / 1000 + paymentRequirements.maxTimeoutSeconds),

0 commit comments

Comments
 (0)