confirm_payment
Verify on-chain payments by submitting transaction hashes to update order status to paid. Confirm crypto transfers to seller wallets for order completion.
Instructions
Submit an on-chain payment transaction for verification. After paying the seller (send crypto to their wallet address), provide the transaction hash here to verify payment and update the order status to "paid".
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| orderId | Yes | The order ID to confirm payment for | |
| txHash | Yes | The on-chain transaction hash (0x...) | |
| chainId | No | Chain ID where payment was sent. Default: 8453 (Base) |
Implementation Reference
- src/index.ts:1141-1179 (handler)Handler implementation for the confirm_payment tool. It forwards the request to the centralized W3Ship API.
case 'confirm_payment': { const { orderId: payOrderId, txHash, chainId: payChainId } = args as any; try { const payRes = await fetch(`${W3SHIP_API}/api/order/pay`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ orderId: payOrderId, txHash, chainId: payChainId || 8453, }), }); const payData = await payRes.json() as any; if (!payRes.ok) { return { content: [{ type: 'text', text: `Payment verification failed: ${payData.error || 'Unknown error'}` }], isError: true, }; } return { content: [{ type: 'text', text: JSON.stringify({ verified: payData.verified, orderId: payOrderId, txHash, status: payData.order?.paymentStatus || 'paid', message: payData.verified ? `Payment verified! Order ${payOrderId} is confirmed. The seller will be notified to ship your item.` : `Payment could not be verified. Please check the transaction hash.`, }, null, 2) }] }; } catch (e: any) { return { content: [{ type: 'text', text: `Error verifying payment: ${e.message}` }], isError: true }; } }