Comprehensive test scenarios and sandbox testing instructions for the Precium Payment API. Contact your account manager to gain access to more advanced testing scenarios if required. Especially for s2s integrations.
Note: Sandbox and production use the same base URL but different credentials. Always verify you're using sandbox credentials when testing.
Use these card numbers to simulate failures:
TC-1.1: Create Payment Link
Objective: Verify payment link creation with minimal parameters
Steps:
/purchases/ with client email, product, and brand_idcheckout_urlcheckout_url in browser
Request:
JSON
{
"client": {"email": "test@example.com"},
"purchase": {
"currency": "ZAR",
"products": [{"name": "Test Product", "price": 10000}]
},
"brand_id": "YOUR_BRAND_ID"
}
Expected: HTTP 201, response contains checkout_url and id
TC-1.2: Complete Card Payment
Objective: End-to-end card payment flow
Steps:
checkout_urlsuccess_redirectpaid
Request:
JSON
{
"client": {"email": "test@example.com"},
"purchase": {
"currency": "ZAR",
"products": [{"name": "Test Product", "price": 10000}]
},
"brand_id": "YOUR_BRAND_ID",
"success_redirect": "https://example.com/success",
"failure_redirect": "https://example.com/failure"
}
Expected:
paid
TC-1.3: Payment with Multiple Products
Objective: Verify the correct total calculation
Steps:
purchase.total equals the sum of all product prices
Request:
JSON
{
"client": {"email": "test@example.com"},
"purchase": {
"currency": "ZAR",
"products": [
{"name": "Product A", "price": 5000, "quantity": "2"},
{"name": "Product B", "price": 3000},
{"name": "Shipping", "price": 2000}
]
},
"brand_id": "YOUR_BRAND_ID"
}
Expected: Total should be 15000 (5000Ã2 + 3000 + 2000)
TC-2.1: Whitelist Card Only
Objective: Verify that only whitelisted methods appear
Steps:
payment_method_whitelist: ["visa", "mastercard"]
Request:
JSON
{
"client": {"email": "test@example.com"},
"purchase": {
"currency": "ZAR",
"products": [{"name": "Test", "price": 10000}]
},
"brand_id": "YOUR_BRAND_ID",
"payment_method_whitelist": ["visa", "mastercard"]
}
Expected: Only card payment options visible on checkout
TC-2.2: Whitelist EFT Only
Objective: Verify non-card methods work
Steps:
payment_method_whitelist: ["ozow"]
Expected: Only Ozow payment option visible
TC-3.1: Create Pre-Authorization
Objective: Reserve funds without capture
Steps:
skip_capture: truehold (not paid)
Request:
JSON
{
"client_id": "CLIENT_UUID",
"purchase": {
"currency": "ZAR",
"products": [{"name": "Hotel Deposit", "price": 500000}]
},
"brand_id": "YOUR_BRAND_ID",
"skip_capture": true,
"success_redirect": "https://example.com/success",
"failure_redirect": "https://example.com/failure"
}
Expected: Status hold after payment completion
TC-3.2: Capture Pre-Authorization (Full)
Objective: Capture the full held amount
Steps:
/purchases/{id}/capture/ with full amountpaid
Request:
BASH
POST /purchases/{id}/capture/
{"amount": 500000}
Expected: Status changes to paid
TC-3.3: Capture Pre-Authorization (Partial)
Objective: Capture less than held amount
Steps:
Request:
BASH
POST /purchases/{id}/capture/
{"amount": 300000}
Expected: Capture succeeds with a partial amount
TC-3.4: Release Pre-Authorization
Objective: Release held funds without capture
Steps:
hold)/purchases/{id}/release/released
Expected: Status released, funds returned
TC-4.1: Full Refund
Objective: Refund the entire payment
Steps:
paid/purchases/{id}/refund/ with an empty body
Request:
bash
BASH
POST /purchases/{id}/refund/
{}
Expected: Refund processed, status updated
TC-4.2: Partial Refund
Objective: Refund portion of payment
Steps:
Request:
BASH
POST /purchases/{id}/refund/
{"amount": 3000}
Expected: Partial refund of 3000 cents processed
TC-4.3: Multiple Partial Refunds
Objective: Issue multiple refunds on the same purchase
Steps:
Expected: Multiple refunds succeed up to the original amount
TC-4.4: Refund Exceeds Amount
Objective: Verify refund limit enforcement
Steps:
Expected: HTTP 400, error refund_exceeds_amount
TC-5.1: Tokenize Card
Objective: Save card for future payments
Steps:
force_recurring: true/clients/{id}/recurring_tokens/
Request:
JSON
{
"client_id": "CLIENT_UUID",
"purchase": {
"currency": "ZAR",
"products": [{"name": "Subscription", "price": 29900}]
},
"brand_id": "YOUR_BRAND_ID",
"force_recurring": true,
"success_redirect": "https://example.com/success",
"failure_redirect": "https://example.com/failure"
}
Expected: Recurring token created after payment
TC-5.2: Zero-Amount Tokenization
Objective: Save the card without charging
Steps:
price: 0 and skip_capture: true
Request:
JSON
{
"client_id": "CLIENT_UUID",
"purchase": {
"currency": "ZAR",
"products": [{"name": "Card Authorization", "price": 0}]
},
"brand_id": "YOUR_BRAND_ID",
"skip_capture": true,
"force_recurring": true,
"success_redirect": "https://example.com/success",
"failure_redirect": "https://example.com/failure"
}
Expected: Token created, no charge to card
TC-5.3: Charge with Token
Objective: Process payment using saved token
Steps:
/purchases/{id}/charge/ with recurring_token
Request:
BASH
POST /purchases/{new_id}/charge/
{"recurring_token": "ORIGINAL_PURCHASE_ID"}
Expected: Payment succeeds, status paid
TC-5.4: Charge with Invalid Token
Objective: Verify invalid token handling
Steps:
Expected: HTTP 404, error recurring_token_not_found
TC-6.1: Create Subscription Plan
Objective: Create a monthly subscription template
Steps:
/billing_templates/
Request:
JSON
{
"title": "Monthly Premium",
"purchase": {
"currency": "ZAR",
"products": [{"name": "Premium Plan", "price": 29900}]
},
"brand_id": "YOUR_BRAND_ID",
"is_subscription": true,
"subscription_active": true,
"subscription_period": 1,
"subscription_period_units": "months",
"force_recurring": true
}
Expected: Template created with subscription configuration
TC-6.2: Add Subscriber
Objective: Subscribe the client to a plan
Steps:
TC-6.3: Add Subscriber with Override
Objective: Subscribe with custom pricing
Steps:
Request:
JSON
{
"client_id": "CLIENT_UUID",
"override": {
"products": [{"name": "Discounted Plan", "price": 19900}]
}
}
Expected: Subscription uses override pricing
TC-7.1: Create Client
Objective: Create a new client record
Steps:
/clients/ with email and details
Request:
JSON
{
"email": "test@example.com",
"full_name": "Test User",
"phone": "+27821234567"
}
Expected: HTTP 201, client ID returned
TC-7.2: Search Client
Objective: Find a client by email
Steps:
/clients/?email=test@example.com
Expected: Client returned in search results
TC-7.3: Duplicate Client Prevention
Objective: Verify duplicate email handling
Steps:
Expected: HTTP 409, error duplicate_client
TC-8.1: Payment Success Webhook
Objective: Verify webhook delivery on payment
Steps:
purchase.paid
Expected: Webhook delivered with correct event type
TC-8.2: Payment Failure Webhook
Objective: Verify the webhook on failed payment
Steps:
purchase.payment_failure
Expected: Webhook delivered with failure details
TC-8.3: Webhook Signature Verification
Objective: Verify webhook authenticity
Steps:
Expected: Calculated signature matches header
TC-9.1: Invalid API Key
Objective: Verify authentication error
Steps:
Expected: HTTP 401, invalid_token error
TC-9.2: Missing Required Field
Objective: Verify validation error
Steps:
brand_id
Expected: HTTP 400, required error for brand_id
TC-9.3: Invalid UUID
Objective: Verify UUID validation
Steps:
/purchases/invalid-uuid/
Expected: HTTP 400 or 404 with clear error
TC-9.4: Rate Limiting
Objective: Verify rate limit handling
Steps:
Expected: HTTP 429 after limit exceeded
Pre-Integration Checklist
Basic Flow Tests
Advanced Flow Tests
Error Handling Tests
Production Readiness
Before going live: