@delopay/sdk 0.49.0 → 0.50.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/dist/index.cjs CHANGED
@@ -1135,6 +1135,37 @@ var Payments = class {
1135
1135
  if (Object.keys(query).length === 0) return this.request("GET", path);
1136
1136
  return this.request("GET", path, { query });
1137
1137
  }
1138
+ /**
1139
+ * List every attempt made on a payment, each with its full failure detail
1140
+ * (`error_code` / `error_message`, the Delopay-unified `unified_code` and
1141
+ * `unified_message`, and structured `error_details`).
1142
+ *
1143
+ * Useful for surfacing retries across connectors — e.g. "attempt 1 stripe →
1144
+ * insufficient_funds, attempt 2 adyen → success".
1145
+ *
1146
+ * `GET /payments/{paymentId}/attempts`
1147
+ *
1148
+ * @param paymentId - The payment intent ID whose attempts to list.
1149
+ * @param options - Optional per-call extras: extra `headers`, a `timeout`
1150
+ * override, and an `AbortSignal`.
1151
+ * @returns The attempt list — `size` plus a `data` array of attempts.
1152
+ * @throws If the payment does not exist or belongs to another merchant (404).
1153
+ *
1154
+ * @example
1155
+ * ```typescript
1156
+ * const { size, data } = await delopay.payments.listAttempts('pay_abc123');
1157
+ * for (const attempt of data) {
1158
+ * console.log(attempt.status, attempt.unified_message ?? attempt.error_message);
1159
+ * }
1160
+ * ```
1161
+ */
1162
+ async listAttempts(paymentId, options) {
1163
+ return this.request(
1164
+ "GET",
1165
+ `/payments/${encodeURIComponent(paymentId)}/attempts`,
1166
+ options
1167
+ );
1168
+ }
1138
1169
  /**
1139
1170
  * Update an existing payment intent before it is confirmed.
1140
1171
  *