Gen-Endpoint
Back to API List
Payment Processing API
Handle payment flows, refunds, and transaction history with multiple payment methods.
E-commerce
Internal API - Hosted by this App
API Endpoints & Usage
Explore and interact with the available endpoints for the Payment Processing API. These API routes are live! The paths shown below are relative to your application's base URL. For example, if this application is hosted at https://gen-endpoint.com, an endpoint path for this API, such as /api/payments/process, would be accessible at https://gen-endpoint.com/api/payments/process. You can use the "Try it out" section for each endpoint or use tools like curl, Postman, or your browser's address bar (for GET requests) to interact with them.
POST

/api/payments/process

Process payment. Simulates async gateway interaction.

Show Static Examples

Example Request Body:

{
  "orderId": "order_123",
  "amount": 99.99,
  "currency": "USD",
  "paymentMethod": {
    "type": "card",
    "token": "tok_visa"
  },
  "customerId": "cust_abc"
}

Example Response:

{
  "paymentId": "pay_xyz123",
  "status": "pending",
  "amount": 99.99,
  "currency": "USD",
  "orderId": "order_123",
  "createdAt": "2024-08-20T12:00:00Z",
  "message": "Payment processing initiated."
}
Try it out
POST

/api/payments/{paymentId}/refund

Process full or partial refund for a payment. Replace {paymentId} with an actual transaction ID.

Show Static Examples

Example Request Body:

{
  "amount": 49.99,
  "reason": "customer_request",
  "currency": "USD"
}

Example Response:

{
  "refundId": "ref_abc789",
  "originalPaymentId": "pay_xyz123",
  "paymentStatus": "partially_refunded",
  "refundedAmount": 49.99,
  "currency": "USD",
  "reason": "customer_request",
  "processedAt": "2024-08-20T12:05:00Z",
  "payment": {}
}
Try it out

Replace placeholders (e.g., {userId}) with actual values in the path above.

GET

/api/payments/history

Get payment transaction history. Supports filtering by userId (as customerId), status, orderId, and pagination.

Show Static Examples

Example Request Parameters:

?userId=cust_abc&status=succeeded&limit=10&page=1

Example Response:

{
  "payments": [
    {
      "id": "pay_xyz123",
      "orderId": "order_123",
      "customerId": "cust_abc",
      "amount": 99.99,
      "currency": "USD",
      "status": "succeeded",
      "createdAt": "2024-08-20T12:00:00Z",
      "updatedAt": "2024-08-20T12:00:01Z",
      "paymentMethod": {
        "type": "card",
        "brand": "Visa",
        "last4": "4242"
      },
      "paymentGatewayDetails": {
        "gatewayTransactionId": "gw_pay_xyz123",
        "responseCode": "00",
        "message": "Payment successful"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 10,
    "total": 1,
    "pages": 1
  }
}
Try it out

You can add or change query parameters in the path above (e.g., ?name=User).