✓  Standard checkout

The happy-path approval. Customer enters a working test card; we expect payment.succeeded.

What to do

  1. Click Run scenario below.
  2. 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 via billing_address_collection: 'required'). Customer can edit any of them before paying.
  3. Enter test card 4111 1111 1111 1111, any future expiry, any CVV.
  4. After the success-screen 5-second countdown, you bounce back to /success.
  5. Within ~1 minute, payment.succeeded arrives at /webhooks/sknpay — see Event log. The webhook's customer_name / customer_email reflect what the cardholder actually submitted, not the pre-fill.

Creates a $10.00 USD payment, redirects you to the hosted page.

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"
  }'