Skip to content

Latest commit

 

History

History
70 lines (57 loc) · 1.45 KB

File metadata and controls

70 lines (57 loc) · 1.45 KB

Example 2: Processing Payments

Complete payment processing workflows including multi-currency and recurring payments.

Prerequisites

  • Authenticated user (see Example 1)
  • JWT token

Basic Payment

curl -X POST http://localhost:8002/api/payments \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 99.99,
    "currency": "USD",
    "method": "CREDIT_CARD",
    "description": "Product purchase"
  }'

Multi-Currency Payment

curl -X POST http://localhost:8002/api/payments \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 89.99,
    "currency": "EUR",
    "method": "CREDIT_CARD",
    "description": "International purchase"
  }'

Recurring Subscription

curl -X POST http://localhost:8002/api/payments/subscription \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 29.99,
    "currency": "USD",
    "interval": "MONTHLY",
    "startDate": "2025-01-01",
    "description": "Premium subscription"
  }'

Get Payment History

curl -X GET "http://localhost:8002/api/payments?page=0&size=10" \
  -H "Authorization: Bearer $TOKEN"

Process Refund

curl -X POST http://localhost:8002/api/transactions/1001/refund \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 99.99,
    "reason": "Product return"
  }'