@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/README.md +17 -0
- package/dist/{chunk-ABYAZHZC.js → chunk-P45MMRTD.js} +32 -1
- package/dist/chunk-P45MMRTD.js.map +1 -0
- package/dist/index.cjs +31 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +100 -1
- package/dist/index.d.ts +100 -1
- package/dist/index.js +1 -1
- package/dist/internal.cjs +31 -0
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ABYAZHZC.js.map +0 -1
package/README.md
CHANGED
|
@@ -146,6 +146,23 @@ for (const dispute of payment.disputes ?? []) {
|
|
|
146
146
|
const open = await delopay.disputes.list({ dispute_status: 'dispute_opened' });
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
+
### Inspect why a payment failed
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// Every attempt on a payment — including retries across connectors — with its
|
|
153
|
+
// full failure detail (raw code + Delopay-unified, human-readable reason).
|
|
154
|
+
const { size, data } = await delopay.payments.listAttempts('pay_abc123');
|
|
155
|
+
|
|
156
|
+
for (const attempt of data) {
|
|
157
|
+
// e.g. "stripe failure — Insufficient funds (51)"
|
|
158
|
+
console.log(
|
|
159
|
+
`${attempt.connector ?? 'unknown'} ${attempt.status} — ` +
|
|
160
|
+
`${attempt.unified_message ?? attempt.error_message ?? 'no error'}` +
|
|
161
|
+
`${attempt.error_code ? ` (${attempt.error_code})` : ''}`,
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
149
166
|
### Manage shops and gateways
|
|
150
167
|
|
|
151
168
|
```typescript
|
|
@@ -1060,6 +1060,37 @@ var Payments = class {
|
|
|
1060
1060
|
if (Object.keys(query).length === 0) return this.request("GET", path);
|
|
1061
1061
|
return this.request("GET", path, { query });
|
|
1062
1062
|
}
|
|
1063
|
+
/**
|
|
1064
|
+
* List every attempt made on a payment, each with its full failure detail
|
|
1065
|
+
* (`error_code` / `error_message`, the Delopay-unified `unified_code` and
|
|
1066
|
+
* `unified_message`, and structured `error_details`).
|
|
1067
|
+
*
|
|
1068
|
+
* Useful for surfacing retries across connectors — e.g. "attempt 1 stripe →
|
|
1069
|
+
* insufficient_funds, attempt 2 adyen → success".
|
|
1070
|
+
*
|
|
1071
|
+
* `GET /payments/{paymentId}/attempts`
|
|
1072
|
+
*
|
|
1073
|
+
* @param paymentId - The payment intent ID whose attempts to list.
|
|
1074
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
1075
|
+
* override, and an `AbortSignal`.
|
|
1076
|
+
* @returns The attempt list — `size` plus a `data` array of attempts.
|
|
1077
|
+
* @throws If the payment does not exist or belongs to another merchant (404).
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* ```typescript
|
|
1081
|
+
* const { size, data } = await delopay.payments.listAttempts('pay_abc123');
|
|
1082
|
+
* for (const attempt of data) {
|
|
1083
|
+
* console.log(attempt.status, attempt.unified_message ?? attempt.error_message);
|
|
1084
|
+
* }
|
|
1085
|
+
* ```
|
|
1086
|
+
*/
|
|
1087
|
+
async listAttempts(paymentId, options) {
|
|
1088
|
+
return this.request(
|
|
1089
|
+
"GET",
|
|
1090
|
+
`/payments/${encodeURIComponent(paymentId)}/attempts`,
|
|
1091
|
+
options
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1063
1094
|
/**
|
|
1064
1095
|
* Update an existing payment intent before it is confirmed.
|
|
1065
1096
|
*
|
|
@@ -4024,4 +4055,4 @@ export {
|
|
|
4024
4055
|
applyBrandingVariables,
|
|
4025
4056
|
shadowFor
|
|
4026
4057
|
};
|
|
4027
|
-
//# sourceMappingURL=chunk-
|
|
4058
|
+
//# sourceMappingURL=chunk-P45MMRTD.js.map
|