A testing stub for payment provider integration. Simulates various payment methods for development and testing.
Create a new payment session
{
"provider": "qr" | "creditcard" | "paypal" | "bnpl",
"amount": 1000.00,
"currency": "THB",
"callback_url": "https://your-shop.com/payment/callback",
"metadata": { "order_id": "12345" },
// BNPL specific (optional):
"customer_name": "John Doe",
"customer_email": "john@example.com",
"customer_phone": "+66123456789"
}
Response:
{
"success": true,
"session_id": "sess_...",
"checkout_url": "https://payment-stub.yaakdai.net/checkout?session_id=sess_...",
"expires_at": 1234567890000
}
Get payment session status (server-side polling)
{
"success": true,
"session_id": "sess_...",
"status": "pending" | "completed" | "failed" | "expired",
"provider": "qr",
"amount": 1000.00,
"currency": "THB",
"approval_status": "pending" | "approved" | "denied" // BNPL only
}
Complete payment (called by checkout page, not by your backend)
{
"session_id": "sess_...",
"success": true | false
}
For BNPL transactions, use the admin panel to manually approve/deny requests:
https://payment-stub.yaakdai.net/admin
Admin Token: Check your wrangler.toml configuration
POST /api/create to create a sessioncheckout_url (opens in popup/new window)callback_url with statusGET /api/status to verify server-side// 1. Create session
const response = await fetch('https://payment-stub.yaakdai.net/api/create', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
provider: 'qr',
amount: 1000.00,
currency: 'THB',
callback_url: 'https://your-shop.com/payment/callback'
})
});
const { checkout_url, session_id } = await response.json();
// 2. Open checkout in popup
window.open(checkout_url, 'payment', 'width=600,height=800');
// 3. In your callback handler, verify status
const status = await fetch('https://payment-stub.yaakdai.net/api/status?session_id=' + session_id);
const { status } = await status.json();
if (status === 'completed') {
// Payment successful!
}
Yaakdai Payment Stub Test • For Development & Testing Only