Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for integrating payment gateways (Stripe, PayPal, Xendit, Midtrans, DOKU SNAP BI) and secure webhooks into SaaS platforms / Panduan ahli integrasi payment gateway dan webhook aman.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
<a name="english"></a>
Expert guide for integrating major payment gateways (Stripe, PayPal, Xendit, Midtrans, DOKU SNAP BI) into modern SaaS platforms. Covers checkout flows, secure raw-body webhook handling, atomic idempotency to prevent race conditions, subscription state machines, and local database synchronization.
findUnique checks, as concurrent webhook retries cause race conditions. Always use Atomic Updates (UPDATE ... WHERE status = 'PENDING') or database pessimistic locks (SELECT ... FOR UPDATE).req.text() in Fetch API or express.raw({ type: 'application/json' }) in Express).200 OK so the payment gateway halts retries.trialing, active, past_due, canceled) accurately to internal SaaS state machines./api/webhooks/stripe, /api/webhooks/doku/checkout).WHERE status = 'PENDING') to eliminate race conditions.200 OK.import { headers } from 'next/headers';
import crypto from 'crypto';
import { db } from '@/lib/db';
export async function POST(req: Request) {
const rawBody = await req.text(); // Raw body is mandatory
const headerList = await headers();
const timestamp = headerList.get('x-timestamp') || '';
const receivedSig = headerList.get('x-signature') || '';
const authHeader = headerList.get('authorization') || '';
const token = authHeader.replace(/^Bearer\s+/i, '');
const path = new URL(req.url).pathname;
// 1. SNAP BI Body Hash & Signature Verification (HMAC-SHA512)
const bodyHash = crypto.createHash('sha256').update(rawBody, 'utf8').digest('hex').toLowerCase();
const stringToSign = `POST:${path}:${token}:${bodyHash}:${timestamp}`;
const calculatedSig = crypto
.createHmac('sha512', process.env.DOKU_SECRET_KEY!)
.update(stringToSign, 'utf8')
.digest('base64');
const isValid = crypto.timingSafeEqual(Buffer.from(receivedSig), Buffer.from(calculatedSig));
if (!isValid) {
return new Response('Invalid Signature', { status: 401 });
}
const payload = JSON.parse(rawBody);
const invoiceNumber = payload.order?.invoice_number;
// 2. Atomic Update: Eliminates Race Conditions by locking on 'PENDING' status
const updated = await db.transaction.updateMany({
where: {
invoiceNumber: invoiceNumber,
status: 'PENDING', // Key race condition prevention gate
},
data: {
status: 'PAID',
paidAt: new Date(),
externalReference: payload.transaction?.original_reference_no,
},
});
// 3. Duplicate Webhook Handling (Idempotency)
if (updated.count === 0) {
// Already processed or invalid invoice — return 200 to halt gateway retry spam
return new Response(JSON.stringify({ status: 'ALREADY_PROCESSED' }), { status: 200 });
}
// 4. Fulfillment (Execute only once)
await grantUserSubscription(invoiceNumber);
return new Response(JSON.stringify({ status: 'SUCCESS' }), { status: 200 });
}
async function grantUserSubscription(invoiceNumber: string) {
// Safe business logic execution
}
saas-billing, doku-payment-gateway, doku-mcp-server, async-queue-temporal-expert, database-orm-expert.Active whenever the user is working on billing integration, payment checkout, webhook handling, or integrating platforms like PayPal, Stripe, Xendit, Midtrans, or DOKU SNAP BI.
<a name="bahasa-indonesia"></a>
Panduan ahli untuk mengintegrasikan payment gateway utama (Stripe, PayPal, Xendit, Midtrans, DOKU SNAP BI) ke platform SaaS modern. Mencakup alur checkout, penanganan webhook raw-body aman, pencegahan race condition melalui atomic update, state machine langganan, dan sinkronisasi database lokal.
findUnique, karena panggilan webhook paralel dari gateway dapat memicu race condition. Selalu gunakan Atomic Update (UPDATE ... WHERE status = 'PENDING') atau database lock (SELECT ... FOR UPDATE).req.text() pada Fetch API atau express.raw({ type: 'application/json' }) di Express).200 OK agar payment gateway berhenti mengirimkan retry.trialing, active, past_due, canceled) secara akurat ke state machine internal SaaS./api/webhooks/stripe, /api/webhooks/doku/checkout).WHERE status = 'PENDING') untuk mematikan peluang race condition.200 OK.saas-billing, doku-payment-gateway, doku-mcp-server, async-queue-temporal-expert, database-orm-expert.Aktif setiap kali pengguna sedang mengerjakan integrasi billing, checkout pembayaran, penanganan webhook, atau mengintegrasikan platform seperti PayPal, Stripe, Xendit, Midtrans, atau DOKU SNAP BI.
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for intelligent model cascading and routing — complexity-scored task routing from Flash/Haiku to Sonnet/Opus/Astra, dynamic escalation with quality gates, 40-60% token cost reduction while maintaining output quality / Panduan ahli untuk kaskade dan routing model cerdas — routing tugas berbasis skor kompleksitas dari Flash/Haiku ke Sonnet/Opus/Astra, eskalasi dinamis dengan gerbang kualitas, pengurangan biaya token 40-60% dengan kualitas output terjaga.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for Affective Computing, emotional AI, and real-time sentiment analysis through native multimodal tokens (voice intonation and facial micro-expressions) / Panduan ahli komputasi afektif, AI emosional, dan analisis sentimen real-time melalui token multimodal native.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for AI-assisted coding workflows — agentic code generation, multi-agent code swarms, self-healing CI/CD, automated PR review, spec-to-code pipelines, codebase knowledge graphs, and human-in-the-loop approval gates / Panduan ahli untuk workflow pengkodean berbasis AI — generasi kode agentic, code swarm multi-agen, CI/CD self-healing, review PR otomatis, pipeline spec-to-code, knowledge graph codebase, dan gate persetujuan human-in-the-loop.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for long-term episodic memory integration (Mem0 v2, Letta/MemGPT, Zep v2), memory tier architecture, pgvector HNSW storage, and unified context management for autonomous AI agents / Panduan ahli untuk integrasi memori episodik jangka panjang (Mem0 v2, Letta/MemGPT, Zep v2), arsitektur tier memori, penyimpanan pgvector HNSW, dan manajemen konteks terpadu untuk agen AI otonom.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for designing Machine-to-Machine (M2M) micro-economies, autonomous agent wallets, and swarm budget allocation / Panduan ahli merancang ekonomi mikro antar-agen (M2M), dompet agen otonom, dan alokasi anggaran swarm.
日本語の概要は準備中です。原文の説明を表示しています。