transaction.created
Sent when a new transaction is created. At this point, the transaction is pending and being processed on the blockchain.
When it triggers
User initiates a payment
Transaction is created via API
Payment link is used
Payload
{
"id": "evt_1704067200000_abc123",
"type": "transaction.created",
"createdAt": "2025-01-25T10:00:00.000Z",
"data": {
"_id": "689324309eb9e6e8e0f842cd",
"price": 0.015,
"hash": "0xb6accc136297ad17ab831028f967cbf2bdd9ff67b8fab5d4e8e4f34f8681eb59",
"status": "Pending",
"type": "Contract",
"user": {
"_id": "688c82d81c6a157748c5ca7b",
"username": "john_doe"
},
"link": "6891c0896aad1cd3bf2f3490",
"source": "7",
"createdAt": "2025-01-25T10:00:00.000Z",
"updatedAt": "2025-01-25T10:00:00.000Z"
}
}Fields
_id
string
Transaction ID
price
number
Amount in USDC (e.g., 0.015 = $0.015)
hash
string
Blockchain transaction hash
status
string
Always "Pending"
type
string
Transaction type (e.g., "Contract")
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
Last update time
What to do
Create order record in your database
Reserve inventory temporarily
Send notification to user that payment is processing
Track analytics for payment initiation
What NOT to do
❌ Don't fulfill orders yet (wait for
transaction.succeeded)❌ Don't mark payment as complete
❌ Don't deliver digital goods
Example handler
async function handleTransactionCreated(transaction) {
// Create pending order
await db.orders.create({
transactionId: transaction._id,
userId: transaction.user._id,
amount: transaction.price,
status: 'pending',
hash: transaction.hash
});
// Notify user
await sendEmail(transaction.user.username, {
subject: 'Payment Processing',
body: `Your payment of $${transaction.price} is being processed.`
});
console.log(`Order created for transaction ${transaction._id}`);
}Next steps
Wait for one of these events:
transaction.succeeded - Payment completed
transaction.failed - Payment failed
Last updated
Was this helpful?