ବାସ୍ତବିକ ଟଙ୍କା ବିନା ଏଜେଣ୍ଟ ଦେୟଗୁଡିକୁ ପରୀକ୍ଷା କରନ୍ତୁ।
Swap your API key for a sk_test_ key - that alone puts you on Base Sepolia. Fund the agent's wallet from the public Base Sepolia USDC faucet, make a real test payment with payments.create (test funds, no real money), and tunnel your local webhook through ngrok. The response shapes match live, so a flow that passes in test passes in production. Exercise the failure paths, not just the happy one.
ଆପଣ ଆରମ୍ଭ କରିବା ପୂର୍ବରୁ।
- ଏକ କାମ କରୁଥିବା ଇଣ୍ଟେଗ୍ରେସନ୍ ଲାଇଭ୍ରେ (କିମ୍ବା କମ୍ ସେହି ଲାଇଭ୍-ଆକାରରେ) - add-payments-to-agentକୁ ଦେଖ।
- ଡ୍ୟାଶବୋର୍ଡରୁ ଏକ
sk_test_API key ଏବଂ ସମ୍ମିଳିତ test signing secret। - ngrok (କିମ୍ବା କୌଣସି HTTPS ଟନେଲ) ବିକାଶ-ସମୟରେ webhook ପ୍ରେରଣା ପାଇଁ।
- ଏକ ଅଲଗା ବିକାଶ ପରିବେଶ - ଅଲଗା env vars, ଅଲଗା ଡେଟାବେସ୍ (କିମ୍ବା କମ୍ ସେହି ଅଲଗା ଟେବୁଲ୍), ଅଲଗା ହେବୋକ୍ URL।
- Comfort with the webhook patterns guide - ଏହି ଗାଇଡ୍ ଧରଣ କରେ ଯେ ଆପଣଙ୍କର ଏକ ହ୍ୟାଣ୍ଡଲର୍ ଅଛି ଯାହାକୁ ଯାଞ୍ଚ କରିବାକୁ।
Test key କୁ switch କରନ୍ତୁ।
sk_test_ କୀ Base Sepolia ଉପରେ ଲେନଦେନ କରେ; sk_live_ କୀ Base mainnet ଉପରେ ଲେନଦେନ କରେ। ପ୍ରିଫିକ୍ସ ନେଟୱର୍କକୁ ବାଛେ - ଏହାର କୌଣସି ବିଶେଷ ନେଟୱର୍କ env var ନାହିଁ, ଏବଂ ଏକ ପରୀକ୍ଷା କୀ mainnet ଧନକୁ ଗତି କରିପାରିବ ନାହିଁ। ସେହିପରି, ଏକ ଡେଭଲପର୍ ପରିବେଶ ପାଇଁ ଆପଣ ଯାହା ବଦଳାଇବେ ସେହେଉଛି କୀ (ଏବଂ ପରୀକ୍ଷା webhook ସଙ୍କେତ)।
# .env.development
# A sk_test_ key picks Base Sepolia automatically - there is no network env var.
BLOCKCHAIN0X_API_KEY=sk_test_01J9...
BLOCKCHAIN0X_WEBHOOK_SECRET=... # the test webhook's secret, from the dashboardଫସ୍କୁଟରୁ ଏଜେଣ୍ଟର ୱାଲେଟ୍ କୁ ଧନ ଦିଅନ୍ତୁ।
Test USDC ର କୌଣସି ମୂଲ୍ୟାନୁବନ୍ଧୀୟ ମୂଲ୍ୟ ନାହିଁ, କିନ୍ତୁ ଅନ୍ୟଥା live USDC ଭଳି ଆଚରଣ କରେ: ସମାନ response shape, ସମାନ balance tracking। ଏହାକୁ mint କରିବା ପାଇଁ କୌଣସି SDK call ନାହିଁ - ଆପଣ public Base Sepolia USDC faucet ରୁ agent ର wallet address କୁ fund କରନ୍ତି। Address କୁ dashboard ରେ କିମ୍ବା agent ର public page ରେ ଖୋଜନ୍ତୁ (କିମ୍ବା SDK ସହ agent କୁ read କରନ୍ତୁ), ତାପରେ ଏହାକୁ faucet ରେ paste କରନ୍ତୁ।
import { createClient } from "@blockchain0x/node";
const client = createClient({ apiKey: process.env.BLOCKCHAIN0X_API_KEY! }); // sk_test_
// Look up the agent; its wallet address is shown in the dashboard and on the
// agent's public page. Fund THAT address from the Base Sepolia USDC faucet -
// there is no SDK call that mints test funds.
const agent = await client.agents.get("agt_123");
console.log(agent.id);from blockchain0x import Client
client = Client() # reads BLOCKCHAIN0X_API_KEY (sk_test_)
# The agent's wallet address is in the dashboard / on its public page.
# Paste it into the public Base Sepolia USDC faucet to fund it.
agent = client.agents.get("agt_123")
print(agent["id"])ଏକ ବାସ୍ତବ test payment କରନ୍ତୁ।
wallet ରେ ଧନ ଥିଲେ, ଆପଣଙ୍କ sk_test_ key ଉପରେ payments.create call କରନ୍ତୁ। ଏହା test funds ବ୍ୟବହାର କରି Base Sepolia ଉପରେ ଏକ real transfer, ଏବଂ ଏହା mainnet ପରି ସଠିକ୍ ଭାବରେ payment.received webhook fire କରେ - ସେହିପାଇଁ ଆପଣ simulation ନୁହେଁ, actual code path କୁ exercise କରୁଛନ୍ତି। ଆପଣଙ୍କ tunnelled handler ରେ event ପହଞ୍ଚୁଥିବାକୁ ଦେଖନ୍ତୁ।
// On a sk_test_ key this is a REAL transfer on Base Sepolia (test funds, no
// real money). It fires the payment.received webhook just like mainnet does.
const tx = await client.payments.create({
agentId: "agt_123",
to: "0xRecipientOnSepolia",
amountWei: "10000", // 0.01 USDC
});
console.log(tx); // watch payment.received arrive at your webhooktx = client.payments.create(body={
"agentId": "agt_123",
"to": "0xRecipientOnSepolia",
"amountWei": "10000", # 0.01 USDC
})
print(tx) # watch payment.received arrive at your webhookନ୍ୟୁନତମରେ exercise କରିବାକୁ ତିନୋଟି scenario: ଏକ payment ଯାହା land କରେ (happy path, payment.received), ଏକ payment ଯାହା କେବେ land ନ କରେ (webhook କୁ dead URL ଦିଗରେ point କରନ୍ତୁ ଏବଂ reconcile sweep ଅଟକିଥିବା job କୁ ଧରିଥିବା କଥା confirm କରନ୍ତୁ - ଯେ path କୁ ଅଧିକାଂଶ teams ଅନଦେଖା କରେ), ଏବଂ ଏକ webhook retry (ପ୍ରଥମେ 500 force କରନ୍ତୁ ଏବଂ ଦ୍ୱିତୀୟରେ 200, ତାପରେ ଆପଣଙ୍କ idempotency duplicate work skip କରିଥିଲା କି ନାହିଁ verify କରନ୍ତୁ)।
ଆପଣଙ୍କର ସ୍ଥାନୀୟ ହ୍ୟାଣ୍ଡଲରକୁ ଟନେଲ୍ ହୁବ୍ କରନ୍ତୁ।
Test payments ଆପଣ test webhook ପାଇଁ configure କରିଥିବା URL କୁ real webhooks ପଠାଏ। Local development ପାଇଁ, ଏହାକୁ ଆପଣଙ୍କ laptop କୁ ଏକ HTTPS tunnel ଦିଅନ୍ତୁ। ngrok ସବୁଠାରୁ ସହଜ ବିକଳ୍ପ; ଯେକୌଣସି reverse-tunnel tool କାମ କରେ।
# Tunnel your local webhook endpoint to a public HTTPS URL.
$ ngrok http 3000
# Forwarding https://abc123.ngrok.app -> http://localhost:3000
# Paste the URL in the dashboard under Webhooks for your test
# environment - test and live keep separate webhook config.Test ଏବଂ live ରେ ଅଲଗା key ଏବଂ ଅଲଗା webhook configuration ବ୍ୟବହାର ହୁଏ, ଯାହାଦ୍ୱାରା ଆପଣ production କୁ ଆପଣଙ୍କ real endpoint ଦିଗରେ ରଖିପାରିବେ ଏବଂ local tunnel test events କୁ handle କରିପାରିବ।
ଭୁଲ କନଫିଗର୍ କୀସ୍ରେ ଦ୍ରୁତ ବିଫଳ ହୁଅନ୍ତୁ।
test/live key ଚାରିପାଖରେ ସବୁଠାରୁ ସାଧାରଣ production incident silent ହୁଏ: ଏକ deploy test key ସହିତ ଆସେ, କୌଣସି payment ଆସେ ନାହିଁ, alert ପରବର୍ତ୍ତୀ business day ପରେ ମାତ୍ର fire ହୁଏ। boot ସମୟରେ ଏହାକୁ block କରନ୍ତୁ: env ଏବଂ key prefix ମେଳ ନହେଲେ start କରିବାକୁ ଅସ୍ୱୀକାର କରନ୍ତୁ।
// Fail fast if test/live get mixed up.
const apiKey = process.env.BLOCKCHAIN0X_API_KEY!;
const env = process.env.NODE_ENV;
if (env === "production" && apiKey.startsWith("sk_test_")) {
throw new Error("Test key in production environment - aborting boot.");
}
if (env !== "production" && apiKey.startsWith("sk_live_")) {
throw new Error("Live key in non-production environment - aborting boot.");
}import os, sys
api_key = os.environ["BLOCKCHAIN0X_API_KEY"]
env = os.environ.get("ENV", "development")
if env == "production" and api_key.startswith("sk_test_"):
sys.exit("Test key in production environment - aborting boot.")
if env != "production" and api_key.startswith("sk_live_"):
sys.exit("Live key in non-production environment - aborting boot.")ପରେ ଦାନ୍ତ କାଟିବାକୁ ଯୋଗ୍ୟ ପାଞ୍ଚ ପରୀକ୍ଷା ଭୁଲ।
Base Sepolia ଭୁଲିବା ଏହାର ନିଜସ୍ୱ ଚେନ୍
ଏକ sk_test_ key Base mainnet ନୁହେଁ, Base Sepolia ରେ transact କରେ। block explorers, wallet addresses, ଏବଂ gas tokens ସବୁ ଅଲଗା। ସାଧାରଣ ଭ୍ରମ ହେଉଛି real Base address କୁ test ରେ କପି କରି, failure ଦେଖି, API ଭଙ୍ଗିଛି ଭାବିବା। Base Sepolia USDC faucet ଠାରୁ agent ର wallet address କୁ fund କରନ୍ତୁ ଏବଂ ସେହି chain ରେ ଥିବା address କୁ pay କରନ୍ତୁ।
ବିଫଳ ପଥଗୁଡିକୁ ପରୀକ୍ଷା କରିବା ନୁହେଁ
ଅଧିକାଂଶ team happy path - payment.received trigger କରୁଥିବା payment - test କରନ୍ତି, ପରେ ship କରିଦିଅନ୍ତି ଏବଂ ପରେ ଜାଣନ୍ତି ତାଙ୍କର not-paid path ଭାଙ୍ଗିଛି। ଏହାକୁ exercise କରନ୍ତୁ: webhook କୁ ଏକ dead URL କୁ point କରନ୍ତୁ ଏବଂ ନିଶ୍ଚିତ କରନ୍ତୁ ଆପଣଙ୍କ reconcile sweep stuck job କୁ ଧରିନେଉଛି, handler ରୁ 500 force କରନ୍ତୁ ଏବଂ retry idempotent ବୋଲି verify କରନ୍ତୁ, ଏବଂ payments.create ର 503 (chain adapter not wired) ହାଣ୍ଡଲ୍ ହେଉଛି କି ନାହିଁ ଯାଞ୍ଚ କରନ୍ତୁ। Test environment ସସ୍ତା; production debugging ମହଙ୍ଗା।
Webhook URL ଏପର୍ଯ୍ୟନ୍ତ ଉତ୍ପାଦନରେ ngrok କୁ ଦେଖାଉଛି
କୀ ପ୍ରେଫିକ୍ସ ସ୍ୱିଚ୍ କରିବା ସହଜ; ଓଭର୍ହେଡ୍ URL ଅଦ୍ୟତନ କରିବା ସହଜ। ଯଦି ଆପଣ URL କୁ ଆପଣଙ୍କର ଲ୍ୟାପ୍ଟପ୍ରୁ ନଗ୍ରୋକ୍ ଟନେଲ୍ରେ ଦେଖିବେ, ପ୍ରଥମ ପ୍ରୋଡକ୍ସନ୍ ଦେୟ ଏକ ଓଭର୍ହେଡ୍କୁ ଶୂନ୍ୟରେ ଗୋଲାକାର କରେ। ଓଭର୍ହେଡ୍ URL ପରିବର୍ତ୍ତନକୁ ଡିପ୍ଲୟ ଚେକ୍ଲିଷ୍ଟର ଏକ ଅଂଶ ଭାବରେ ବ୍ୟବହାର କରନ୍ତୁ, ଗୋଟିଏ ଏକ-ବେଳର ସେଟିଂ ଭାବରେ ନୁହେଁ।
ଲାଇଭ୍ ଟାଇମିଂ ପାଇଁ ଟେସ୍ଟନେଟ୍ ଟାଇମିଂକୁ ପ୍ରକ୍ସୀ ଭାବେ ବିଶ୍ୱାସ କରିବା
Base Sepolia, Base mainnet ସହିତ ସମାନ ଭାବେ କାମ କରେ ନାହିଁ - block timing ଏବଂ congestion ଭିନ୍ନ ଅଟେ। mainnet throughput କୁ load-test କରିବା ପାଇଁ testnet ବ୍ୟବହାର କରନ୍ତୁ ନାହିଁ, ଏବଂ testnet latency production ରେ ଦେଖିବେ ବୋଲି ଧାରଣା କରନ୍ତୁ ନାହିଁ। ଯେତେବେଳେ ଆପଣଙ୍କୁ ପ୍ରକୃତ ସଂଖ୍ୟା ଦରକାର, sk_live_ key ସହିତ ଅଳ୍ପ-ରାଶିର mainnet smoke test ଚଲାନ୍ତୁ।
ସାଧାରଣ ଡାଟାବେସ୍ଗୁଡିକରେ ପରୀକ୍ଷା ଫିକ୍ସଚର୍ଗୁଡିକୁ ଛାଡ଼ିବା
ଯଦି ଆପଣଙ୍କର ଡେଭ୍ ଓ ପ୍ରୋଡ୍ ପରିବେଶଗୁଡିକ ଏକ ଡାଟାବେସ୍ ଅଂଶାଧାରଣ କରେ (ନାହିଁ), ଟେଷ୍ଟ ଘଟଣାଗୁଡିକ ଲାଇଭ୍ ଘଟଣାଗୁଡିକର ସେମାନେ ତାଲିକାରେ ଲାଣ୍ଡ କରେ ଏବଂ ଆପଣଙ୍କର ଇଡେମ୍ପୋଟେନ୍ସୀ ଡିଡ୍ୟୁପ୍ କୁ ଭଙ୍ଗ କରେ (ଘଟଣା ID ପ୍ରିଫିକ୍ସ ଭିନ୍ନ କିନ୍ତୁ ରୋ ହେଉଛି ଏହା ସତ୍ୟ)। କମ୍ ସେ କମ୍, ପ୍ରତ୍ୟେକ ପରିବେଶ ପାଇଁ webhook_events ତାଲିକାକୁ ଅଲଗା କରନ୍ତୁ। ଭଲ: ସମ୍ପୂର୍ଣ୍ଣ ଅଲଗା DBs। ଏହା ଏକ ନିୟମ ଯାହା ଅତିରିକ୍ତ ଲାଗୁଥାଏ ଯାହା ପରେ ଏହା ଏକ ଥର ଦାନ୍ତି।
ଏକ ଥର ପରୀକ୍ଷା ଲୁପ୍ ଆପଣଙ୍କର ବିକାଶ ଚକ୍ରରେ।
ଏକ ସ୍ୱସ୍ଥ test loop ଥିବାବେଳେ, ବାକି କାମ ମୁଖ୍ୟତଃ hardening: ଅଧିକ load ତଳେ ଭରସାଯୋଗ୍ୟ webhook handling, ଏକ ଶେଷ security checklist, ଏବଂ ଆପଣ ସହଯୋଗରେ ଚଳାଉଥିବା ପୂର୍ବ payment provider ଠାରୁ migration।
developer ମାନେ ସବୁଠାରୁ ଅଧିକ ପଚାରୁଥିବା webhook pattern
ଜୀବନରେ ଯିବା ପୂର୍ବରୁ ଆପଣଙ୍କର ଏଜେଣ୍ଟ ୱାଲେଟ୍ ସୁରକ୍ଷିତ କରନ୍ତୁ
ଏଜେଣ୍ଟ-ଚାଳିତ API ପ୍ରବେଶ ପାଇଁ Stripe ରୁ Blockchain0x କୁ ମାଇଗ୍ରେଟ୍ କରନ୍ତୁ
docs.blockchain0x.com ରେ ପୂର୍ଣ୍ଣ ସନ୍ଦର୍ଭ। ଟେସ୍ଟନେଟ୍ ବିବରଣୀ: Base chain glossary। ଉତ୍ପାଦ ସର୍ଫେସ୍: Payment API.