✓ Standard checkout
The happy-path approval. Customer enters a working test card; we expect payment.succeeded.
What to do
- Click Run scenario below.
- You'll be redirected to the hosted payment page at
pay.sknpay.com/checkout/…— note that the cardholder, phone, and billing-address fields are pre-filled with test data because we passed them on the API call (and forced their display viabilling_address_collection: 'required'). Customer can edit any of them before paying. - Enter test card
4111 1111 1111 1111, any future expiry, any CVV. - After the success-screen 5-second countdown, you bounce back to
/success. - Within ~1 minute,
payment.succeededarrives at/webhooks/sknpay— see Event log. The webhook'scustomer_name/customer_emailreflect what the cardholder actually submitted, not the pre-fill.
The code
// Node.js
const r = await fetch('https://app.sknpay.com/api/v1/payments', {
method: 'POST',
headers: {
Authorization: 'Bearer ' + process.env.SKNPAY_API_KEY,
'Content-Type': 'application/json',
'Idempotency-Key': 'order-' + Date.now(),
},
body: JSON.stringify({
amount: 1000, // minor units — 10.00 USD
currency: 'USD',
description: 'Standard checkout test',
customer_email: 'test@example.com',
success_url: 'https://yoursite.com/thanks',
cancel_url: 'https://yoursite.com/cart',
}),
})
const payment = await r.json()
res.redirect(303, payment.url) // → customer pays on hosted page
<?php
$ch = curl_init('https://app.sknpay.com/api/v1/payments');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SKNPAY_API_KEY'),
'Content-Type: application/json',
'Idempotency-Key: order-' . time(),
],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 1000,
'currency' => 'USD',
'description' => 'Standard checkout test',
'customer_email' => 'test@example.com',
'success_url' => 'https://yoursite.com/thanks',
'cancel_url' => 'https://yoursite.com/cart',
]),
]);
$payment = json_decode(curl_exec($ch), true);
header('Location: ' . $payment['url'], true, 303);
# Python (Flask + requests)
r = requests.post(
'https://app.sknpay.com/api/v1/payments',
headers={
'Authorization': f'Bearer {os.environ["SKNPAY_API_KEY"]}',
'Content-Type': 'application/json',
'Idempotency-Key': f'order-{int(time.time())}',
},
json={
'amount': 1000,
'currency': 'USD',
'description': 'Standard checkout test',
'customer_email': 'test@example.com',
'success_url': 'https://yoursite.com/thanks',
'cancel_url': 'https://yoursite.com/cart',
},
)
return redirect(r.json()['url'], code=303)
curl -X POST https://app.sknpay.com/api/v1/payments \
-H "Authorization: Bearer $SKNPAY_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-$(date +%s)" \
-d '{
"amount": 1000,
"currency": "USD",
"description": "Standard checkout test",
"customer_email": "test@example.com",
"success_url": "https://yoursite.com/thanks",
"cancel_url": "https://yoursite.com/cart"
}'