PlexySDK DOCS

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 NumberScenario
4000000000000002Card declined
4000000000009995Insufficient funds
4000000000009987Lost card
4000000000009979Stolen card
4000000000000069Expired card
4000000000000127Invalid 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:

  1. Check your webhook endpoint logs
  2. Verify event type matches (payment.succeeded, refund.created, etc.)
  3. Confirm payload data is correct

See also

On this page