Connectors, 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.

Service Hierarchy

PaymentService (core)
├── authorize() — Start a payment, hold funds
├── capture() — Complete the payment, transfer funds
├── void() — Cancel an authorized payment
├── refund() — Return captured funds (calls RefundService)
└── sync() — Get latest status from processor

RefundService (sub-service)
├── refund() — Create a refund for a captured payment
└── sync() — Check refund status

RecurringPaymentService (sub-service)
├── charge() — Charge a stored payment method
└── revoke() — Cancel a recurring authorization

DisputeService (sub-service)
├── accept() — Accept a chargeback
├── defend() — Challenge a dispute
└── submit_evidence() — Upload dispute evidence

Why Sub-Services Exist

A refund isn't a standalone operation. It requires a payment that was already captured. A recurring charge requires a payment method setup. A dispute arises from an existing transaction.

Prism models this dependency explicitly:

Operation
Requires
Provided By

RefundService.refund()

A captured payment

PaymentService.capture()

RecurringPaymentService.charge()

A stored payment method

PaymentService.setup_mandate()

DisputeService.accept()

A disputed transaction

Payment processor notification

This hierarchy prevents invalid state transitions. You can't refund a payment that was never captured. The service structure enforces this at the API level.

PaymentService: The Core

PaymentService handles the primary payment lifecycle:

RefundService: Follow-On Operations

RefundService operates on captured payments. You can call it directly or through PaymentService.refund():

Both approaches create the same refund. The PaymentService method is a convenience wrapper.

RefundService also handles sync operations to check refund status:

RecurringPaymentService: Stored Payment Operations

RecurringPaymentService manages operations on stored payment methods:

DisputeService: Chargeback Management

DisputeService handles chargebacks and disputes:

Service Reference

Service
Primary Operations
Documentation

PaymentService

authorize, capture, void, refund, sync

RefundService

refund, sync

RecurringPaymentService

charge, revoke

DisputeService

accept, defend, submit_evidence

EventService

handle

CustomerService

create

Method Naming Conventions

Methods follow verb-noun patterns that describe the action:

  • authorize: Start authorization, hold funds

  • capture: Complete authorization, transfer funds

  • void: Cancel authorization, release funds

  • refund: Return captured funds

  • sync: Synchronize status with processor

  • setup_mandate: Create recurring payment authorization

  • charge: Execute payment using stored method

This naming is consistent across all connectors. Stripe calls it "capture." Adyen calls it "capture." Prism calls it capture() everywhere.

Last updated

Was this helpful?