PayDirect Blog
Turbocharging Your Workspace with PayDirect: The New Provisioning Script for AgentDAO Developers!
Turbocharging Your Workspace with PayDirect: The New Provisioning Script for AgentDAO Developers!
Hey devs, ever found yourself clawing at your keyboard, wishing for a smoother ride when setting up workspaces on your favorite crypto platform? Well, buckle up and get ready to cruise because PayDirect just dropped a new provisioning script that’s going to make your setup experience as buttery as your favorite avocado toast!
The Code Behind the Magic
Let’s cut right to the chase. The new script, provision-agentdao-workspace.ts, is designed to automate the creation of a PayDirect workspace specifically for the cool cats over at AgentDAO. This upgrade is set to streamline how developers and AI agents interact with crypto settlements. Grab your frappe, and let’s break down the deets!
Here’s a sneak peek into the nuts and bolts:
/**
* Provision a PayDirect workspace for developers.agentdao.com
*
* Run: pnpm exec tsx scripts/provision-agentdao-workspace.ts
*
* This creates:
* - A workspace with platform "agentdao"
* - Live + Sandbox API keys
* - A webhook with signing secret
*/
Sweet, right? With just a single command, this script rolls out the welcome mat by creating a workspace with live and sandbox API keys, plus a webhook with a signing secret. It's like having your own automated swiss army knife!
Why This Change Matters
Okay, so why should you care? Well, if you've ever spent hours trying to manually set up a workspace, only to be hampered by typos and API misconfigurations, you know the pain. This provisioning script ensures that you don't have to sweat the small stuff.
First, it simplifies the onboarding process. You get a neat package of tools all bundled up nicely, without the hassle of manual configurations. Here’s a highlight of what you get:
- Automated Setup: Forget about the long setup guides. Just run the script and boom, you're ready to go!
- Error Handling: The script checks for missing secrets and exits gracefully if something's awry. No more silent fails.
- Webhook Magic: The webhook automates event listening for all your payment activities, from "payment.created" to "payout.failed." You’ll know exactly what’s happening, when it’s happening.
How It Works
The script kicks into gear by importing your environment variables, so make sure your .env file is locked and loaded. Then, it checks for the critical ADMIN_API_SECRET. Don’t have it? The script will give you a gentle nudge—or a not-so-gentle exit status.
Here’s the function that takes care of business:
async function main() {
console.log("=== Provisioning AgentDAO Developers Workspace ===\n")
console.log(`PayDirect URL: ${PAYDIRECT_BASE_URL}\n`)
const payload = {
name: "AgentDAO Developers",
ownerEmail: "[email protected]",
platform: "agentdao",
webhookUrl: "https://developers.agentdao.com/api/webhooks/paydirect",
webhookEvents: [
"payment.created",
"payment.detected",
// ... more events ...
],
metadata: {
description: "AgentDAO developers portal integration",
createdAt: new Date().toISOString(),
},
}
const res = await fetch(`${PAYDIRECT_BASE_URL}/api/v1/workspaces`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${ADMIN_SECRET}`,
},
body: JSON.stringify(payload),
})
if (!res.ok) {
const err = await res.text()
console.error(`Failed to create workspace: ${res.status}`)
console.error(err)
process.exit(1)
}
const data = await res.json()
console.log("=== SUCCESS ===\n")
console.log("Workspace created! Add these to developers.agentdao.com .env:\n")
// More success logging...
}
See how it logs everything? Consider it your new BFF in debugging.
Why We Love Keeping Things Clean
Oh, and if you noticed the .DS_Store update in the commit list, that’s just us tidying up. Keeping your codebase clean is like keeping your desk organized. It might seem small, but it’s all part of making your developer life more seamless.
Ready to Roll?
So there you have it – a snazzy new script to supercharge your PayDirect workspace. Go ahead and give it a whirl!
Call to Action
Want to see this baby in action? Check out the PayDirect GitHub repo and run the script yourself. Dive into the docs for a deep dive, or hit us up with your feedback! Whether you're deploying a fresh setup or scaling up your existing stack, this script is designed to make your life easier. Happy coding, and may your deployments be ever in your favor! 🚀
Tip the Author
Powered by PayDirect on Base
Enjoyed this post? Send a tip using crypto. We eat our own dog food.
More from PayDirect
Flex Your Payment Game: Merchant Wallet Now Optional in PayDirect's Payments API
May 18
Going Live By Default: Streamlining Your Crypto Settlements with PayDirect
May 18

Unlocking Secrets with PayDirect's New Webhook Revamp!
Apr 19

Level Up Your Webhooks: Enhanced Signature Verification and Smarter Logging!
Apr 19
Powered by ContentAgent
