@metronome/sdk 3.5.0 → 3.7.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.
Files changed (307) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/bin/cli +12 -5
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts.map +1 -1
  11. package/client.js +11 -0
  12. package/client.js.map +1 -1
  13. package/client.mjs +11 -0
  14. package/client.mjs.map +1 -1
  15. package/core/api-promise.d.mts.map +1 -1
  16. package/core/api-promise.d.ts.map +1 -1
  17. package/core/api-promise.mjs.map +1 -1
  18. package/core/error.mjs.map +1 -1
  19. package/core/pagination.d.mts.map +1 -1
  20. package/core/pagination.d.ts.map +1 -1
  21. package/core/pagination.mjs.map +1 -1
  22. package/core/resource.d.mts.map +1 -1
  23. package/core/resource.d.ts.map +1 -1
  24. package/core/uploads.d.mts.map +1 -1
  25. package/core/uploads.d.ts.map +1 -1
  26. package/core/uploads.mjs.map +1 -1
  27. package/error.d.mts +1 -0
  28. package/error.d.mts.map +1 -1
  29. package/error.d.ts +1 -0
  30. package/error.d.ts.map +1 -1
  31. package/error.mjs +1 -0
  32. package/error.mjs.map +1 -1
  33. package/index.d.mts.map +1 -1
  34. package/index.d.ts.map +1 -1
  35. package/index.mjs.map +1 -1
  36. package/internal/detect-platform.mjs.map +1 -1
  37. package/internal/headers.mjs.map +1 -1
  38. package/internal/parse.d.mts.map +1 -1
  39. package/internal/parse.d.ts.map +1 -1
  40. package/internal/parse.mjs.map +1 -1
  41. package/internal/qs/formats.d.mts.map +1 -1
  42. package/internal/qs/formats.d.ts.map +1 -1
  43. package/internal/qs/index.d.mts +2 -2
  44. package/internal/qs/index.d.mts.map +1 -1
  45. package/internal/qs/index.d.ts +2 -2
  46. package/internal/qs/index.d.ts.map +1 -1
  47. package/internal/qs/index.mjs.map +1 -1
  48. package/internal/qs/stringify.d.mts.map +1 -1
  49. package/internal/qs/stringify.d.ts.map +1 -1
  50. package/internal/qs/stringify.mjs.map +1 -1
  51. package/internal/qs/utils.d.mts.map +1 -1
  52. package/internal/qs/utils.d.ts.map +1 -1
  53. package/internal/qs/utils.mjs.map +1 -1
  54. package/internal/request-options.d.mts.map +1 -1
  55. package/internal/request-options.d.ts.map +1 -1
  56. package/internal/shims.d.mts +6 -0
  57. package/internal/shims.d.mts.map +1 -1
  58. package/internal/shims.d.ts +6 -0
  59. package/internal/shims.d.ts.map +1 -1
  60. package/internal/to-file.d.mts.map +1 -1
  61. package/internal/to-file.d.ts.map +1 -1
  62. package/internal/to-file.mjs.map +1 -1
  63. package/internal/types.d.mts +10 -10
  64. package/internal/types.d.mts.map +1 -1
  65. package/internal/types.d.ts +10 -10
  66. package/internal/types.d.ts.map +1 -1
  67. package/internal/uploads.d.mts.map +1 -1
  68. package/internal/uploads.d.ts.map +1 -1
  69. package/internal/uploads.mjs.map +1 -1
  70. package/internal/utils/base64.mjs.map +1 -1
  71. package/internal/utils/log.d.mts.map +1 -1
  72. package/internal/utils/log.d.ts.map +1 -1
  73. package/internal/utils/log.js +2 -0
  74. package/internal/utils/log.js.map +1 -1
  75. package/internal/utils/log.mjs +2 -0
  76. package/internal/utils/log.mjs.map +1 -1
  77. package/internal/utils/path.mjs.map +1 -1
  78. package/internal/utils/query.mjs.map +1 -1
  79. package/internal/utils/values.mjs.map +1 -1
  80. package/internal/utils.d.mts.map +1 -1
  81. package/internal/utils.d.ts.map +1 -1
  82. package/internal/utils.mjs.map +1 -1
  83. package/package.json +1 -1
  84. package/pagination.d.mts +1 -0
  85. package/pagination.d.mts.map +1 -1
  86. package/pagination.d.ts +1 -0
  87. package/pagination.d.ts.map +1 -1
  88. package/pagination.mjs +1 -0
  89. package/pagination.mjs.map +1 -1
  90. package/resource.d.mts +1 -0
  91. package/resource.d.mts.map +1 -1
  92. package/resource.d.ts +1 -0
  93. package/resource.d.ts.map +1 -1
  94. package/resource.mjs +1 -0
  95. package/resource.mjs.map +1 -1
  96. package/resources/index.d.mts.map +1 -1
  97. package/resources/index.d.ts.map +1 -1
  98. package/resources/index.mjs.map +1 -1
  99. package/resources/shared.d.mts +321 -1
  100. package/resources/shared.d.mts.map +1 -1
  101. package/resources/shared.d.ts +321 -1
  102. package/resources/shared.d.ts.map +1 -1
  103. package/resources/v1/alerts.d.mts +1 -1
  104. package/resources/v1/alerts.d.mts.map +1 -1
  105. package/resources/v1/alerts.d.ts +1 -1
  106. package/resources/v1/alerts.d.ts.map +1 -1
  107. package/resources/v1/alerts.mjs.map +1 -1
  108. package/resources/v1/audit-logs.d.mts.map +1 -1
  109. package/resources/v1/audit-logs.d.ts.map +1 -1
  110. package/resources/v1/audit-logs.mjs.map +1 -1
  111. package/resources/v1/billable-metrics.d.mts.map +1 -1
  112. package/resources/v1/billable-metrics.d.ts.map +1 -1
  113. package/resources/v1/billable-metrics.mjs.map +1 -1
  114. package/resources/v1/contracts/contracts.d.mts +629 -143
  115. package/resources/v1/contracts/contracts.d.mts.map +1 -1
  116. package/resources/v1/contracts/contracts.d.ts +629 -143
  117. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  118. package/resources/v1/contracts/contracts.js +47 -2
  119. package/resources/v1/contracts/contracts.js.map +1 -1
  120. package/resources/v1/contracts/contracts.mjs +47 -2
  121. package/resources/v1/contracts/contracts.mjs.map +1 -1
  122. package/resources/v1/contracts/index.d.mts +1 -1
  123. package/resources/v1/contracts/index.d.mts.map +1 -1
  124. package/resources/v1/contracts/index.d.ts +1 -1
  125. package/resources/v1/contracts/index.d.ts.map +1 -1
  126. package/resources/v1/contracts/index.js.map +1 -1
  127. package/resources/v1/contracts/index.mjs.map +1 -1
  128. package/resources/v1/contracts/named-schedules.d.mts.map +1 -1
  129. package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
  130. package/resources/v1/contracts/named-schedules.mjs.map +1 -1
  131. package/resources/v1/contracts/products.d.mts +18 -0
  132. package/resources/v1/contracts/products.d.mts.map +1 -1
  133. package/resources/v1/contracts/products.d.ts +18 -0
  134. package/resources/v1/contracts/products.d.ts.map +1 -1
  135. package/resources/v1/contracts/products.mjs.map +1 -1
  136. package/resources/v1/contracts/rate-cards/index.d.mts.map +1 -1
  137. package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
  138. package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
  139. package/resources/v1/contracts/rate-cards/named-schedules.d.mts.map +1 -1
  140. package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
  141. package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
  142. package/resources/v1/contracts/rate-cards/product-orders.d.mts.map +1 -1
  143. package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
  144. package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
  145. package/resources/v1/contracts/rate-cards/rate-cards.d.mts.map +1 -1
  146. package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
  147. package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
  148. package/resources/v1/contracts/rate-cards/rates.d.mts.map +1 -1
  149. package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
  150. package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
  151. package/resources/v1/contracts/rate-cards.d.mts.map +1 -1
  152. package/resources/v1/contracts/rate-cards.d.ts.map +1 -1
  153. package/resources/v1/contracts/rate-cards.mjs.map +1 -1
  154. package/resources/v1/contracts.d.mts.map +1 -1
  155. package/resources/v1/contracts.d.ts.map +1 -1
  156. package/resources/v1/contracts.mjs.map +1 -1
  157. package/resources/v1/credit-grants.d.mts.map +1 -1
  158. package/resources/v1/credit-grants.d.ts.map +1 -1
  159. package/resources/v1/credit-grants.mjs.map +1 -1
  160. package/resources/v1/custom-fields.d.mts.map +1 -1
  161. package/resources/v1/custom-fields.d.ts.map +1 -1
  162. package/resources/v1/custom-fields.mjs.map +1 -1
  163. package/resources/v1/customers/alerts.d.mts +1 -1
  164. package/resources/v1/customers/alerts.d.mts.map +1 -1
  165. package/resources/v1/customers/alerts.d.ts +1 -1
  166. package/resources/v1/customers/alerts.d.ts.map +1 -1
  167. package/resources/v1/customers/alerts.mjs.map +1 -1
  168. package/resources/v1/customers/billing-config.d.mts.map +1 -1
  169. package/resources/v1/customers/billing-config.d.ts.map +1 -1
  170. package/resources/v1/customers/billing-config.mjs.map +1 -1
  171. package/resources/v1/customers/commits.d.mts.map +1 -1
  172. package/resources/v1/customers/commits.d.ts.map +1 -1
  173. package/resources/v1/customers/commits.mjs.map +1 -1
  174. package/resources/v1/customers/credits.d.mts.map +1 -1
  175. package/resources/v1/customers/credits.d.ts.map +1 -1
  176. package/resources/v1/customers/credits.mjs.map +1 -1
  177. package/resources/v1/customers/customers.d.mts.map +1 -1
  178. package/resources/v1/customers/customers.d.ts.map +1 -1
  179. package/resources/v1/customers/customers.mjs.map +1 -1
  180. package/resources/v1/customers/index.d.mts.map +1 -1
  181. package/resources/v1/customers/index.d.ts.map +1 -1
  182. package/resources/v1/customers/index.mjs.map +1 -1
  183. package/resources/v1/customers/invoices.d.mts +9 -0
  184. package/resources/v1/customers/invoices.d.mts.map +1 -1
  185. package/resources/v1/customers/invoices.d.ts +9 -0
  186. package/resources/v1/customers/invoices.d.ts.map +1 -1
  187. package/resources/v1/customers/invoices.mjs.map +1 -1
  188. package/resources/v1/customers/named-schedules.d.mts.map +1 -1
  189. package/resources/v1/customers/named-schedules.d.ts.map +1 -1
  190. package/resources/v1/customers/named-schedules.mjs.map +1 -1
  191. package/resources/v1/customers/plans.d.mts.map +1 -1
  192. package/resources/v1/customers/plans.d.ts.map +1 -1
  193. package/resources/v1/customers/plans.mjs.map +1 -1
  194. package/resources/v1/customers.d.mts.map +1 -1
  195. package/resources/v1/customers.d.ts.map +1 -1
  196. package/resources/v1/customers.mjs.map +1 -1
  197. package/resources/v1/dashboards.d.mts.map +1 -1
  198. package/resources/v1/dashboards.d.ts.map +1 -1
  199. package/resources/v1/dashboards.mjs.map +1 -1
  200. package/resources/v1/index.d.mts +1 -2
  201. package/resources/v1/index.d.mts.map +1 -1
  202. package/resources/v1/index.d.ts +1 -2
  203. package/resources/v1/index.d.ts.map +1 -1
  204. package/resources/v1/index.js +1 -3
  205. package/resources/v1/index.js.map +1 -1
  206. package/resources/v1/index.mjs +0 -1
  207. package/resources/v1/index.mjs.map +1 -1
  208. package/resources/v1/invoices.d.mts.map +1 -1
  209. package/resources/v1/invoices.d.ts.map +1 -1
  210. package/resources/v1/invoices.mjs.map +1 -1
  211. package/resources/v1/packages.d.mts +57 -5
  212. package/resources/v1/packages.d.mts.map +1 -1
  213. package/resources/v1/packages.d.ts +57 -5
  214. package/resources/v1/packages.d.ts.map +1 -1
  215. package/resources/v1/packages.js +3 -4
  216. package/resources/v1/packages.js.map +1 -1
  217. package/resources/v1/packages.mjs +3 -4
  218. package/resources/v1/packages.mjs.map +1 -1
  219. package/resources/v1/plans.d.mts.map +1 -1
  220. package/resources/v1/plans.d.ts.map +1 -1
  221. package/resources/v1/plans.mjs.map +1 -1
  222. package/resources/v1/pricing-units.d.mts.map +1 -1
  223. package/resources/v1/pricing-units.d.ts.map +1 -1
  224. package/resources/v1/pricing-units.mjs.map +1 -1
  225. package/resources/v1/services.d.mts.map +1 -1
  226. package/resources/v1/services.d.ts.map +1 -1
  227. package/resources/v1/services.mjs.map +1 -1
  228. package/resources/v1/settings/billing-providers.d.mts.map +1 -1
  229. package/resources/v1/settings/billing-providers.d.ts.map +1 -1
  230. package/resources/v1/settings/billing-providers.mjs.map +1 -1
  231. package/resources/v1/settings/index.d.mts.map +1 -1
  232. package/resources/v1/settings/index.d.ts.map +1 -1
  233. package/resources/v1/settings/index.mjs.map +1 -1
  234. package/resources/v1/settings/settings.d.mts.map +1 -1
  235. package/resources/v1/settings/settings.d.ts.map +1 -1
  236. package/resources/v1/settings/settings.mjs.map +1 -1
  237. package/resources/v1/settings.d.mts.map +1 -1
  238. package/resources/v1/settings.d.ts.map +1 -1
  239. package/resources/v1/settings.mjs.map +1 -1
  240. package/resources/v1/usage.d.mts.map +1 -1
  241. package/resources/v1/usage.d.ts.map +1 -1
  242. package/resources/v1/usage.mjs.map +1 -1
  243. package/resources/v1/v1.d.mts +2 -6
  244. package/resources/v1/v1.d.mts.map +1 -1
  245. package/resources/v1/v1.d.ts +2 -6
  246. package/resources/v1/v1.d.ts.map +1 -1
  247. package/resources/v1/v1.js +0 -4
  248. package/resources/v1/v1.js.map +1 -1
  249. package/resources/v1/v1.mjs +0 -4
  250. package/resources/v1/v1.mjs.map +1 -1
  251. package/resources/v1.d.mts.map +1 -1
  252. package/resources/v1.d.ts.map +1 -1
  253. package/resources/v1.mjs.map +1 -1
  254. package/resources/v2/contracts.d.mts +1431 -2
  255. package/resources/v2/contracts.d.mts.map +1 -1
  256. package/resources/v2/contracts.d.ts +1431 -2
  257. package/resources/v2/contracts.d.ts.map +1 -1
  258. package/resources/v2/contracts.mjs.map +1 -1
  259. package/resources/v2/index.d.mts.map +1 -1
  260. package/resources/v2/index.d.ts.map +1 -1
  261. package/resources/v2/index.mjs.map +1 -1
  262. package/resources/v2/v2.d.mts.map +1 -1
  263. package/resources/v2/v2.d.ts.map +1 -1
  264. package/resources/v2/v2.mjs.map +1 -1
  265. package/resources/v2.d.mts.map +1 -1
  266. package/resources/v2.d.ts.map +1 -1
  267. package/resources/v2.mjs.map +1 -1
  268. package/resources/webhooks.d.mts.map +1 -1
  269. package/resources/webhooks.d.ts.map +1 -1
  270. package/resources/webhooks.mjs.map +1 -1
  271. package/resources.d.mts.map +1 -1
  272. package/resources.d.ts.map +1 -1
  273. package/resources.mjs.map +1 -1
  274. package/src/client.ts +12 -0
  275. package/src/internal/types.ts +6 -8
  276. package/src/internal/utils/log.ts +2 -0
  277. package/src/resources/shared.ts +417 -1
  278. package/src/resources/v1/alerts.ts +1 -1
  279. package/src/resources/v1/contracts/contracts.ts +813 -156
  280. package/src/resources/v1/contracts/index.ts +2 -0
  281. package/src/resources/v1/contracts/products.ts +20 -0
  282. package/src/resources/v1/customers/alerts.ts +1 -1
  283. package/src/resources/v1/customers/invoices.ts +12 -0
  284. package/src/resources/v1/index.ts +2 -11
  285. package/src/resources/v1/packages.ts +81 -6
  286. package/src/resources/v1/v1.ts +4 -26
  287. package/src/resources/v2/contracts.ts +1881 -2
  288. package/src/version.ts +1 -1
  289. package/uploads.d.mts +1 -0
  290. package/uploads.d.mts.map +1 -1
  291. package/uploads.d.ts +1 -0
  292. package/uploads.d.ts.map +1 -1
  293. package/uploads.mjs +1 -0
  294. package/uploads.mjs.map +1 -1
  295. package/version.d.mts +1 -1
  296. package/version.d.ts +1 -1
  297. package/version.js +1 -1
  298. package/version.mjs +1 -1
  299. package/resources/v1/payments.d.mts +0 -127
  300. package/resources/v1/payments.d.mts.map +0 -1
  301. package/resources/v1/payments.d.ts +0 -127
  302. package/resources/v1/payments.d.ts.map +0 -1
  303. package/resources/v1/payments.js +0 -71
  304. package/resources/v1/payments.js.map +0 -1
  305. package/resources/v1/payments.mjs +0 -67
  306. package/resources/v1/payments.mjs.map +0 -1
  307. package/src/resources/v1/payments.ts +0 -187
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.5.0'; // x-release-please-version
1
+ export const VERSION = '3.7.0'; // x-release-please-version
package/uploads.d.mts CHANGED
@@ -1,2 +1,3 @@
1
+ /** @deprecated Import from ./core/uploads instead */
1
2
  export * from "./core/uploads.mjs";
2
3
  //# sourceMappingURL=uploads.d.mts.map
package/uploads.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"uploads.d.mts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,mCAA+B"}
package/uploads.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ /** @deprecated Import from ./core/uploads instead */
1
2
  export * from "./core/uploads.js";
2
3
  //# sourceMappingURL=uploads.d.ts.map
package/uploads.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,kCAA+B"}
package/uploads.mjs CHANGED
@@ -1,2 +1,3 @@
1
+ /** @deprecated Import from ./core/uploads instead */
1
2
  export * from "./core/uploads.mjs";
2
3
  //# sourceMappingURL=uploads.mjs.map
package/uploads.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,mCAA+B"}
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.5.0";
1
+ export declare const VERSION = "3.7.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.5.0";
1
+ export declare const VERSION = "3.7.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '3.5.0'; // x-release-please-version
4
+ exports.VERSION = '3.7.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.5.0'; // x-release-please-version
1
+ export const VERSION = '3.7.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
@@ -1,127 +0,0 @@
1
- import { APIResource } from "../../core/resource.mjs";
2
- import * as Shared from "../shared.mjs";
3
- import { APIPromise } from "../../core/api-promise.mjs";
4
- import { BodyCursorPage, type BodyCursorPageParams, PagePromise } from "../../core/pagination.mjs";
5
- import { RequestOptions } from "../../internal/request-options.mjs";
6
- export declare class Payments extends APIResource {
7
- /**
8
- * Fetch all payment attempts for the given invoice.
9
- *
10
- * @example
11
- * ```ts
12
- * // Automatically fetches more pages as needed.
13
- * for await (const payment of client.v1.payments.list({
14
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
15
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
16
- * statuses: ['pending', 'requires_intervention'],
17
- * })) {
18
- * // ...
19
- * }
20
- * ```
21
- */
22
- list(body: PaymentListParams, options?: RequestOptions): PagePromise<PaymentsBodyCursorPage, Payment>;
23
- /**
24
- * Trigger a new attempt by canceling any existing attempts for this invoice and
25
- * creating a new Payment. This will trigger another attempt to charge the
26
- * Customer's configured Payment Gateway. Payment can only be attempted if all of
27
- * the following are true:
28
- *
29
- * - The Metronome Invoice is finalized
30
- * - PLG Invoicing is configured for the Customer
31
- * - You cannot attempt payments for invoices that have already been `paid` or
32
- * `voided`.
33
- *
34
- * Attempting to payment on an ineligible Invoice or Customer will result in a
35
- * `400` response.
36
- *
37
- * @example
38
- * ```ts
39
- * const response = await client.v1.payments.attempt({
40
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
41
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
42
- * });
43
- * ```
44
- */
45
- attempt(body: PaymentAttemptParams, options?: RequestOptions): APIPromise<PaymentAttemptResponse>;
46
- /**
47
- * Cancel an existing payment attempt for an invoice.
48
- *
49
- * @example
50
- * ```ts
51
- * const response = await client.v1.payments.cancel({
52
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
53
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
54
- * });
55
- * ```
56
- */
57
- cancel(body: PaymentCancelParams, options?: RequestOptions): APIPromise<PaymentCancelResponse>;
58
- }
59
- export type PaymentsBodyCursorPage = BodyCursorPage<Payment>;
60
- export interface Payment {
61
- id: string;
62
- amount?: number;
63
- amount_paid?: number;
64
- contract_id?: string;
65
- created_at?: string;
66
- customer_id?: string;
67
- error_message?: string;
68
- fiat_credit_type?: Shared.CreditTypeData;
69
- invoice_id?: string;
70
- payment_gateway?: Payment.PaymentGateway;
71
- revenue_system_payments?: Array<Payment.RevenueSystemPayment>;
72
- status?: PaymentStatus;
73
- updated_at?: string;
74
- }
75
- export declare namespace Payment {
76
- interface PaymentGateway {
77
- stripe: PaymentGateway.Stripe;
78
- type: 'stripe';
79
- }
80
- namespace PaymentGateway {
81
- interface Stripe {
82
- payment_intent_id: string;
83
- error?: Stripe.Error;
84
- payment_method_id?: string;
85
- }
86
- namespace Stripe {
87
- interface Error {
88
- code?: string;
89
- decline_code?: string;
90
- type?: string;
91
- }
92
- }
93
- }
94
- interface RevenueSystemPayment {
95
- revenue_system_provider: string;
96
- sync_status: string;
97
- /**
98
- * The error message from the revenue system, if available.
99
- */
100
- error_message?: string;
101
- revenue_system_external_payment_id?: string;
102
- }
103
- }
104
- export type PaymentStatus = 'pending' | 'requires_intervention' | 'paid' | 'canceled';
105
- export interface PaymentAttemptResponse {
106
- data: Payment;
107
- }
108
- export interface PaymentCancelResponse {
109
- data: Payment;
110
- }
111
- export interface PaymentListParams extends BodyCursorPageParams {
112
- customer_id: string;
113
- invoice_id: string;
114
- statuses?: Array<PaymentStatus>;
115
- }
116
- export interface PaymentAttemptParams {
117
- customer_id: string;
118
- invoice_id: string;
119
- }
120
- export interface PaymentCancelParams {
121
- customer_id: string;
122
- invoice_id: string;
123
- }
124
- export declare namespace Payments {
125
- export { type Payment as Payment, type PaymentStatus as PaymentStatus, type PaymentAttemptResponse as PaymentAttemptResponse, type PaymentCancelResponse as PaymentCancelResponse, type PaymentsBodyCursorPage as PaymentsBodyCursorPage, type PaymentListParams as PaymentListParams, type PaymentAttemptParams as PaymentAttemptParams, type PaymentCancelParams as PaymentCancelParams, };
126
- }
127
- //# sourceMappingURL=payments.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payments.d.mts","sourceRoot":"","sources":["../../src/resources/v1/payments.ts"],"names":[],"mappings":"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"}
@@ -1,127 +0,0 @@
1
- import { APIResource } from "../../core/resource.js";
2
- import * as Shared from "../shared.js";
3
- import { APIPromise } from "../../core/api-promise.js";
4
- import { BodyCursorPage, type BodyCursorPageParams, PagePromise } from "../../core/pagination.js";
5
- import { RequestOptions } from "../../internal/request-options.js";
6
- export declare class Payments extends APIResource {
7
- /**
8
- * Fetch all payment attempts for the given invoice.
9
- *
10
- * @example
11
- * ```ts
12
- * // Automatically fetches more pages as needed.
13
- * for await (const payment of client.v1.payments.list({
14
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
15
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
16
- * statuses: ['pending', 'requires_intervention'],
17
- * })) {
18
- * // ...
19
- * }
20
- * ```
21
- */
22
- list(body: PaymentListParams, options?: RequestOptions): PagePromise<PaymentsBodyCursorPage, Payment>;
23
- /**
24
- * Trigger a new attempt by canceling any existing attempts for this invoice and
25
- * creating a new Payment. This will trigger another attempt to charge the
26
- * Customer's configured Payment Gateway. Payment can only be attempted if all of
27
- * the following are true:
28
- *
29
- * - The Metronome Invoice is finalized
30
- * - PLG Invoicing is configured for the Customer
31
- * - You cannot attempt payments for invoices that have already been `paid` or
32
- * `voided`.
33
- *
34
- * Attempting to payment on an ineligible Invoice or Customer will result in a
35
- * `400` response.
36
- *
37
- * @example
38
- * ```ts
39
- * const response = await client.v1.payments.attempt({
40
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
41
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
42
- * });
43
- * ```
44
- */
45
- attempt(body: PaymentAttemptParams, options?: RequestOptions): APIPromise<PaymentAttemptResponse>;
46
- /**
47
- * Cancel an existing payment attempt for an invoice.
48
- *
49
- * @example
50
- * ```ts
51
- * const response = await client.v1.payments.cancel({
52
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
53
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
54
- * });
55
- * ```
56
- */
57
- cancel(body: PaymentCancelParams, options?: RequestOptions): APIPromise<PaymentCancelResponse>;
58
- }
59
- export type PaymentsBodyCursorPage = BodyCursorPage<Payment>;
60
- export interface Payment {
61
- id: string;
62
- amount?: number;
63
- amount_paid?: number;
64
- contract_id?: string;
65
- created_at?: string;
66
- customer_id?: string;
67
- error_message?: string;
68
- fiat_credit_type?: Shared.CreditTypeData;
69
- invoice_id?: string;
70
- payment_gateway?: Payment.PaymentGateway;
71
- revenue_system_payments?: Array<Payment.RevenueSystemPayment>;
72
- status?: PaymentStatus;
73
- updated_at?: string;
74
- }
75
- export declare namespace Payment {
76
- interface PaymentGateway {
77
- stripe: PaymentGateway.Stripe;
78
- type: 'stripe';
79
- }
80
- namespace PaymentGateway {
81
- interface Stripe {
82
- payment_intent_id: string;
83
- error?: Stripe.Error;
84
- payment_method_id?: string;
85
- }
86
- namespace Stripe {
87
- interface Error {
88
- code?: string;
89
- decline_code?: string;
90
- type?: string;
91
- }
92
- }
93
- }
94
- interface RevenueSystemPayment {
95
- revenue_system_provider: string;
96
- sync_status: string;
97
- /**
98
- * The error message from the revenue system, if available.
99
- */
100
- error_message?: string;
101
- revenue_system_external_payment_id?: string;
102
- }
103
- }
104
- export type PaymentStatus = 'pending' | 'requires_intervention' | 'paid' | 'canceled';
105
- export interface PaymentAttemptResponse {
106
- data: Payment;
107
- }
108
- export interface PaymentCancelResponse {
109
- data: Payment;
110
- }
111
- export interface PaymentListParams extends BodyCursorPageParams {
112
- customer_id: string;
113
- invoice_id: string;
114
- statuses?: Array<PaymentStatus>;
115
- }
116
- export interface PaymentAttemptParams {
117
- customer_id: string;
118
- invoice_id: string;
119
- }
120
- export interface PaymentCancelParams {
121
- customer_id: string;
122
- invoice_id: string;
123
- }
124
- export declare namespace Payments {
125
- export { type Payment as Payment, type PaymentStatus as PaymentStatus, type PaymentAttemptResponse as PaymentAttemptResponse, type PaymentCancelResponse as PaymentCancelResponse, type PaymentsBodyCursorPage as PaymentsBodyCursorPage, type PaymentListParams as PaymentListParams, type PaymentAttemptParams as PaymentAttemptParams, type PaymentCancelParams as PaymentCancelParams, };
126
- }
127
- //# sourceMappingURL=payments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/resources/v1/payments.ts"],"names":[],"mappings":"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"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Payments = void 0;
5
- const resource_1 = require("../../core/resource.js");
6
- const pagination_1 = require("../../core/pagination.js");
7
- class Payments extends resource_1.APIResource {
8
- /**
9
- * Fetch all payment attempts for the given invoice.
10
- *
11
- * @example
12
- * ```ts
13
- * // Automatically fetches more pages as needed.
14
- * for await (const payment of client.v1.payments.list({
15
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
16
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
17
- * statuses: ['pending', 'requires_intervention'],
18
- * })) {
19
- * // ...
20
- * }
21
- * ```
22
- */
23
- list(body, options) {
24
- return this._client.getAPIList('/v1/payments/list', (pagination_1.BodyCursorPage), {
25
- body,
26
- method: 'post',
27
- ...options,
28
- });
29
- }
30
- /**
31
- * Trigger a new attempt by canceling any existing attempts for this invoice and
32
- * creating a new Payment. This will trigger another attempt to charge the
33
- * Customer's configured Payment Gateway. Payment can only be attempted if all of
34
- * the following are true:
35
- *
36
- * - The Metronome Invoice is finalized
37
- * - PLG Invoicing is configured for the Customer
38
- * - You cannot attempt payments for invoices that have already been `paid` or
39
- * `voided`.
40
- *
41
- * Attempting to payment on an ineligible Invoice or Customer will result in a
42
- * `400` response.
43
- *
44
- * @example
45
- * ```ts
46
- * const response = await client.v1.payments.attempt({
47
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
48
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
49
- * });
50
- * ```
51
- */
52
- attempt(body, options) {
53
- return this._client.post('/v1/payments/attempt', { body, ...options });
54
- }
55
- /**
56
- * Cancel an existing payment attempt for an invoice.
57
- *
58
- * @example
59
- * ```ts
60
- * const response = await client.v1.payments.cancel({
61
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
62
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
63
- * });
64
- * ```
65
- */
66
- cancel(body, options) {
67
- return this._client.post('/v1/payments/cancel', { body, ...options });
68
- }
69
- }
70
- exports.Payments = Payments;
71
- //# sourceMappingURL=payments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/resources/v1/payments.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,yDAA+F;AAG/F,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,IAAuB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAA,2BAAuB,CAAA,EAAE;YAC3E,IAAI;YACJ,MAAM,EAAE,MAAM;YACd,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,IAA0B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;CACF;AAhED,4BAgEC"}
@@ -1,67 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../../core/resource.mjs";
3
- import { BodyCursorPage } from "../../core/pagination.mjs";
4
- export class Payments extends APIResource {
5
- /**
6
- * Fetch all payment attempts for the given invoice.
7
- *
8
- * @example
9
- * ```ts
10
- * // Automatically fetches more pages as needed.
11
- * for await (const payment of client.v1.payments.list({
12
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
13
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
14
- * statuses: ['pending', 'requires_intervention'],
15
- * })) {
16
- * // ...
17
- * }
18
- * ```
19
- */
20
- list(body, options) {
21
- return this._client.getAPIList('/v1/payments/list', (BodyCursorPage), {
22
- body,
23
- method: 'post',
24
- ...options,
25
- });
26
- }
27
- /**
28
- * Trigger a new attempt by canceling any existing attempts for this invoice and
29
- * creating a new Payment. This will trigger another attempt to charge the
30
- * Customer's configured Payment Gateway. Payment can only be attempted if all of
31
- * the following are true:
32
- *
33
- * - The Metronome Invoice is finalized
34
- * - PLG Invoicing is configured for the Customer
35
- * - You cannot attempt payments for invoices that have already been `paid` or
36
- * `voided`.
37
- *
38
- * Attempting to payment on an ineligible Invoice or Customer will result in a
39
- * `400` response.
40
- *
41
- * @example
42
- * ```ts
43
- * const response = await client.v1.payments.attempt({
44
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
45
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
46
- * });
47
- * ```
48
- */
49
- attempt(body, options) {
50
- return this._client.post('/v1/payments/attempt', { body, ...options });
51
- }
52
- /**
53
- * Cancel an existing payment attempt for an invoice.
54
- *
55
- * @example
56
- * ```ts
57
- * const response = await client.v1.payments.cancel({
58
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
59
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
60
- * });
61
- * ```
62
- */
63
- cancel(body, options) {
64
- return this._client.post('/v1/payments/cancel', { body, ...options });
65
- }
66
- }
67
- //# sourceMappingURL=payments.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"payments.mjs","sourceRoot":"","sources":["../../src/resources/v1/payments.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,cAAc,EAA0C;AAGjE,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,IAAuB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAA,cAAuB,CAAA,EAAE;YAC3E,IAAI;YACJ,MAAM,EAAE,MAAM;YACd,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,IAA0B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;CACF"}
@@ -1,187 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../core/resource';
4
- import * as Shared from '../shared';
5
- import { APIPromise } from '../../core/api-promise';
6
- import { BodyCursorPage, type BodyCursorPageParams, PagePromise } from '../../core/pagination';
7
- import { RequestOptions } from '../../internal/request-options';
8
-
9
- export class Payments extends APIResource {
10
- /**
11
- * Fetch all payment attempts for the given invoice.
12
- *
13
- * @example
14
- * ```ts
15
- * // Automatically fetches more pages as needed.
16
- * for await (const payment of client.v1.payments.list({
17
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
18
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
19
- * statuses: ['pending', 'requires_intervention'],
20
- * })) {
21
- * // ...
22
- * }
23
- * ```
24
- */
25
- list(body: PaymentListParams, options?: RequestOptions): PagePromise<PaymentsBodyCursorPage, Payment> {
26
- return this._client.getAPIList('/v1/payments/list', BodyCursorPage<Payment>, {
27
- body,
28
- method: 'post',
29
- ...options,
30
- });
31
- }
32
-
33
- /**
34
- * Trigger a new attempt by canceling any existing attempts for this invoice and
35
- * creating a new Payment. This will trigger another attempt to charge the
36
- * Customer's configured Payment Gateway. Payment can only be attempted if all of
37
- * the following are true:
38
- *
39
- * - The Metronome Invoice is finalized
40
- * - PLG Invoicing is configured for the Customer
41
- * - You cannot attempt payments for invoices that have already been `paid` or
42
- * `voided`.
43
- *
44
- * Attempting to payment on an ineligible Invoice or Customer will result in a
45
- * `400` response.
46
- *
47
- * @example
48
- * ```ts
49
- * const response = await client.v1.payments.attempt({
50
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
51
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
52
- * });
53
- * ```
54
- */
55
- attempt(body: PaymentAttemptParams, options?: RequestOptions): APIPromise<PaymentAttemptResponse> {
56
- return this._client.post('/v1/payments/attempt', { body, ...options });
57
- }
58
-
59
- /**
60
- * Cancel an existing payment attempt for an invoice.
61
- *
62
- * @example
63
- * ```ts
64
- * const response = await client.v1.payments.cancel({
65
- * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
66
- * invoice_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
67
- * });
68
- * ```
69
- */
70
- cancel(body: PaymentCancelParams, options?: RequestOptions): APIPromise<PaymentCancelResponse> {
71
- return this._client.post('/v1/payments/cancel', { body, ...options });
72
- }
73
- }
74
-
75
- export type PaymentsBodyCursorPage = BodyCursorPage<Payment>;
76
-
77
- export interface Payment {
78
- id: string;
79
-
80
- amount?: number;
81
-
82
- amount_paid?: number;
83
-
84
- contract_id?: string;
85
-
86
- created_at?: string;
87
-
88
- customer_id?: string;
89
-
90
- error_message?: string;
91
-
92
- fiat_credit_type?: Shared.CreditTypeData;
93
-
94
- invoice_id?: string;
95
-
96
- payment_gateway?: Payment.PaymentGateway;
97
-
98
- revenue_system_payments?: Array<Payment.RevenueSystemPayment>;
99
-
100
- status?: PaymentStatus;
101
-
102
- updated_at?: string;
103
- }
104
-
105
- export namespace Payment {
106
- export interface PaymentGateway {
107
- stripe: PaymentGateway.Stripe;
108
-
109
- type: 'stripe';
110
- }
111
-
112
- export namespace PaymentGateway {
113
- export interface Stripe {
114
- payment_intent_id: string;
115
-
116
- error?: Stripe.Error;
117
-
118
- payment_method_id?: string;
119
- }
120
-
121
- export namespace Stripe {
122
- export interface Error {
123
- code?: string;
124
-
125
- decline_code?: string;
126
-
127
- type?: string;
128
- }
129
- }
130
- }
131
-
132
- export interface RevenueSystemPayment {
133
- revenue_system_provider: string;
134
-
135
- sync_status: string;
136
-
137
- /**
138
- * The error message from the revenue system, if available.
139
- */
140
- error_message?: string;
141
-
142
- revenue_system_external_payment_id?: string;
143
- }
144
- }
145
-
146
- export type PaymentStatus = 'pending' | 'requires_intervention' | 'paid' | 'canceled';
147
-
148
- export interface PaymentAttemptResponse {
149
- data: Payment;
150
- }
151
-
152
- export interface PaymentCancelResponse {
153
- data: Payment;
154
- }
155
-
156
- export interface PaymentListParams extends BodyCursorPageParams {
157
- customer_id: string;
158
-
159
- invoice_id: string;
160
-
161
- statuses?: Array<PaymentStatus>;
162
- }
163
-
164
- export interface PaymentAttemptParams {
165
- customer_id: string;
166
-
167
- invoice_id: string;
168
- }
169
-
170
- export interface PaymentCancelParams {
171
- customer_id: string;
172
-
173
- invoice_id: string;
174
- }
175
-
176
- export declare namespace Payments {
177
- export {
178
- type Payment as Payment,
179
- type PaymentStatus as PaymentStatus,
180
- type PaymentAttemptResponse as PaymentAttemptResponse,
181
- type PaymentCancelResponse as PaymentCancelResponse,
182
- type PaymentsBodyCursorPage as PaymentsBodyCursorPage,
183
- type PaymentListParams as PaymentListParams,
184
- type PaymentAttemptParams as PaymentAttemptParams,
185
- type PaymentCancelParams as PaymentCancelParams,
186
- };
187
- }