Paysafe.Payments.Refunds (Paysafe v1.0.0)

Copy Markdown View Source

Refund operations for the Paysafe Payments API.

Refunds return funds to the customer after a completed payment or settlement. Full and partial refunds are supported. Multiple partial refunds can be issued up to the original payment amount.

Important: refunds are addressed by settlement ID, not payment ID

Base path: /paymenthub/v1/settlements/{settlementId}/refunds.

If settle_with_auth was true on the original payment, the settlement ID is the same value as the payment ID — pass it directly. If you settled separately afterwards, pass the settlement ID returned by Paysafe.Payments.Settlements.create/4, not the original payment ID.

Don't mix refund paths on the same transaction

If you've already issued a partial refund against a settlement, you cannot also issue a subsequent refund using a different settlement ID tied to the same payment. Stick to one settlement ID per transaction's refund history.

Summary

Functions

Cancel a pending refund.

Issue a refund for a completed payment or settlement.

Retrieve a refund by ID.

Functions

cancel(config, refund_id, opts \\ [])

@spec cancel(Paysafe.Config.t(), String.t(), keyword()) ::
  {:ok, Paysafe.Types.Refund.t()} | {:error, Paysafe.Error.t()}

Cancel a pending refund.

create(config, settlement_id, params, opts \\ [])

@spec create(Paysafe.Config.t(), String.t(), map(), keyword()) ::
  {:ok, Paysafe.Types.Refund.t()} | {:error, Paysafe.Error.t()}

Issue a refund for a completed payment or settlement.

Parameters

  • :merchant_ref_num (required) — Unique reference.
  • :amount — Amount to refund in minor units (defaults to full amount).
  • :settlement_id (required) — ID of the completed settlement (or payment ID, if settle_with_auth was true).

get(config, refund_id, opts \\ [])

@spec get(Paysafe.Config.t(), String.t(), keyword()) ::
  {:ok, Paysafe.Types.Refund.t()} | {:error, Paysafe.Error.t()}

Retrieve a refund by ID.