Payments
Quark Commerce supports multiple payment providers configured per-store. The checkout flow handles payment initiation; this page covers the payment completion and webhook handling.
Supported Providers
| Provider | Markets | Features |
|---|---|---|
| Stripe | Global | Credit cards, Apple Pay, Google Pay, 3D Secure |
| Iyzico | Turkey | Credit cards, installments, local payment methods |
Payment Flow
Stripe Integration
Client-Side (JavaScript/TypeScript)
import { loadStripe } from '@stripe/stripe-js';
const stripe = await loadStripe('pk_live_...');
// After checkout confirm returns clientSecret
const { error, paymentIntent } = await stripe.confirmCardPayment(clientSecret, {
payment_method: {
card: cardElement,
billing_details: { name: 'John Doe' }
}
});
if (error) {
// Show error to user
} else if (paymentIntent.status === 'succeeded') {
// Confirm with API
await fetch('/api/storefront/payments/confirm', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
sessionId: checkoutSessionId,
paymentIntentId: paymentIntent.id
})
});
}
Iyzico Integration
Iyzico uses a redirect-based flow. After checkout confirmation, the API returns an Iyzico payment form URL. Redirect the user there, and they'll be sent back to your callback URL after payment.
Payment Statuses
| Status | Description |
|---|---|
Pending | Payment initiated, awaiting completion |
Paid | Payment successfully received |
Failed | Payment failed or declined |
Refunded | Payment refunded (full or partial) |
Webhook Handling
Payment providers send webhooks to confirm payment status asynchronously. The API handles these at:
- Stripe:
POST /api/storefront/payments/webhook - Iyzico:
POST /api/storefront/payments/iyzico/callback
info
Webhooks serve as a backup confirmation mechanism. The primary flow is the client-side confirmation call (POST /payments/confirm). Webhooks handle edge cases where the user closes the browser before confirming.