> 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/architecture/services-and-methods.md).

# Services and Methods

Prism organizes payment operations into services that reflect how payments actually work in the real world. Some operations are independent. Others are follow-on actions that only make sense after a payment exists.

## What is a Service?

A **service** is a logical grouping of related payment operations. Services model distinct phases or aspects of the payment lifecycle:

* **PaymentService** — Core payment operations (authorize, capture, refund)
* **RefundService** — Refund-specific operations
* **DisputeService** — Chargeback and dispute handling
* **RecurringPaymentService** — Stored payment method operations

Think of a service as a namespace that keeps related operations together. Services can depend on other services—a refund requires a payment to exist first.

## What is a Method?

A **method** is a single operation within a service. Methods are actions you invoke:

* `authorize()` — Hold funds on a payment method
* `capture()` — Transfer held funds
* `refund()` — Return funds to the customer

Each method has:

* A **request type** — Input parameters specific to that operation
* A **response type** — Output data returned after execution
* **Error handling** — Structured errors if the operation fails

Methods follow verb-noun naming (authorize, capture, void) to clearly indicate the action performed.

## Flow

A sample flow of the most frequently used methods will look like below.

```
                         ┌─────────────────────────────────────────────────────┐
                         │                  ONE-TIME PAYMENT                   │
                         │                                                     │
                         │   authorize() ──────► capture() ──────► refund()    │
                         │        │                   │                 │      │
                         │        ▼                   ▼                 ▼      │
                         │     void()                get()            get()    │
                         └─────────────────────────────────────────────────────┘
                                                  │
                                                  │ triggers (optional)
                                                  ▼
                         ┌─────────────────────────────────────────────────────┐
                         │                     DISPUTE                         │
                         │                                                     │
                         │          accept()  /  defend() ──► submit_evidence()│
                         └─────────────────────────────────────────────────────┘

                         ┌─────────────────────────────────────────────────────┐
                         │                RECURRING PAYMENT                    │
                         │                                                     │
                         │   setup_recurring() ──► charge() ──► revoke()       │
                         │           │               │                         │
                         │           ▼               ▼                         │
                         │          get()          get()                       │
                         └─────────────────────────────────────────────────────┘
```


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.hyperswitch.io/integrations/prism/architecture/services-and-methods.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
