Validates an EIP-712 TransferWithAuthorization signature against on-chain state. Call this before /settle to confirm the payment is executable.
Request Body
| Field | Type | Description |
|---|
paymentPayload | object | Signed payment data |
paymentPayload.token | string | Token contract address |
paymentPayload.payload | object | Authorization and signature |
paymentPayload.payload.authorization | object | EIP-712 authorization fields |
paymentPayload.payload.authorization.from | string | Payer wallet address |
paymentPayload.payload.authorization.to | string | Recipient wallet address |
paymentPayload.payload.authorization.value | string | Amount in wei (uint256) |
paymentPayload.payload.authorization.validAfter | number | Unix timestamp, signature valid after |
paymentPayload.payload.authorization.validBefore | number | Unix timestamp, signature valid before |
paymentPayload.payload.authorization.nonce | string | Random bytes32 nonce |
paymentPayload.payload.signature | string | EIP-712 signature |
paymentRequirements | object | Network and contract details |
paymentRequirements.network | string | Target network ("bsc" or "base") |
paymentRequirements.relayerContract | string | b402 Relayer contract address |
Response
Valid Payment (200)
| Field | Type | Description |
|---|
isValid | boolean | true if the payment can be settled |
payer | string | Recovered signer address |
Invalid Payment (200)
| Field | Type | Description |
|---|
isValid | boolean | false |
invalidReason | string | Why the payment failed verification |
Verification Checks
The facilitator runs these checks in order:
- Signature recovery - Recovers the signer from the EIP-712 signature and confirms it matches
authorization.from
- Nonce uniqueness - Checks the nonce has not been used or canceled on-chain
- Time window - Confirms
validAfter <= now <= validBefore
- Token whitelisting - Verifies the token is whitelisted on the Relayer contract
- Balance and allowance - Checks the payer has sufficient token balance and has approved the Relayer contract
A valid verification does not guarantee settlement will succeed. On-chain state can change between verify and settle calls. Always settle promptly after verification.
Examples
cURL
curl -X POST https://facilitatorv3.b402.ai/verify \
-H "Content-Type: application/json" \
-d '{
"paymentPayload": {
"token": "0x55d398326f99059fF775485246999027B3197955",
"payload": {
"authorization": {
"from": "0xAbC1234567890aBcDeF1234567890AbCdEf123456",
"to": "0x9876543210FeDcBa9876543210FeDcBa98765432",
"value": "10000000000000000",
"validAfter": 1709251200,
"validBefore": 1709254800,
"nonce": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
},
"signature": "0xabc123...eip712_signature"
}
},
"paymentRequirements": {
"network": "bsc",
"relayerContract": "0xE91b564EB8DFF305Ff8efA332f84c487b9da5171"
}
}'
TypeScript
const response = await fetch("https://facilitatorv3.b402.ai/verify", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
paymentPayload: {
token: "0x55d398326f99059fF775485246999027B3197955",
payload: {
authorization: {
from: wallet.address,
to: recipientAddress,
value: "10000000000000000",
validAfter: Math.floor(Date.now() / 1000),
validBefore: Math.floor(Date.now() / 1000) + 3600,
nonce: crypto.randomBytes(32).toString("hex"),
},
signature: eip712Signature,
},
},
paymentRequirements: {
network: "bsc", // or "base"
relayerContract: "0xE91b564EB8DFF305Ff8efA332f84c487b9da5171",
},
}),
});
const result = await response.json();
if (result.isValid) {
console.log("Payment verified. Payer:", result.payer);
// Proceed to /settle
} else {
console.error("Verification failed:", result.invalidReason);
}
Error Codes
| Code | HTTP Status | Description |
|---|
signature_error | 400 | EIP-712 signature is malformed or recovery failed |
nonce_error | 400 | Nonce has already been used or was canceled |
payment_verification_error | 400 | Balance insufficient, allowance too low, or token not whitelisted |
validation_error | 400 | Request body is missing required fields or has invalid types |