transaction.succeeded

Sent when a transaction completes successfully. Payment is confirmed and it's safe to fulfill the order.

When it triggers

  • Blockchain transaction confirmed

  • Funds transferred successfully

  • Status changes to "Success"

Payload

{
  "id": "evt_1704067260000_def456",
  "type": "transaction.succeeded",
  "createdAt": "2025-01-25T10:01:00.000Z",
  "data": {
    "_id": "689324309eb9e6e8e0f842cd",
    "price": 0.015,
    "hash": "0xb6accc136297ad17ab831028f967cbf2bdd9ff67b8fab5d4e8e4f34f8681eb59",
    "status": "Success",
    "type": "Contract",
    "user": {
      "_id": "688c82d81c6a157748c5ca7b",
      "username": "john_doe"
    },
    "link": "6891c0896aad1cd3bf2f3490",
    "source": "7",
    "createdAt": "2025-01-25T10:00:00.000Z",
    "updatedAt": "2025-01-25T10:01:00.000Z",
    "payload": {
      "eventNonce": "0x9bd7d21d481bd64a3f046b6c9e930b5843a0c36f8832a1c8e8e2319c16da6f28",
      "attestation": "0x8730053fe55a898df9f81f4c45364ef1ad7541125e20656278ec9749d92ec7bb...",
      "cctpVersion": 2,
      "sender": "0x28b5a0e9c621a5badaa536219b3a228c8168cf5d",
      "recipient": "0x28b5a0e9c621a5badaa536219b3a228c8168cf5d",
      "mintRecipient": "0x4b6aee828992738f64b1e908f082aa9f2cc6936a",
      "messageSender": "0x4b6aee828992738f64b1e908f082aa9f2cc6936a",
      "amount": "15000",
      "maxFee": 2,
      "feeExecuted": 0,
      "sourceDomain": 7,
      "destinationDomain": 6,
      "status": "complete"
    }
  }
}

Fields

Field
Type
Description

_id

string

Transaction ID

price

number

Amount in USDC

hash

string

Blockchain transaction hash

status

string

Always "Success"

user._id

string

User ID

user.username

string

Username

link

string

Payment link ID

source

string

Source chain ID

createdAt

string

When transaction was created

updatedAt

string

When transaction succeeded

CCTP payload

Field
Type
Description

amount

string

Amount in micro-units (15000 = $0.015)

sender

string

Sender address

recipient

string

Recipient address

sourceDomain

number

Source chain domain

destinationDomain

number

Destination chain domain

status

string

Always "complete"

Note: amount in payload is in micro-units. Divide by 1,000,000 for USDC amount.

What to do

  • Fulfill the order - Deliver goods/services

  • Send confirmation to customer

  • Update order status to paid

  • Record revenue in your system

  • Grant access to purchased items

Example handler

async function handleTransactionSucceeded(transaction) {
  // Update order
  await db.orders.update(
    { transactionId: transaction._id },
    {
      status: 'paid',
      paidAt: new Date(),
      hash: transaction.hash
    }
  );
  // Send confirmation
  await sendEmail(transaction.user.username, {
    subject: 'Payment Confirmed!',
    body: `Your payment of $${transaction.price} was successful.`
  });

  console.log(`Transaction ${transaction._id} completed`);
}

Notes

These are just some general good to have checks.

Idempotency

You may receive the same event multiple times. Always check if already processed:

const processedEvents = new Set();

async function handleTransactionSucceeded(transaction) {
  const eventId = `${transaction._id}_succeeded`;

  if (processedEvents.has(eventId)) {
    console.log('Already processed');
    return;
  }

  // Process...

  processedEvents.add(eventId);
}

Verify amounts

Always verify the amount matches what you expected:

const order = await db.orders.findOne({ transactionId: transaction._id });

if (order.expectedAmount !== transaction.price) {
  await alertTeam({
    message: 'Amount mismatch!',
    expected: order.expectedAmount,
    received: transaction.price
  });
  return;
}

Last updated

Was this helpful?