whop-sdk 0.0.10__py3-none-any.whl

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 (352) hide show
  1. whop_sdk/__init__.py +94 -0
  2. whop_sdk/_base_client.py +1995 -0
  3. whop_sdk/_client.py +800 -0
  4. whop_sdk/_compat.py +219 -0
  5. whop_sdk/_constants.py +14 -0
  6. whop_sdk/_exceptions.py +112 -0
  7. whop_sdk/_files.py +123 -0
  8. whop_sdk/_models.py +857 -0
  9. whop_sdk/_qs.py +150 -0
  10. whop_sdk/_resource.py +43 -0
  11. whop_sdk/_response.py +830 -0
  12. whop_sdk/_streaming.py +333 -0
  13. whop_sdk/_types.py +260 -0
  14. whop_sdk/_utils/__init__.py +64 -0
  15. whop_sdk/_utils/_compat.py +45 -0
  16. whop_sdk/_utils/_datetime_parse.py +136 -0
  17. whop_sdk/_utils/_logs.py +25 -0
  18. whop_sdk/_utils/_proxy.py +65 -0
  19. whop_sdk/_utils/_reflection.py +42 -0
  20. whop_sdk/_utils/_resources_proxy.py +24 -0
  21. whop_sdk/_utils/_streams.py +12 -0
  22. whop_sdk/_utils/_sync.py +58 -0
  23. whop_sdk/_utils/_transform.py +457 -0
  24. whop_sdk/_utils/_typing.py +156 -0
  25. whop_sdk/_utils/_utils.py +421 -0
  26. whop_sdk/_version.py +4 -0
  27. whop_sdk/lib/.keep +4 -0
  28. whop_sdk/pagination.py +61 -0
  29. whop_sdk/py.typed +0 -0
  30. whop_sdk/resources/__init__.py +540 -0
  31. whop_sdk/resources/access_tokens.py +341 -0
  32. whop_sdk/resources/account_links.py +211 -0
  33. whop_sdk/resources/app_builds.py +587 -0
  34. whop_sdk/resources/apps.py +684 -0
  35. whop_sdk/resources/authorized_users.py +353 -0
  36. whop_sdk/resources/chat_channels.py +469 -0
  37. whop_sdk/resources/checkout_configurations.py +776 -0
  38. whop_sdk/resources/companies.py +465 -0
  39. whop_sdk/resources/course_chapters.py +602 -0
  40. whop_sdk/resources/course_lesson_interactions.py +343 -0
  41. whop_sdk/resources/course_lessons.py +1040 -0
  42. whop_sdk/resources/course_students.py +327 -0
  43. whop_sdk/resources/courses.py +776 -0
  44. whop_sdk/resources/disputes.py +693 -0
  45. whop_sdk/resources/entries.py +556 -0
  46. whop_sdk/resources/experiences.py +983 -0
  47. whop_sdk/resources/forum_posts.py +656 -0
  48. whop_sdk/resources/forums.py +446 -0
  49. whop_sdk/resources/invoices.py +1099 -0
  50. whop_sdk/resources/ledger_accounts.py +171 -0
  51. whop_sdk/resources/members.py +429 -0
  52. whop_sdk/resources/memberships.py +818 -0
  53. whop_sdk/resources/messages.py +558 -0
  54. whop_sdk/resources/notifications.py +388 -0
  55. whop_sdk/resources/payment_tokens.py +359 -0
  56. whop_sdk/resources/payments.py +1040 -0
  57. whop_sdk/resources/plans.py +1001 -0
  58. whop_sdk/resources/products.py +970 -0
  59. whop_sdk/resources/promo_codes.py +668 -0
  60. whop_sdk/resources/reactions.py +423 -0
  61. whop_sdk/resources/refunds.py +347 -0
  62. whop_sdk/resources/reviews.py +332 -0
  63. whop_sdk/resources/setup_intents.py +349 -0
  64. whop_sdk/resources/shipments.py +451 -0
  65. whop_sdk/resources/support_channels.py +455 -0
  66. whop_sdk/resources/transfers.py +513 -0
  67. whop_sdk/resources/users.py +248 -0
  68. whop_sdk/resources/webhooks.py +69 -0
  69. whop_sdk/resources/withdrawals.py +341 -0
  70. whop_sdk/types/__init__.py +262 -0
  71. whop_sdk/types/access_token_create_params.py +64 -0
  72. whop_sdk/types/access_token_create_response.py +15 -0
  73. whop_sdk/types/account_link_create_params.py +27 -0
  74. whop_sdk/types/account_link_create_response.py +15 -0
  75. whop_sdk/types/app_build_create_params.py +72 -0
  76. whop_sdk/types/app_build_list_params.py +42 -0
  77. whop_sdk/types/app_build_list_response.py +50 -0
  78. whop_sdk/types/app_create_params.py +19 -0
  79. whop_sdk/types/app_list_params.py +59 -0
  80. whop_sdk/types/app_list_response.py +110 -0
  81. whop_sdk/types/app_type.py +7 -0
  82. whop_sdk/types/app_update_params.py +67 -0
  83. whop_sdk/types/assessment_question_types.py +7 -0
  84. whop_sdk/types/authorized_user_list_params.py +41 -0
  85. whop_sdk/types/authorized_user_list_response.py +33 -0
  86. whop_sdk/types/authorized_user_retrieve_response.py +33 -0
  87. whop_sdk/types/billing_reasons.py +9 -0
  88. whop_sdk/types/card_brands.py +25 -0
  89. whop_sdk/types/chat_channel_list_params.py +28 -0
  90. whop_sdk/types/chat_channel_list_response.py +43 -0
  91. whop_sdk/types/chat_channel_update_params.py +32 -0
  92. whop_sdk/types/checkout_configuration_create_params.py +373 -0
  93. whop_sdk/types/checkout_configuration_list_params.py +41 -0
  94. whop_sdk/types/checkout_configuration_list_response.py +104 -0
  95. whop_sdk/types/checkout_modes.py +7 -0
  96. whop_sdk/types/company_create_params.py +22 -0
  97. whop_sdk/types/company_list_params.py +38 -0
  98. whop_sdk/types/company_list_response.py +76 -0
  99. whop_sdk/types/course.py +122 -0
  100. whop_sdk/types/course_chapter.py +32 -0
  101. whop_sdk/types/course_chapter_create_params.py +16 -0
  102. whop_sdk/types/course_chapter_delete_response.py +7 -0
  103. whop_sdk/types/course_chapter_list_params.py +25 -0
  104. whop_sdk/types/course_chapter_list_response.py +16 -0
  105. whop_sdk/types/course_chapter_update_params.py +12 -0
  106. whop_sdk/types/course_create_params.py +78 -0
  107. whop_sdk/types/course_delete_response.py +7 -0
  108. whop_sdk/types/course_lesson_create_params.py +63 -0
  109. whop_sdk/types/course_lesson_delete_response.py +7 -0
  110. whop_sdk/types/course_lesson_interaction_completed_webhook_event.py +26 -0
  111. whop_sdk/types/course_lesson_interaction_list_params.py +34 -0
  112. whop_sdk/types/course_lesson_list_params.py +28 -0
  113. whop_sdk/types/course_lesson_list_response.py +57 -0
  114. whop_sdk/types/course_lesson_mark_as_completed_response.py +7 -0
  115. whop_sdk/types/course_lesson_start_response.py +7 -0
  116. whop_sdk/types/course_lesson_submit_assessment_params.py +26 -0
  117. whop_sdk/types/course_lesson_submit_assessment_response.py +62 -0
  118. whop_sdk/types/course_lesson_update_params.py +222 -0
  119. whop_sdk/types/course_list_params.py +28 -0
  120. whop_sdk/types/course_list_response.py +90 -0
  121. whop_sdk/types/course_student_list_params.py +28 -0
  122. whop_sdk/types/course_student_list_response.py +42 -0
  123. whop_sdk/types/course_student_retrieve_response.py +61 -0
  124. whop_sdk/types/course_update_params.py +114 -0
  125. whop_sdk/types/course_visibilities.py +7 -0
  126. whop_sdk/types/dispute.py +284 -0
  127. whop_sdk/types/dispute_created_webhook_event.py +26 -0
  128. whop_sdk/types/dispute_list_params.py +38 -0
  129. whop_sdk/types/dispute_list_response.py +77 -0
  130. whop_sdk/types/dispute_statuses.py +17 -0
  131. whop_sdk/types/dispute_update_evidence_params.py +159 -0
  132. whop_sdk/types/dispute_updated_webhook_event.py +26 -0
  133. whop_sdk/types/embed_type.py +7 -0
  134. whop_sdk/types/entry_approve_response.py +10 -0
  135. whop_sdk/types/entry_approved_webhook_event.py +26 -0
  136. whop_sdk/types/entry_created_webhook_event.py +26 -0
  137. whop_sdk/types/entry_deleted_webhook_event.py +26 -0
  138. whop_sdk/types/entry_denied_webhook_event.py +26 -0
  139. whop_sdk/types/entry_list_params.py +52 -0
  140. whop_sdk/types/entry_list_response.py +56 -0
  141. whop_sdk/types/experience_attach_params.py +12 -0
  142. whop_sdk/types/experience_create_params.py +22 -0
  143. whop_sdk/types/experience_delete_response.py +7 -0
  144. whop_sdk/types/experience_detach_params.py +12 -0
  145. whop_sdk/types/experience_duplicate_params.py +13 -0
  146. whop_sdk/types/experience_list_params.py +40 -0
  147. whop_sdk/types/experience_list_response.py +73 -0
  148. whop_sdk/types/experience_update_params.py +46 -0
  149. whop_sdk/types/forum_list_params.py +28 -0
  150. whop_sdk/types/forum_list_response.py +33 -0
  151. whop_sdk/types/forum_post_create_params.py +101 -0
  152. whop_sdk/types/forum_post_list_params.py +31 -0
  153. whop_sdk/types/forum_post_list_response.py +60 -0
  154. whop_sdk/types/forum_post_update_params.py +56 -0
  155. whop_sdk/types/forum_post_visibility_type.py +7 -0
  156. whop_sdk/types/forum_update_params.py +23 -0
  157. whop_sdk/types/invoice_create_params.py +515 -0
  158. whop_sdk/types/invoice_created_webhook_event.py +26 -0
  159. whop_sdk/types/invoice_list_params.py +53 -0
  160. whop_sdk/types/invoice_paid_webhook_event.py +26 -0
  161. whop_sdk/types/invoice_past_due_webhook_event.py +26 -0
  162. whop_sdk/types/invoice_void_response.py +7 -0
  163. whop_sdk/types/invoice_voided_webhook_event.py +26 -0
  164. whop_sdk/types/languages.py +30 -0
  165. whop_sdk/types/ledger_account_retrieve_response.py +93 -0
  166. whop_sdk/types/lesson.py +219 -0
  167. whop_sdk/types/lesson_types.py +7 -0
  168. whop_sdk/types/lesson_visibilities.py +7 -0
  169. whop_sdk/types/member_list_params.py +73 -0
  170. whop_sdk/types/member_list_response.py +65 -0
  171. whop_sdk/types/member_retrieve_response.py +79 -0
  172. whop_sdk/types/membership_activated_webhook_event.py +29 -0
  173. whop_sdk/types/membership_cancel_params.py +13 -0
  174. whop_sdk/types/membership_deactivated_webhook_event.py +29 -0
  175. whop_sdk/types/membership_list_params.py +73 -0
  176. whop_sdk/types/membership_list_response.py +128 -0
  177. whop_sdk/types/membership_pause_params.py +16 -0
  178. whop_sdk/types/membership_update_params.py +13 -0
  179. whop_sdk/types/message_create_params.py +63 -0
  180. whop_sdk/types/message_list_params.py +30 -0
  181. whop_sdk/types/message_list_response.py +90 -0
  182. whop_sdk/types/message_update_params.py +45 -0
  183. whop_sdk/types/notification_create_params.py +93 -0
  184. whop_sdk/types/notification_create_response.py +10 -0
  185. whop_sdk/types/payment_create_params.py +162 -0
  186. whop_sdk/types/payment_failed_webhook_event.py +26 -0
  187. whop_sdk/types/payment_list_params.py +67 -0
  188. whop_sdk/types/payment_list_response.py +273 -0
  189. whop_sdk/types/payment_method_types.py +94 -0
  190. whop_sdk/types/payment_pending_webhook_event.py +26 -0
  191. whop_sdk/types/payment_provider.py +9 -0
  192. whop_sdk/types/payment_refund_params.py +13 -0
  193. whop_sdk/types/payment_succeeded_webhook_event.py +26 -0
  194. whop_sdk/types/payment_token_list_params.py +38 -0
  195. whop_sdk/types/payment_token_list_response.py +41 -0
  196. whop_sdk/types/payment_token_retrieve_params.py +12 -0
  197. whop_sdk/types/payment_token_retrieve_response.py +41 -0
  198. whop_sdk/types/plan_create_params.py +162 -0
  199. whop_sdk/types/plan_delete_response.py +7 -0
  200. whop_sdk/types/plan_list_params.py +57 -0
  201. whop_sdk/types/plan_list_response.py +128 -0
  202. whop_sdk/types/plan_update_params.py +155 -0
  203. whop_sdk/types/product_create_params.py +147 -0
  204. whop_sdk/types/product_delete_response.py +7 -0
  205. whop_sdk/types/product_list_params.py +49 -0
  206. whop_sdk/types/product_update_params.py +82 -0
  207. whop_sdk/types/promo_code.py +90 -0
  208. whop_sdk/types/promo_code_create_params.py +70 -0
  209. whop_sdk/types/promo_code_delete_response.py +7 -0
  210. whop_sdk/types/promo_code_list_params.py +45 -0
  211. whop_sdk/types/promo_code_list_response.py +79 -0
  212. whop_sdk/types/promo_code_status.py +7 -0
  213. whop_sdk/types/promo_duration.py +7 -0
  214. whop_sdk/types/reaction_create_params.py +19 -0
  215. whop_sdk/types/reaction_list_params.py +25 -0
  216. whop_sdk/types/reaction_list_response.py +32 -0
  217. whop_sdk/types/refund_created_webhook_event.py +154 -0
  218. whop_sdk/types/refund_list_params.py +38 -0
  219. whop_sdk/types/refund_list_response.py +53 -0
  220. whop_sdk/types/refund_reference_status.py +7 -0
  221. whop_sdk/types/refund_reference_type.py +9 -0
  222. whop_sdk/types/refund_retrieve_response.py +129 -0
  223. whop_sdk/types/refund_status.py +7 -0
  224. whop_sdk/types/refund_updated_webhook_event.py +154 -0
  225. whop_sdk/types/review_list_params.py +40 -0
  226. whop_sdk/types/review_list_response.py +78 -0
  227. whop_sdk/types/review_retrieve_response.py +103 -0
  228. whop_sdk/types/review_status.py +7 -0
  229. whop_sdk/types/setup_intent.py +111 -0
  230. whop_sdk/types/setup_intent_canceled_webhook_event.py +29 -0
  231. whop_sdk/types/setup_intent_list_params.py +38 -0
  232. whop_sdk/types/setup_intent_list_response.py +111 -0
  233. whop_sdk/types/setup_intent_requires_action_webhook_event.py +29 -0
  234. whop_sdk/types/setup_intent_status.py +7 -0
  235. whop_sdk/types/setup_intent_succeeded_webhook_event.py +29 -0
  236. whop_sdk/types/shared/__init__.py +62 -0
  237. whop_sdk/types/shared/access_level.py +7 -0
  238. whop_sdk/types/shared/access_pass_type.py +7 -0
  239. whop_sdk/types/shared/app.py +187 -0
  240. whop_sdk/types/shared/app_build.py +50 -0
  241. whop_sdk/types/shared/app_build_platforms.py +7 -0
  242. whop_sdk/types/shared/app_build_statuses.py +7 -0
  243. whop_sdk/types/shared/app_statuses.py +7 -0
  244. whop_sdk/types/shared/app_view_type.py +7 -0
  245. whop_sdk/types/shared/authorized_user_roles.py +9 -0
  246. whop_sdk/types/shared/business_types.py +22 -0
  247. whop_sdk/types/shared/chat_channel.py +43 -0
  248. whop_sdk/types/shared/checkout_configuration.py +104 -0
  249. whop_sdk/types/shared/collection_method.py +7 -0
  250. whop_sdk/types/shared/company.py +91 -0
  251. whop_sdk/types/shared/course_lesson_interaction.py +63 -0
  252. whop_sdk/types/shared/course_lesson_interaction_list_item.py +44 -0
  253. whop_sdk/types/shared/currency.py +93 -0
  254. whop_sdk/types/shared/custom_cta.py +21 -0
  255. whop_sdk/types/shared/direction.py +7 -0
  256. whop_sdk/types/shared/dms_post_types.py +7 -0
  257. whop_sdk/types/shared/email_notification_preferences.py +7 -0
  258. whop_sdk/types/shared/entry.py +70 -0
  259. whop_sdk/types/shared/entry_status.py +7 -0
  260. whop_sdk/types/shared/experience.py +91 -0
  261. whop_sdk/types/shared/forum.py +33 -0
  262. whop_sdk/types/shared/forum_post.py +60 -0
  263. whop_sdk/types/shared/friendly_receipt_status.py +24 -0
  264. whop_sdk/types/shared/global_affiliate_status.py +7 -0
  265. whop_sdk/types/shared/industry_types.py +67 -0
  266. whop_sdk/types/shared/invoice.py +64 -0
  267. whop_sdk/types/shared/invoice_list_item.py +64 -0
  268. whop_sdk/types/shared/invoice_status.py +7 -0
  269. whop_sdk/types/shared/member_most_recent_actions.py +22 -0
  270. whop_sdk/types/shared/member_statuses.py +7 -0
  271. whop_sdk/types/shared/membership.py +128 -0
  272. whop_sdk/types/shared/membership_status.py +9 -0
  273. whop_sdk/types/shared/message.py +90 -0
  274. whop_sdk/types/shared/page_info.py +21 -0
  275. whop_sdk/types/shared/payment.py +273 -0
  276. whop_sdk/types/shared/plan.py +159 -0
  277. whop_sdk/types/shared/plan_type.py +7 -0
  278. whop_sdk/types/shared/product.py +132 -0
  279. whop_sdk/types/shared/product_list_item.py +57 -0
  280. whop_sdk/types/shared/promo_type.py +7 -0
  281. whop_sdk/types/shared/reaction.py +32 -0
  282. whop_sdk/types/shared/receipt_status.py +7 -0
  283. whop_sdk/types/shared/release_method.py +7 -0
  284. whop_sdk/types/shared/shipment.py +48 -0
  285. whop_sdk/types/shared/shipment_carrier.py +84 -0
  286. whop_sdk/types/shared/shipment_status.py +18 -0
  287. whop_sdk/types/shared/shipment_substatus.py +36 -0
  288. whop_sdk/types/shared/support_channel.py +39 -0
  289. whop_sdk/types/shared/tax_type.py +7 -0
  290. whop_sdk/types/shared/transfer.py +112 -0
  291. whop_sdk/types/shared/visibility.py +7 -0
  292. whop_sdk/types/shared/visibility_filter.py +9 -0
  293. whop_sdk/types/shared/who_can_comment_types.py +7 -0
  294. whop_sdk/types/shared/who_can_post.py +7 -0
  295. whop_sdk/types/shared/who_can_post_types.py +7 -0
  296. whop_sdk/types/shared/who_can_react.py +7 -0
  297. whop_sdk/types/shared_params/__init__.py +34 -0
  298. whop_sdk/types/shared_params/access_level.py +9 -0
  299. whop_sdk/types/shared_params/access_pass_type.py +9 -0
  300. whop_sdk/types/shared_params/app_build_platforms.py +9 -0
  301. whop_sdk/types/shared_params/app_build_statuses.py +9 -0
  302. whop_sdk/types/shared_params/app_statuses.py +9 -0
  303. whop_sdk/types/shared_params/app_view_type.py +9 -0
  304. whop_sdk/types/shared_params/authorized_user_roles.py +11 -0
  305. whop_sdk/types/shared_params/business_types.py +24 -0
  306. whop_sdk/types/shared_params/collection_method.py +9 -0
  307. whop_sdk/types/shared_params/currency.py +95 -0
  308. whop_sdk/types/shared_params/custom_cta.py +23 -0
  309. whop_sdk/types/shared_params/direction.py +9 -0
  310. whop_sdk/types/shared_params/email_notification_preferences.py +9 -0
  311. whop_sdk/types/shared_params/entry_status.py +9 -0
  312. whop_sdk/types/shared_params/friendly_receipt_status.py +26 -0
  313. whop_sdk/types/shared_params/global_affiliate_status.py +9 -0
  314. whop_sdk/types/shared_params/industry_types.py +69 -0
  315. whop_sdk/types/shared_params/invoice_status.py +9 -0
  316. whop_sdk/types/shared_params/member_most_recent_actions.py +24 -0
  317. whop_sdk/types/shared_params/member_statuses.py +9 -0
  318. whop_sdk/types/shared_params/membership_status.py +11 -0
  319. whop_sdk/types/shared_params/plan_type.py +9 -0
  320. whop_sdk/types/shared_params/promo_type.py +9 -0
  321. whop_sdk/types/shared_params/receipt_status.py +9 -0
  322. whop_sdk/types/shared_params/release_method.py +9 -0
  323. whop_sdk/types/shared_params/tax_type.py +9 -0
  324. whop_sdk/types/shared_params/visibility.py +9 -0
  325. whop_sdk/types/shared_params/visibility_filter.py +11 -0
  326. whop_sdk/types/shared_params/who_can_comment_types.py +9 -0
  327. whop_sdk/types/shared_params/who_can_post.py +9 -0
  328. whop_sdk/types/shared_params/who_can_post_types.py +9 -0
  329. whop_sdk/types/shared_params/who_can_react.py +9 -0
  330. whop_sdk/types/shipment_create_params.py +18 -0
  331. whop_sdk/types/shipment_list_params.py +31 -0
  332. whop_sdk/types/shipment_list_response.py +48 -0
  333. whop_sdk/types/support_channel_create_params.py +15 -0
  334. whop_sdk/types/support_channel_list_params.py +40 -0
  335. whop_sdk/types/support_channel_list_response.py +39 -0
  336. whop_sdk/types/transfer_create_params.py +39 -0
  337. whop_sdk/types/transfer_list_params.py +50 -0
  338. whop_sdk/types/transfer_list_response.py +38 -0
  339. whop_sdk/types/unwrap_webhook_event.py +52 -0
  340. whop_sdk/types/user_check_access_response.py +14 -0
  341. whop_sdk/types/user_retrieve_response.py +36 -0
  342. whop_sdk/types/withdrawal_fee_types.py +7 -0
  343. whop_sdk/types/withdrawal_list_params.py +38 -0
  344. whop_sdk/types/withdrawal_list_response.py +45 -0
  345. whop_sdk/types/withdrawal_retrieve_response.py +154 -0
  346. whop_sdk/types/withdrawal_speeds.py +7 -0
  347. whop_sdk/types/withdrawal_status.py +9 -0
  348. whop_sdk/types/withdrawal_types.py +7 -0
  349. whop_sdk-0.0.10.dist-info/METADATA +509 -0
  350. whop_sdk-0.0.10.dist-info/RECORD +352 -0
  351. whop_sdk-0.0.10.dist-info/WHEEL +4 -0
  352. whop_sdk-0.0.10.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,1040 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import List, Union, Optional
6
+ from datetime import datetime
7
+ from typing_extensions import Literal, overload
8
+
9
+ import httpx
10
+
11
+ from ..types import payment_list_params, payment_create_params, payment_refund_params
12
+ from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
13
+ from .._utils import required_args, maybe_transform, async_maybe_transform
14
+ from .._compat import cached_property
15
+ from .._resource import SyncAPIResource, AsyncAPIResource
16
+ from .._response import (
17
+ to_raw_response_wrapper,
18
+ to_streamed_response_wrapper,
19
+ async_to_raw_response_wrapper,
20
+ async_to_streamed_response_wrapper,
21
+ )
22
+ from ..pagination import SyncCursorPage, AsyncCursorPage
23
+ from .._base_client import AsyncPaginator, make_request_options
24
+ from ..types.shared.payment import Payment
25
+ from ..types.billing_reasons import BillingReasons
26
+ from ..types.shared.currency import Currency
27
+ from ..types.shared.direction import Direction
28
+ from ..types.payment_list_response import PaymentListResponse
29
+ from ..types.shared.receipt_status import ReceiptStatus
30
+ from ..types.shared.friendly_receipt_status import FriendlyReceiptStatus
31
+
32
+ __all__ = ["PaymentsResource", "AsyncPaymentsResource"]
33
+
34
+
35
+ class PaymentsResource(SyncAPIResource):
36
+ @cached_property
37
+ def with_raw_response(self) -> PaymentsResourceWithRawResponse:
38
+ """
39
+ This property can be used as a prefix for any HTTP method call to return
40
+ the raw response object instead of the parsed content.
41
+
42
+ For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
43
+ """
44
+ return PaymentsResourceWithRawResponse(self)
45
+
46
+ @cached_property
47
+ def with_streaming_response(self) -> PaymentsResourceWithStreamingResponse:
48
+ """
49
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
50
+
51
+ For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
52
+ """
53
+ return PaymentsResourceWithStreamingResponse(self)
54
+
55
+ @overload
56
+ def create(
57
+ self,
58
+ *,
59
+ company_id: str,
60
+ member_id: str,
61
+ payment_token_id: str,
62
+ plan: payment_create_params.CreatePaymentInputWithPlanPlan,
63
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
64
+ # The extra values given here take precedence over values defined on the client or passed to this method.
65
+ extra_headers: Headers | None = None,
66
+ extra_query: Query | None = None,
67
+ extra_body: Body | None = None,
68
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
69
+ ) -> Payment:
70
+ """Creates a payment.
71
+
72
+ This endpoint will respond with a payment object immediately,
73
+ but the payment is processed asynchronously in the background. Use webhooks to
74
+ be notified when the payment succeeds or fails.
75
+
76
+ Required permissions:
77
+
78
+ - `payment:charge`
79
+ - `plan:create`
80
+ - `access_pass:create`
81
+ - `access_pass:update`
82
+ - `plan:basic:read`
83
+ - `access_pass:basic:read`
84
+ - `member:email:read`
85
+ - `member:basic:read`
86
+ - `member:phone:read`
87
+ - `promo_code:basic:read`
88
+
89
+ Args:
90
+ company_id: The ID of the company to create the payment for.
91
+
92
+ member_id: The ID of the member to create the payment for.
93
+
94
+ payment_token_id: The ID of the payment token to use for the payment. It must be connected to the
95
+ Member being charged.
96
+
97
+ plan: Pass this object to create a new plan for this payment
98
+
99
+ extra_headers: Send extra headers
100
+
101
+ extra_query: Add additional query parameters to the request
102
+
103
+ extra_body: Add additional JSON properties to the request
104
+
105
+ timeout: Override the client-level default timeout for this request, in seconds
106
+ """
107
+ ...
108
+
109
+ @overload
110
+ def create(
111
+ self,
112
+ *,
113
+ company_id: str,
114
+ member_id: str,
115
+ payment_token_id: str,
116
+ plan_id: str,
117
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
118
+ # The extra values given here take precedence over values defined on the client or passed to this method.
119
+ extra_headers: Headers | None = None,
120
+ extra_query: Query | None = None,
121
+ extra_body: Body | None = None,
122
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
123
+ ) -> Payment:
124
+ """Creates a payment.
125
+
126
+ This endpoint will respond with a payment object immediately,
127
+ but the payment is processed asynchronously in the background. Use webhooks to
128
+ be notified when the payment succeeds or fails.
129
+
130
+ Required permissions:
131
+
132
+ - `payment:charge`
133
+ - `plan:create`
134
+ - `access_pass:create`
135
+ - `access_pass:update`
136
+ - `plan:basic:read`
137
+ - `access_pass:basic:read`
138
+ - `member:email:read`
139
+ - `member:basic:read`
140
+ - `member:phone:read`
141
+ - `promo_code:basic:read`
142
+
143
+ Args:
144
+ company_id: The ID of the company to create the payment for.
145
+
146
+ member_id: The ID of the member to create the payment for.
147
+
148
+ payment_token_id: The ID of the payment token to use for the payment. It must be connected to the
149
+ Member being charged.
150
+
151
+ plan_id: An ID of an existing plan to use for the payment.
152
+
153
+ extra_headers: Send extra headers
154
+
155
+ extra_query: Add additional query parameters to the request
156
+
157
+ extra_body: Add additional JSON properties to the request
158
+
159
+ timeout: Override the client-level default timeout for this request, in seconds
160
+ """
161
+ ...
162
+
163
+ @required_args(
164
+ ["company_id", "member_id", "payment_token_id", "plan"],
165
+ ["company_id", "member_id", "payment_token_id", "plan_id"],
166
+ )
167
+ def create(
168
+ self,
169
+ *,
170
+ company_id: str,
171
+ member_id: str,
172
+ payment_token_id: str,
173
+ plan: payment_create_params.CreatePaymentInputWithPlanPlan | Omit = omit,
174
+ plan_id: str | Omit = omit,
175
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
176
+ # The extra values given here take precedence over values defined on the client or passed to this method.
177
+ extra_headers: Headers | None = None,
178
+ extra_query: Query | None = None,
179
+ extra_body: Body | None = None,
180
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
181
+ ) -> Payment:
182
+ return self._post(
183
+ "/payments",
184
+ body=maybe_transform(
185
+ {
186
+ "company_id": company_id,
187
+ "member_id": member_id,
188
+ "payment_token_id": payment_token_id,
189
+ "plan": plan,
190
+ "plan_id": plan_id,
191
+ },
192
+ payment_create_params.PaymentCreateParams,
193
+ ),
194
+ options=make_request_options(
195
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
196
+ ),
197
+ cast_to=Payment,
198
+ )
199
+
200
+ def retrieve(
201
+ self,
202
+ id: str,
203
+ *,
204
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
205
+ # The extra values given here take precedence over values defined on the client or passed to this method.
206
+ extra_headers: Headers | None = None,
207
+ extra_query: Query | None = None,
208
+ extra_body: Body | None = None,
209
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
210
+ ) -> Payment:
211
+ """
212
+ Retrieves a payment by ID
213
+
214
+ Required permissions:
215
+
216
+ - `payment:basic:read`
217
+ - `plan:basic:read`
218
+ - `access_pass:basic:read`
219
+ - `member:email:read`
220
+ - `member:basic:read`
221
+ - `member:phone:read`
222
+ - `promo_code:basic:read`
223
+
224
+ Args:
225
+ extra_headers: Send extra headers
226
+
227
+ extra_query: Add additional query parameters to the request
228
+
229
+ extra_body: Add additional JSON properties to the request
230
+
231
+ timeout: Override the client-level default timeout for this request, in seconds
232
+ """
233
+ if not id:
234
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
235
+ return self._get(
236
+ f"/payments/{id}",
237
+ options=make_request_options(
238
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
239
+ ),
240
+ cast_to=Payment,
241
+ )
242
+
243
+ def list(
244
+ self,
245
+ *,
246
+ company_id: str,
247
+ after: Optional[str] | Omit = omit,
248
+ before: Optional[str] | Omit = omit,
249
+ billing_reasons: Optional[List[BillingReasons]] | Omit = omit,
250
+ created_after: Union[str, datetime, None] | Omit = omit,
251
+ created_before: Union[str, datetime, None] | Omit = omit,
252
+ currencies: Optional[List[Currency]] | Omit = omit,
253
+ direction: Optional[Direction] | Omit = omit,
254
+ first: Optional[int] | Omit = omit,
255
+ include_free: Optional[bool] | Omit = omit,
256
+ last: Optional[int] | Omit = omit,
257
+ order: Optional[Literal["final_amount", "created_at", "paid_at"]] | Omit = omit,
258
+ plan_ids: Optional[SequenceNotStr[str]] | Omit = omit,
259
+ product_ids: Optional[SequenceNotStr[str]] | Omit = omit,
260
+ statuses: Optional[List[ReceiptStatus]] | Omit = omit,
261
+ substatuses: Optional[List[FriendlyReceiptStatus]] | Omit = omit,
262
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
263
+ # The extra values given here take precedence over values defined on the client or passed to this method.
264
+ extra_headers: Headers | None = None,
265
+ extra_query: Query | None = None,
266
+ extra_body: Body | None = None,
267
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
268
+ ) -> SyncCursorPage[PaymentListResponse]:
269
+ """
270
+ Lists payments
271
+
272
+ Required permissions:
273
+
274
+ - `payment:basic:read`
275
+ - `plan:basic:read`
276
+ - `access_pass:basic:read`
277
+ - `member:email:read`
278
+ - `member:basic:read`
279
+ - `member:phone:read`
280
+ - `promo_code:basic:read`
281
+
282
+ Args:
283
+ company_id: The ID of the company to list payments for
284
+
285
+ after: Returns the elements in the list that come after the specified cursor.
286
+
287
+ before: Returns the elements in the list that come before the specified cursor.
288
+
289
+ billing_reasons: The billing reason for the payment
290
+
291
+ created_after: The minimum creation date to filter by
292
+
293
+ created_before: The maximum creation date to filter by
294
+
295
+ currencies: The currency of the payment.
296
+
297
+ direction: The direction of the sort.
298
+
299
+ first: Returns the first _n_ elements from the list.
300
+
301
+ include_free: Whether to include free payments.
302
+
303
+ last: Returns the last _n_ elements from the list.
304
+
305
+ order: The order to sort the results by.
306
+
307
+ plan_ids: A specific plan.
308
+
309
+ product_ids: A specific product.
310
+
311
+ statuses: The status of the payment.
312
+
313
+ substatuses: The substatus of the payment.
314
+
315
+ extra_headers: Send extra headers
316
+
317
+ extra_query: Add additional query parameters to the request
318
+
319
+ extra_body: Add additional JSON properties to the request
320
+
321
+ timeout: Override the client-level default timeout for this request, in seconds
322
+ """
323
+ return self._get_api_list(
324
+ "/payments",
325
+ page=SyncCursorPage[PaymentListResponse],
326
+ options=make_request_options(
327
+ extra_headers=extra_headers,
328
+ extra_query=extra_query,
329
+ extra_body=extra_body,
330
+ timeout=timeout,
331
+ query=maybe_transform(
332
+ {
333
+ "company_id": company_id,
334
+ "after": after,
335
+ "before": before,
336
+ "billing_reasons": billing_reasons,
337
+ "created_after": created_after,
338
+ "created_before": created_before,
339
+ "currencies": currencies,
340
+ "direction": direction,
341
+ "first": first,
342
+ "include_free": include_free,
343
+ "last": last,
344
+ "order": order,
345
+ "plan_ids": plan_ids,
346
+ "product_ids": product_ids,
347
+ "statuses": statuses,
348
+ "substatuses": substatuses,
349
+ },
350
+ payment_list_params.PaymentListParams,
351
+ ),
352
+ ),
353
+ model=PaymentListResponse,
354
+ )
355
+
356
+ def refund(
357
+ self,
358
+ id: str,
359
+ *,
360
+ partial_amount: Optional[float] | Omit = omit,
361
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
362
+ # The extra values given here take precedence over values defined on the client or passed to this method.
363
+ extra_headers: Headers | None = None,
364
+ extra_query: Query | None = None,
365
+ extra_body: Body | None = None,
366
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
367
+ ) -> Payment:
368
+ """
369
+ Refunds a payment
370
+
371
+ Required permissions:
372
+
373
+ - `payment:manage`
374
+ - `plan:basic:read`
375
+ - `access_pass:basic:read`
376
+ - `member:email:read`
377
+ - `member:basic:read`
378
+ - `member:phone:read`
379
+ - `promo_code:basic:read`
380
+
381
+ Args:
382
+ partial_amount: An amount if the refund is supposed to be partial.
383
+
384
+ extra_headers: Send extra headers
385
+
386
+ extra_query: Add additional query parameters to the request
387
+
388
+ extra_body: Add additional JSON properties to the request
389
+
390
+ timeout: Override the client-level default timeout for this request, in seconds
391
+ """
392
+ if not id:
393
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
394
+ return self._post(
395
+ f"/payments/{id}/refund",
396
+ body=maybe_transform({"partial_amount": partial_amount}, payment_refund_params.PaymentRefundParams),
397
+ options=make_request_options(
398
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
399
+ ),
400
+ cast_to=Payment,
401
+ )
402
+
403
+ def retry(
404
+ self,
405
+ id: str,
406
+ *,
407
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
408
+ # The extra values given here take precedence over values defined on the client or passed to this method.
409
+ extra_headers: Headers | None = None,
410
+ extra_query: Query | None = None,
411
+ extra_body: Body | None = None,
412
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
413
+ ) -> Payment:
414
+ """
415
+ Retries a payment
416
+
417
+ Required permissions:
418
+
419
+ - `payment:manage`
420
+ - `plan:basic:read`
421
+ - `access_pass:basic:read`
422
+ - `member:email:read`
423
+ - `member:basic:read`
424
+ - `member:phone:read`
425
+ - `promo_code:basic:read`
426
+
427
+ Args:
428
+ extra_headers: Send extra headers
429
+
430
+ extra_query: Add additional query parameters to the request
431
+
432
+ extra_body: Add additional JSON properties to the request
433
+
434
+ timeout: Override the client-level default timeout for this request, in seconds
435
+ """
436
+ if not id:
437
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
438
+ return self._post(
439
+ f"/payments/{id}/retry",
440
+ options=make_request_options(
441
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
442
+ ),
443
+ cast_to=Payment,
444
+ )
445
+
446
+ def void(
447
+ self,
448
+ id: str,
449
+ *,
450
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
451
+ # The extra values given here take precedence over values defined on the client or passed to this method.
452
+ extra_headers: Headers | None = None,
453
+ extra_query: Query | None = None,
454
+ extra_body: Body | None = None,
455
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
456
+ ) -> Payment:
457
+ """
458
+ Voids a payment
459
+
460
+ Required permissions:
461
+
462
+ - `payment:manage`
463
+ - `plan:basic:read`
464
+ - `access_pass:basic:read`
465
+ - `member:email:read`
466
+ - `member:basic:read`
467
+ - `member:phone:read`
468
+ - `promo_code:basic:read`
469
+
470
+ Args:
471
+ extra_headers: Send extra headers
472
+
473
+ extra_query: Add additional query parameters to the request
474
+
475
+ extra_body: Add additional JSON properties to the request
476
+
477
+ timeout: Override the client-level default timeout for this request, in seconds
478
+ """
479
+ if not id:
480
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
481
+ return self._post(
482
+ f"/payments/{id}/void",
483
+ options=make_request_options(
484
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
485
+ ),
486
+ cast_to=Payment,
487
+ )
488
+
489
+
490
+ class AsyncPaymentsResource(AsyncAPIResource):
491
+ @cached_property
492
+ def with_raw_response(self) -> AsyncPaymentsResourceWithRawResponse:
493
+ """
494
+ This property can be used as a prefix for any HTTP method call to return
495
+ the raw response object instead of the parsed content.
496
+
497
+ For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
498
+ """
499
+ return AsyncPaymentsResourceWithRawResponse(self)
500
+
501
+ @cached_property
502
+ def with_streaming_response(self) -> AsyncPaymentsResourceWithStreamingResponse:
503
+ """
504
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
505
+
506
+ For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
507
+ """
508
+ return AsyncPaymentsResourceWithStreamingResponse(self)
509
+
510
+ @overload
511
+ async def create(
512
+ self,
513
+ *,
514
+ company_id: str,
515
+ member_id: str,
516
+ payment_token_id: str,
517
+ plan: payment_create_params.CreatePaymentInputWithPlanPlan,
518
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
519
+ # The extra values given here take precedence over values defined on the client or passed to this method.
520
+ extra_headers: Headers | None = None,
521
+ extra_query: Query | None = None,
522
+ extra_body: Body | None = None,
523
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
524
+ ) -> Payment:
525
+ """Creates a payment.
526
+
527
+ This endpoint will respond with a payment object immediately,
528
+ but the payment is processed asynchronously in the background. Use webhooks to
529
+ be notified when the payment succeeds or fails.
530
+
531
+ Required permissions:
532
+
533
+ - `payment:charge`
534
+ - `plan:create`
535
+ - `access_pass:create`
536
+ - `access_pass:update`
537
+ - `plan:basic:read`
538
+ - `access_pass:basic:read`
539
+ - `member:email:read`
540
+ - `member:basic:read`
541
+ - `member:phone:read`
542
+ - `promo_code:basic:read`
543
+
544
+ Args:
545
+ company_id: The ID of the company to create the payment for.
546
+
547
+ member_id: The ID of the member to create the payment for.
548
+
549
+ payment_token_id: The ID of the payment token to use for the payment. It must be connected to the
550
+ Member being charged.
551
+
552
+ plan: Pass this object to create a new plan for this payment
553
+
554
+ extra_headers: Send extra headers
555
+
556
+ extra_query: Add additional query parameters to the request
557
+
558
+ extra_body: Add additional JSON properties to the request
559
+
560
+ timeout: Override the client-level default timeout for this request, in seconds
561
+ """
562
+ ...
563
+
564
+ @overload
565
+ async def create(
566
+ self,
567
+ *,
568
+ company_id: str,
569
+ member_id: str,
570
+ payment_token_id: str,
571
+ plan_id: str,
572
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
573
+ # The extra values given here take precedence over values defined on the client or passed to this method.
574
+ extra_headers: Headers | None = None,
575
+ extra_query: Query | None = None,
576
+ extra_body: Body | None = None,
577
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
578
+ ) -> Payment:
579
+ """Creates a payment.
580
+
581
+ This endpoint will respond with a payment object immediately,
582
+ but the payment is processed asynchronously in the background. Use webhooks to
583
+ be notified when the payment succeeds or fails.
584
+
585
+ Required permissions:
586
+
587
+ - `payment:charge`
588
+ - `plan:create`
589
+ - `access_pass:create`
590
+ - `access_pass:update`
591
+ - `plan:basic:read`
592
+ - `access_pass:basic:read`
593
+ - `member:email:read`
594
+ - `member:basic:read`
595
+ - `member:phone:read`
596
+ - `promo_code:basic:read`
597
+
598
+ Args:
599
+ company_id: The ID of the company to create the payment for.
600
+
601
+ member_id: The ID of the member to create the payment for.
602
+
603
+ payment_token_id: The ID of the payment token to use for the payment. It must be connected to the
604
+ Member being charged.
605
+
606
+ plan_id: An ID of an existing plan to use for the payment.
607
+
608
+ extra_headers: Send extra headers
609
+
610
+ extra_query: Add additional query parameters to the request
611
+
612
+ extra_body: Add additional JSON properties to the request
613
+
614
+ timeout: Override the client-level default timeout for this request, in seconds
615
+ """
616
+ ...
617
+
618
+ @required_args(
619
+ ["company_id", "member_id", "payment_token_id", "plan"],
620
+ ["company_id", "member_id", "payment_token_id", "plan_id"],
621
+ )
622
+ async def create(
623
+ self,
624
+ *,
625
+ company_id: str,
626
+ member_id: str,
627
+ payment_token_id: str,
628
+ plan: payment_create_params.CreatePaymentInputWithPlanPlan | Omit = omit,
629
+ plan_id: str | Omit = omit,
630
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
631
+ # The extra values given here take precedence over values defined on the client or passed to this method.
632
+ extra_headers: Headers | None = None,
633
+ extra_query: Query | None = None,
634
+ extra_body: Body | None = None,
635
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
636
+ ) -> Payment:
637
+ return await self._post(
638
+ "/payments",
639
+ body=await async_maybe_transform(
640
+ {
641
+ "company_id": company_id,
642
+ "member_id": member_id,
643
+ "payment_token_id": payment_token_id,
644
+ "plan": plan,
645
+ "plan_id": plan_id,
646
+ },
647
+ payment_create_params.PaymentCreateParams,
648
+ ),
649
+ options=make_request_options(
650
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
651
+ ),
652
+ cast_to=Payment,
653
+ )
654
+
655
+ async def retrieve(
656
+ self,
657
+ id: str,
658
+ *,
659
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
660
+ # The extra values given here take precedence over values defined on the client or passed to this method.
661
+ extra_headers: Headers | None = None,
662
+ extra_query: Query | None = None,
663
+ extra_body: Body | None = None,
664
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
665
+ ) -> Payment:
666
+ """
667
+ Retrieves a payment by ID
668
+
669
+ Required permissions:
670
+
671
+ - `payment:basic:read`
672
+ - `plan:basic:read`
673
+ - `access_pass:basic:read`
674
+ - `member:email:read`
675
+ - `member:basic:read`
676
+ - `member:phone:read`
677
+ - `promo_code:basic:read`
678
+
679
+ Args:
680
+ extra_headers: Send extra headers
681
+
682
+ extra_query: Add additional query parameters to the request
683
+
684
+ extra_body: Add additional JSON properties to the request
685
+
686
+ timeout: Override the client-level default timeout for this request, in seconds
687
+ """
688
+ if not id:
689
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
690
+ return await self._get(
691
+ f"/payments/{id}",
692
+ options=make_request_options(
693
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
694
+ ),
695
+ cast_to=Payment,
696
+ )
697
+
698
+ def list(
699
+ self,
700
+ *,
701
+ company_id: str,
702
+ after: Optional[str] | Omit = omit,
703
+ before: Optional[str] | Omit = omit,
704
+ billing_reasons: Optional[List[BillingReasons]] | Omit = omit,
705
+ created_after: Union[str, datetime, None] | Omit = omit,
706
+ created_before: Union[str, datetime, None] | Omit = omit,
707
+ currencies: Optional[List[Currency]] | Omit = omit,
708
+ direction: Optional[Direction] | Omit = omit,
709
+ first: Optional[int] | Omit = omit,
710
+ include_free: Optional[bool] | Omit = omit,
711
+ last: Optional[int] | Omit = omit,
712
+ order: Optional[Literal["final_amount", "created_at", "paid_at"]] | Omit = omit,
713
+ plan_ids: Optional[SequenceNotStr[str]] | Omit = omit,
714
+ product_ids: Optional[SequenceNotStr[str]] | Omit = omit,
715
+ statuses: Optional[List[ReceiptStatus]] | Omit = omit,
716
+ substatuses: Optional[List[FriendlyReceiptStatus]] | Omit = omit,
717
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
718
+ # The extra values given here take precedence over values defined on the client or passed to this method.
719
+ extra_headers: Headers | None = None,
720
+ extra_query: Query | None = None,
721
+ extra_body: Body | None = None,
722
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
723
+ ) -> AsyncPaginator[PaymentListResponse, AsyncCursorPage[PaymentListResponse]]:
724
+ """
725
+ Lists payments
726
+
727
+ Required permissions:
728
+
729
+ - `payment:basic:read`
730
+ - `plan:basic:read`
731
+ - `access_pass:basic:read`
732
+ - `member:email:read`
733
+ - `member:basic:read`
734
+ - `member:phone:read`
735
+ - `promo_code:basic:read`
736
+
737
+ Args:
738
+ company_id: The ID of the company to list payments for
739
+
740
+ after: Returns the elements in the list that come after the specified cursor.
741
+
742
+ before: Returns the elements in the list that come before the specified cursor.
743
+
744
+ billing_reasons: The billing reason for the payment
745
+
746
+ created_after: The minimum creation date to filter by
747
+
748
+ created_before: The maximum creation date to filter by
749
+
750
+ currencies: The currency of the payment.
751
+
752
+ direction: The direction of the sort.
753
+
754
+ first: Returns the first _n_ elements from the list.
755
+
756
+ include_free: Whether to include free payments.
757
+
758
+ last: Returns the last _n_ elements from the list.
759
+
760
+ order: The order to sort the results by.
761
+
762
+ plan_ids: A specific plan.
763
+
764
+ product_ids: A specific product.
765
+
766
+ statuses: The status of the payment.
767
+
768
+ substatuses: The substatus of the payment.
769
+
770
+ extra_headers: Send extra headers
771
+
772
+ extra_query: Add additional query parameters to the request
773
+
774
+ extra_body: Add additional JSON properties to the request
775
+
776
+ timeout: Override the client-level default timeout for this request, in seconds
777
+ """
778
+ return self._get_api_list(
779
+ "/payments",
780
+ page=AsyncCursorPage[PaymentListResponse],
781
+ options=make_request_options(
782
+ extra_headers=extra_headers,
783
+ extra_query=extra_query,
784
+ extra_body=extra_body,
785
+ timeout=timeout,
786
+ query=maybe_transform(
787
+ {
788
+ "company_id": company_id,
789
+ "after": after,
790
+ "before": before,
791
+ "billing_reasons": billing_reasons,
792
+ "created_after": created_after,
793
+ "created_before": created_before,
794
+ "currencies": currencies,
795
+ "direction": direction,
796
+ "first": first,
797
+ "include_free": include_free,
798
+ "last": last,
799
+ "order": order,
800
+ "plan_ids": plan_ids,
801
+ "product_ids": product_ids,
802
+ "statuses": statuses,
803
+ "substatuses": substatuses,
804
+ },
805
+ payment_list_params.PaymentListParams,
806
+ ),
807
+ ),
808
+ model=PaymentListResponse,
809
+ )
810
+
811
+ async def refund(
812
+ self,
813
+ id: str,
814
+ *,
815
+ partial_amount: Optional[float] | Omit = omit,
816
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
817
+ # The extra values given here take precedence over values defined on the client or passed to this method.
818
+ extra_headers: Headers | None = None,
819
+ extra_query: Query | None = None,
820
+ extra_body: Body | None = None,
821
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
822
+ ) -> Payment:
823
+ """
824
+ Refunds a payment
825
+
826
+ Required permissions:
827
+
828
+ - `payment:manage`
829
+ - `plan:basic:read`
830
+ - `access_pass:basic:read`
831
+ - `member:email:read`
832
+ - `member:basic:read`
833
+ - `member:phone:read`
834
+ - `promo_code:basic:read`
835
+
836
+ Args:
837
+ partial_amount: An amount if the refund is supposed to be partial.
838
+
839
+ extra_headers: Send extra headers
840
+
841
+ extra_query: Add additional query parameters to the request
842
+
843
+ extra_body: Add additional JSON properties to the request
844
+
845
+ timeout: Override the client-level default timeout for this request, in seconds
846
+ """
847
+ if not id:
848
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
849
+ return await self._post(
850
+ f"/payments/{id}/refund",
851
+ body=await async_maybe_transform(
852
+ {"partial_amount": partial_amount}, payment_refund_params.PaymentRefundParams
853
+ ),
854
+ options=make_request_options(
855
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
856
+ ),
857
+ cast_to=Payment,
858
+ )
859
+
860
+ async def retry(
861
+ self,
862
+ id: str,
863
+ *,
864
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
865
+ # The extra values given here take precedence over values defined on the client or passed to this method.
866
+ extra_headers: Headers | None = None,
867
+ extra_query: Query | None = None,
868
+ extra_body: Body | None = None,
869
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
870
+ ) -> Payment:
871
+ """
872
+ Retries a payment
873
+
874
+ Required permissions:
875
+
876
+ - `payment:manage`
877
+ - `plan:basic:read`
878
+ - `access_pass:basic:read`
879
+ - `member:email:read`
880
+ - `member:basic:read`
881
+ - `member:phone:read`
882
+ - `promo_code:basic:read`
883
+
884
+ Args:
885
+ extra_headers: Send extra headers
886
+
887
+ extra_query: Add additional query parameters to the request
888
+
889
+ extra_body: Add additional JSON properties to the request
890
+
891
+ timeout: Override the client-level default timeout for this request, in seconds
892
+ """
893
+ if not id:
894
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
895
+ return await self._post(
896
+ f"/payments/{id}/retry",
897
+ options=make_request_options(
898
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
899
+ ),
900
+ cast_to=Payment,
901
+ )
902
+
903
+ async def void(
904
+ self,
905
+ id: str,
906
+ *,
907
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
908
+ # The extra values given here take precedence over values defined on the client or passed to this method.
909
+ extra_headers: Headers | None = None,
910
+ extra_query: Query | None = None,
911
+ extra_body: Body | None = None,
912
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
913
+ ) -> Payment:
914
+ """
915
+ Voids a payment
916
+
917
+ Required permissions:
918
+
919
+ - `payment:manage`
920
+ - `plan:basic:read`
921
+ - `access_pass:basic:read`
922
+ - `member:email:read`
923
+ - `member:basic:read`
924
+ - `member:phone:read`
925
+ - `promo_code:basic:read`
926
+
927
+ Args:
928
+ extra_headers: Send extra headers
929
+
930
+ extra_query: Add additional query parameters to the request
931
+
932
+ extra_body: Add additional JSON properties to the request
933
+
934
+ timeout: Override the client-level default timeout for this request, in seconds
935
+ """
936
+ if not id:
937
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
938
+ return await self._post(
939
+ f"/payments/{id}/void",
940
+ options=make_request_options(
941
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
942
+ ),
943
+ cast_to=Payment,
944
+ )
945
+
946
+
947
+ class PaymentsResourceWithRawResponse:
948
+ def __init__(self, payments: PaymentsResource) -> None:
949
+ self._payments = payments
950
+
951
+ self.create = to_raw_response_wrapper(
952
+ payments.create,
953
+ )
954
+ self.retrieve = to_raw_response_wrapper(
955
+ payments.retrieve,
956
+ )
957
+ self.list = to_raw_response_wrapper(
958
+ payments.list,
959
+ )
960
+ self.refund = to_raw_response_wrapper(
961
+ payments.refund,
962
+ )
963
+ self.retry = to_raw_response_wrapper(
964
+ payments.retry,
965
+ )
966
+ self.void = to_raw_response_wrapper(
967
+ payments.void,
968
+ )
969
+
970
+
971
+ class AsyncPaymentsResourceWithRawResponse:
972
+ def __init__(self, payments: AsyncPaymentsResource) -> None:
973
+ self._payments = payments
974
+
975
+ self.create = async_to_raw_response_wrapper(
976
+ payments.create,
977
+ )
978
+ self.retrieve = async_to_raw_response_wrapper(
979
+ payments.retrieve,
980
+ )
981
+ self.list = async_to_raw_response_wrapper(
982
+ payments.list,
983
+ )
984
+ self.refund = async_to_raw_response_wrapper(
985
+ payments.refund,
986
+ )
987
+ self.retry = async_to_raw_response_wrapper(
988
+ payments.retry,
989
+ )
990
+ self.void = async_to_raw_response_wrapper(
991
+ payments.void,
992
+ )
993
+
994
+
995
+ class PaymentsResourceWithStreamingResponse:
996
+ def __init__(self, payments: PaymentsResource) -> None:
997
+ self._payments = payments
998
+
999
+ self.create = to_streamed_response_wrapper(
1000
+ payments.create,
1001
+ )
1002
+ self.retrieve = to_streamed_response_wrapper(
1003
+ payments.retrieve,
1004
+ )
1005
+ self.list = to_streamed_response_wrapper(
1006
+ payments.list,
1007
+ )
1008
+ self.refund = to_streamed_response_wrapper(
1009
+ payments.refund,
1010
+ )
1011
+ self.retry = to_streamed_response_wrapper(
1012
+ payments.retry,
1013
+ )
1014
+ self.void = to_streamed_response_wrapper(
1015
+ payments.void,
1016
+ )
1017
+
1018
+
1019
+ class AsyncPaymentsResourceWithStreamingResponse:
1020
+ def __init__(self, payments: AsyncPaymentsResource) -> None:
1021
+ self._payments = payments
1022
+
1023
+ self.create = async_to_streamed_response_wrapper(
1024
+ payments.create,
1025
+ )
1026
+ self.retrieve = async_to_streamed_response_wrapper(
1027
+ payments.retrieve,
1028
+ )
1029
+ self.list = async_to_streamed_response_wrapper(
1030
+ payments.list,
1031
+ )
1032
+ self.refund = async_to_streamed_response_wrapper(
1033
+ payments.refund,
1034
+ )
1035
+ self.retry = async_to_streamed_response_wrapper(
1036
+ payments.retry,
1037
+ )
1038
+ self.void = async_to_streamed_response_wrapper(
1039
+ payments.void,
1040
+ )