@spritz-finance/api-client 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -82,6 +82,7 @@ const transactionData = await client.paymentRequest.getWeb3PaymentParams({
82
82
  - [Transaction Fees](#transaction-fees)
83
83
  - [Retrieving Payments](#retrieving-payments)
84
84
  - [Payment Limits](#payment-limits)
85
+ - [Refunding a Payment](#refunding-a-payment)
85
86
  - [On-ramp](#on-ramp)
86
87
  - [Prerequisites](#prerequisites)
87
88
  - [Checking User Access](#checking-user-access)
@@ -819,6 +820,33 @@ const limits = await client.payment.getPaymentLimits(account.id)
819
820
  }
820
821
  ```
821
822
 
823
+ ### Refunding a Payment
824
+
825
+ A **failed** off-ramp payment can be refunded, either by returning the funds to the user's Spritz balance or by reissuing the payout to a bank account.
826
+
827
+ ```typescript
828
+ // Reissue the payout to a different bank account
829
+ await client.offramp.refund(offRampId, {
830
+ method: 'account',
831
+ accountId: '6a5f75585a936eb477232f05',
832
+ })
833
+
834
+ // Reissue to the off-ramp's original destination account
835
+ await client.offramp.refund(offRampId, { method: 'account' })
836
+
837
+ // Return the funds to the user's Spritz balance
838
+ await client.offramp.refund(offRampId, { method: 'credit' })
839
+ ```
840
+
841
+ | Field | Type | Description |
842
+ | ----------- | ----------------------- | ---------------------------------------------------------------------------------------- |
843
+ | `method` | `'account' \| 'credit'` | `account` reissues the payout to a bank account; `credit` returns funds to the balance |
844
+ | `accountId` | `string` (optional) | Only with `method: 'account'`. Omit to reuse the off-ramp's original destination account |
845
+
846
+ Only failed off-ramps settled through Modern Treasury or Checkbook are refundable — anything else is rejected. The response is the updated off-ramp record, with `status` moving to `refunded`.
847
+
848
+ > **Retries:** the platform recommends an `Idempotency-Key` header so a retried request replays the original response rather than returning a stale "not refundable" error. The client does not currently send one, so if a refund request times out, re-fetch the off-ramp and check its `status` before issuing another.
849
+
822
850
  ## On-ramp
823
851
 
824
852
  The on-ramp feature allows users to purchase crypto stablecoins via ACH or wire transfer.