Skip to main content

Refund Service

Overview

The Refund Service helps you track and synchronize refund statuses across payment processors using the Java SDK. While the Payment Service handles initiating refunds, this service provides dedicated operations for retrieving refund information.

Business Use Cases:

  • Refund status tracking - Check the current status of pending refunds to inform customers
  • Financial reconciliation - Synchronize refund states with your internal accounting systems
  • Webhook processing - Handle asynchronous refund notifications from payment processors
  • Customer service - Provide accurate refund status information to support teams

Operations

OperationDescriptionUse When
getRetrieve refund status from the payment processor. Tracks refund progress through processor settlement for accurate customer communication.Checking refund status, reconciling refund states, customer inquiries

SDK Setup

import com.hyperswitch.prism.PaymentClient;

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

Common Patterns

Refund Status Tracking Flow

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

Note over App: Customer requests refund
App->>CS: 1. refund (via PaymentService)
CS->>PP: Initiate refund
PP-->>CS: Return refund initiated (PENDING)
CS-->>App: Return connectorRefundId (PENDING)
Note over App: Customer checks status
App->>CS: 2. get (check refund status)
CS->>PP: Retrieve refund status
PP-->>CS: Return status: PENDING
CS-->>App: Return status: PENDING
Note over App: After some time
App->>CS: 3. get (poll for update)
CS->>PP: Retrieve refund status
PP-->>CS: Return status: SUCCEEDED
CS-->>App: Return status: SUCCEEDED

Flow Explanation:

  1. Initiate refund - First, call the Payment Service's refund method to initiate the refund.

  2. Check status - Call the Refund Service's get method with the connectorRefundId.

  3. Poll for updates - For refunds that start as PENDING, periodically call get to check for status updates.

Next Steps