> For the complete documentation index, see [llms.txt](https://docs.hyperswitch.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperswitch.io/integrations/prism/java/payment-service.md).

# Payment Service Overview

## Overview

The Payment Service provides comprehensive payment lifecycle management for digital businesses using the Java SDK. It enables you to process payments across 100+ connectors through a unified SDK.

**Business Use Cases:**

* **E-commerce checkout** - Authorize funds at purchase, capture when items ship
* **SaaS subscriptions** - Set up recurring payments with mandate management
* **Marketplace platforms** - Hold funds from buyers, release to sellers on fulfillment
* **Hotel/travel bookings** - Pre-authorize for incidentals, capture adjusted amounts
* **Digital goods delivery** - Immediate capture for instant-access products

## Operations

| Operation                                                                                           | Description                                                                                                                                                              | Use When                                                             |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------- |
| [`authorize`](/integrations/prism/java/payment-service/authorize.md)                                | Authorize a payment amount on a payment method. This reserves funds without capturing them, essential for verifying availability before finalizing.                      | Two-step payment flow, verify funds before shipping                  |
| [`capture`](/integrations/prism/java/payment-service/capture.md)                                    | Finalize an authorized payment transaction. Transfers reserved funds from customer to merchant account, completing the payment lifecycle.                                | Order shipped/service delivered, ready to charge                     |
| [`get`](/integrations/prism/java/payment-service/get.md)                                            | Retrieve current payment status from the payment processor. Enables synchronization between your system and payment processors for accurate state tracking.              | Check payment status, webhook recovery, pre-fulfillment verification |
| [`void`](/integrations/prism/java/payment-service/void.md)                                          | Cancel an authorized payment before capture. Releases held funds back to customer, typically used when orders are cancelled or abandoned.                                | Order cancelled before shipping, customer request                    |
| [`reverse`](/integrations/prism/java/payment-service/reverse.md)                                    | Reverse a captured payment before settlement. Recovers funds after capture but before bank settlement, used for corrections or cancellations.                            | Same-day cancellation, processing error correction                   |
| [`refund`](/integrations/prism/java/payment-service/refund.md)                                      | Initiate a refund to customer's payment method. Returns funds for returns, cancellations, or service adjustments after original payment.                                 | Product returns, post-settlement cancellations                       |
| [`incrementalAuthorization`](/integrations/prism/java/payment-service/incremental-authorization.md) | Increase authorized amount if still in authorized state. Allows adding charges to existing authorization for hospitality, tips, or incremental services.                 | Hotel incidentals, restaurant tips, add-on services                  |
| [`createOrder`](/integrations/prism/java/payment-service/create-order.md)                           | Initialize an order in the payment processor system. Sets up payment context before customer enters card details for improved authorization rates.                       | Pre-checkout setup, session initialization                           |
| [`verifyRedirectResponse`](/integrations/prism/java/payment-service/verify-redirect-response.md)    | Validate redirect-based payment responses. Confirms authenticity of redirect-based payment completions to prevent fraud and tampering.                                   | 3DS completion, bank redirect verification                           |
| [`setupRecurring`](/integrations/prism/java/payment-service/setup-recurring.md)                     | Setup a recurring payment instruction for future payments/debits. This could be for SaaS subscriptions, monthly bill payments, insurance payments and similar use cases. | Subscription setup, recurring billing                                |

## SDK Setup

```java
import com.hyperswitch.prism.PaymentClient;

PaymentClient paymentClient = PaymentClient.builder()
    .connector("stripe")
    .apiKey("YOUR_API_KEY")
    .environment("SANDBOX")
    .build();
```

## Common Patterns

### E-commerce Checkout Flow

```mermaid
sequenceDiagram
    participant App as Your App
    participant CS as Prism
    participant PP as Payment Provider

    App->>CS: 1. createOrder
    CS->>PP: Create order with provider
    PP-->>CS: Return provider order
    CS-->>App: Return order_context
    App->>CS: 2. authorize (with order_context)
    CS->>PP: Reserve funds
    PP-->>CS: Return authorization
    CS-->>App: Return connector_transaction_id (AUTHORIZED)
    Note over App: Order ships to customer
    App->>CS: 3. capture (when order ships)
    CS->>PP: Transfer funds
    PP-->>CS: Return capture confirmation
    CS-->>App: Return status: CAPTURED
```

**Flow Explanation:**

1. **createOrder** - Initialize a payment order at the processor before collecting payment details.
2. **authorize** - After the customer enters their payment details, call the `authorize` method with the `order_context` from step 1.
3. **capture** - Once the order is shipped, call the `capture` method with the `connector_transaction_id` from step 2.

## Next Steps

* [Refund Service](/integrations/prism/java/refund-service.md) - Process refunds and returns
* [Dispute Service](/integrations/prism/java/dispute-service.md) - Handle chargebacks and disputes
* [Customer Service](/integrations/prism/java/customer-service.md) - Manage customer payment methods


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyperswitch.io/integrations/prism/java/payment-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
