Test Payments and Modifications
Test payment transactions and post-payment modifications
Test Payments and Modifications
Test various payment scenarios and post-payment operations.
Successful payments
Use test cards to simulate successful payments:
curl -X POST https://api.plexypay.com/v2/payments \
-H "x-api-key: YOUR_TEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "USD",
"payment_method": {
"type": "card",
"card": {
"number": "4242424242424242",
"exp_month": 12,
"exp_year": 2030,
"cvc": "123"
}
}
}'The response status field will be "succeeded".
Failed payments
Trigger specific failure scenarios with special card numbers:
| Card Number | Scenario |
|---|---|
4000000000000002 | Card declined |
4000000000009995 | Insufficient funds |
4000000000009987 | Lost card |
4000000000009979 | Stolen card |
4000000000000069 | Expired card |
4000000000000127 | Invalid CVC |
Capture payments
Test authorization and capture flow:
# Step 1: Authorize (capture: false)
curl -X POST https://api.plexypay.com/v2/payments \
-H "x-api-key: YOUR_TEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "USD",
"capture": false,
"payment_method": {"type": "card", "card": {"number": "4242424242424242", "exp_month": 12, "exp_year": 2030, "cvc": "123"}}
}'The response status will be "requires_capture".
# Step 2: Capture full amount
curl -X POST https://api.plexypay.com/v2/payments/pay_abc123/capture \
-H "x-api-key: YOUR_TEST_API_KEY"Partial capture
Capture less than the authorized amount:
curl -X POST https://api.plexypay.com/v2/payments/pay_abc123/capture \
-H "x-api-key: YOUR_TEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": 3000}'Refunds
Test refund processing:
# Full refund
curl -X POST https://api.plexypay.com/v2/refunds \
-H "x-api-key: YOUR_TEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"payment_id": "pay_abc123"}'# Partial refund
curl -X POST https://api.plexypay.com/v2/refunds \
-H "x-api-key: YOUR_TEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"payment_id": "pay_abc123", "amount": 2500}'Cancel payments
Cancel an uncaptured authorization:
curl -X POST https://api.plexypay.com/v2/payments/pay_abc123/cancel \
-H "x-api-key: YOUR_TEST_API_KEY"Verify webhook delivery
After each test, verify webhooks were received:
- Check your webhook endpoint logs
- Verify event type matches (
payment.succeeded,refund.created, etc.) - Confirm payload data is correct
See also
- Test Cards - All test card numbers
- Result Codes - Response handling