Payer

Payment commitment for Smart Workflow execution. Payer is a Smart Action.

Payer executes as a Smart Action, producing cryptographic attestations of payment commitment. Payer and authority can be different accounts.

Examples

w3-io/actions/payer/account

v1

Simple single-account payment. Payer signs commitment, validator verifies signature and balance. Most common pattern for personal workflows.

Action Definition

action.yml (w3-io/actions repo)
name: Single Account Payer
description: Basic payment verification

inputs:
  pubkey:
    description: Payer public key
    required: true

outputs:
  committed:
    description: Payment commitment result

runs:
  using: cloud  # No secrets!
  main: index.js

Payer Configuration

Payer Section
payer:
  uses: w3-io/actions/payer/account@v1
  with:
    pubkey: "0x6d9a2c5e8f1b4d7a0c3e6b9d2f5a8c1e4b7d0a3c6e9f2b5d8a1c4e7f0b3d6a9"

Execution

Payment Logic
// Verify payer signature
const signer = recover_signer(
  payment_commitment,
  payer_signature
);

if (signer !== inputs.pubkey) {
  return {
    committed: false,
    reason: "Invalid signature"
  };
}

// Check balance (simplified - real impl queries chain)
const balance = await get_account_balance(signer);
const estimated_cost = estimate_workflow_cost(workflow);

if (balance < estimated_cost) {
  return {
    committed: false,
    reason: "Insufficient balance",
    balance: balance,
    required: estimated_cost
  };
}

return {
  committed: true,
  payer: signer,
  estimated_cost: estimated_cost
};
Payment Commitment
{
  "committed": true,
  "payer": "0x6d9a2c5e8f1b4d7a0c3e6b9d2f5a8c1e4b7d0a3c6e9f2b5d8a1c4e7f0b3d6a9",
  "estimated_cost": "0.05 ETH"
}

Verification

Verify Payment
// Verify payment commitment
fn verify(attestation: Attestation) -> bool {
    let recovered = ecrecover(
        attestation.payment_hash,
        attestation.signature
    );

    recovered == attestation.payer_pubkey
        && has_sufficient_balance(attestation.payer_pubkey)
}