swarmauri_billing_paystack 0.9.3.dev3__py3-none-any.whl → 0.11.0.dev1__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.
@@ -22,6 +22,8 @@ from swarmauri_base.billing import (
22
22
  ProductRef,
23
23
  ProductSpec,
24
24
  ProductsPricesMixin,
25
+ RefundRequest,
26
+ RefundsMixin,
25
27
  RiskMixin,
26
28
  SplitSpec,
27
29
  SubscriptionSpec,
@@ -36,6 +38,7 @@ class PaystackBillingProvider(
36
38
  SubscriptionsMixin,
37
39
  InvoicingMixin,
38
40
  MarketplaceMixin,
41
+ RefundsMixin,
39
42
  RiskMixin,
40
43
  BillingProviderBase,
41
44
  ):
@@ -48,35 +51,55 @@ class PaystackBillingProvider(
48
51
  _sub: Any = PrivateAttr(default=None)
49
52
  _invoice: Any = PrivateAttr(default=None)
50
53
  _split: Any = PrivateAttr(default=None)
54
+ _refund: Any = PrivateAttr(default=None)
51
55
 
52
56
  def _ensure(self) -> None:
53
57
  if self._tx is None:
54
58
  from paystackapi.invoice import Invoice
55
59
  from paystackapi.paystack import Paystack
56
60
  from paystackapi.product import Product
57
- from paystackapi.split import Split
61
+ from paystackapi.refund import Refund
58
62
  from paystackapi.subscription import Subscription
59
63
  from paystackapi.transaction import Transaction
64
+ from paystackapi.transaction_split import TransactionSplit
60
65
 
61
66
  Paystack.SECRET_KEY = self.secret_key.get_secret_value()
62
- self._tx, self._product, self._sub, self._invoice, self._split = (
67
+ (
68
+ self._tx,
69
+ self._product,
70
+ self._sub,
71
+ self._invoice,
72
+ self._split,
73
+ self._refund,
74
+ ) = (
63
75
  Transaction,
64
76
  Product,
65
77
  Subscription,
66
78
  Invoice,
67
- Split,
79
+ TransactionSplit,
80
+ Refund,
68
81
  )
69
82
 
70
- # ---------------------------------------------------------------- Products & Prices
83
+ # ---------------------------------------------------------------- Products
84
+ # & Prices
71
85
  def _create_product(
72
86
  self, product_spec: ProductSpec, *, idempotency_key: str
73
87
  ) -> ProductRef:
74
88
  self._ensure()
89
+ payload = (
90
+ product_spec.payload
91
+ if isinstance(product_spec.payload, Mapping)
92
+ else {}
93
+ )
75
94
  resp = self._product.create(
76
95
  name=product_spec.name,
77
96
  description=product_spec.description or "",
78
- price=0,
79
- currency="NGN",
97
+ price=int(
98
+ payload.get("price") or payload.get("unit_amount_minor") or 0
99
+ ),
100
+ currency=str(payload.get("currency") or "NGN").upper(),
101
+ unlimited=bool(payload.get("unlimited", True)),
102
+ quantity=payload.get("quantity"),
80
103
  )
81
104
  if not resp.get("status"):
82
105
  raise RuntimeError(resp.get("message", "product create failed"))
@@ -100,6 +123,7 @@ class PaystackBillingProvider(
100
123
  description=price_spec.nickname or "",
101
124
  price=price_spec.unit_amount_minor,
102
125
  currency=price_spec.currency.upper(),
126
+ unlimited=True,
103
127
  )
104
128
  if not resp.get("status"):
105
129
  raise RuntimeError(resp.get("message", "price create failed"))
@@ -114,17 +138,22 @@ class PaystackBillingProvider(
114
138
  )
115
139
  return ref
116
140
 
117
- # ---------------------------------------------------------------- Hosted Checkout
141
+ # ---------------------------------------------------------------- Hosted
142
+ # Checkout
118
143
  def _create_checkout(
119
144
  self, price: PriceRef, request: CheckoutRequest
120
145
  ) -> CheckoutIntentRef:
121
146
  self._ensure()
122
147
  init = self._tx.initialize(
123
148
  reference=request.idempotency_key or f"chk-{price.id}",
124
- amount=price.raw["data"]["price"],
125
- currency=price.raw["data"]["currency"],
149
+ amount=price.unit_amount_minor or price.raw["data"]["price"],
150
+ currency=(price.currency or price.raw["data"]["currency"]).upper(),
126
151
  email=request.customer_email or "buyer@example.com",
127
- metadata={"product_id": price.product_id, "price_code": price.id},
152
+ metadata={
153
+ "product_id": price.product_id,
154
+ "price_code": price.id,
155
+ **(request.metadata or {}),
156
+ },
128
157
  callback_url=request.success_url,
129
158
  )
130
159
  if not init.get("status"):
@@ -137,15 +166,17 @@ class PaystackBillingProvider(
137
166
  )
138
167
  return intent
139
168
 
140
- # ---------------------------------------------------------------- Online Payments
169
+ # ---------------------------------------------------------------- Online
170
+ # Payments
141
171
  def _create_payment_intent(self, req: PaymentIntentRequest) -> PaymentRef:
142
172
  self._ensure()
173
+ metadata = dict(req.metadata or {})
143
174
  init = self._tx.initialize(
144
175
  reference=req.idempotency_key or "ref",
145
176
  amount=req.amount_minor,
146
177
  currency=req.currency.upper(),
147
- email="buyer@example.com",
148
- metadata=req.metadata,
178
+ email=metadata.pop("customer_email", "buyer@example.com"),
179
+ metadata=metadata,
149
180
  )
150
181
  if not init.get("status"):
151
182
  raise RuntimeError(init.get("message", "init failed"))
@@ -183,16 +214,23 @@ class PaystackBillingProvider(
183
214
  )
184
215
  return ref
185
216
 
186
- # ---------------------------------------------------------------- Subscriptions
217
+ # ----------------------------------------------------------------
218
+ # Subscriptions
187
219
  def _create_subscription(
188
220
  self, spec: SubscriptionSpec, *, idempotency_key: str
189
221
  ) -> Mapping[str, Any]:
190
222
  self._ensure()
191
- authorization = spec.metadata.get("authorization")
223
+ if not spec.items:
224
+ raise ValueError(
225
+ "Paystack subscription creation requires a plan code"
226
+ )
227
+ metadata = dict(spec.metadata or {})
228
+ authorization = metadata.get("authorization")
192
229
  sub = self._sub.create(
193
230
  customer=spec.customer_id,
194
231
  plan=spec.items[0].price_id,
195
232
  authorization=authorization,
233
+ start_date=metadata.get("start_date"),
196
234
  )
197
235
  if not sub.get("status"):
198
236
  raise RuntimeError(sub.get("message", "subscription failed"))
@@ -208,27 +246,46 @@ class PaystackBillingProvider(
208
246
  self, subscription_id: str, *, at_period_end: bool = True
209
247
  ) -> Mapping[str, Any]:
210
248
  self._ensure()
211
- res = self._sub.disable(code=subscription_id, token=None)
249
+ if ":" in subscription_id:
250
+ code, token = subscription_id.split(":", 1)
251
+ else:
252
+ code, token = subscription_id, None
253
+ res = self._sub.disable(code=code, token=token)
212
254
  result = {
213
- "subscription_code": subscription_id,
255
+ "subscription_code": code,
214
256
  "status": res.get("message", "disabled"),
215
257
  "provider": self.component_name,
216
258
  "raw": res,
217
259
  }
218
260
  return result
219
261
 
220
- # ---------------------------------------------------------------- Invoicing
262
+ # ----------------------------------------------------------------
263
+ # Invoicing
221
264
  def _create_invoice(
222
265
  self, spec: InvoiceSpec, *, idempotency_key: str
223
266
  ) -> Mapping[str, Any]:
224
267
  self._ensure()
225
268
  amount = sum((line.amount_minor or 0) for line in spec.line_items)
269
+ line_items = [
270
+ {
271
+ "name": line.description or line.price_id or "Invoice item",
272
+ "amount": line.amount_minor or 0,
273
+ "quantity": line.quantity,
274
+ }
275
+ for line in spec.line_items
276
+ ]
277
+ metadata = dict(spec.metadata or {})
226
278
  inv = self._invoice.create(
227
279
  customer=spec.customer_id,
228
280
  amount=amount,
229
- currency="NGN",
230
- due_date=None,
231
- description="Invoice",
281
+ currency=str(metadata.get("currency") or "NGN").upper(),
282
+ due_date=metadata.get("due_date"),
283
+ description=metadata.get("description", "Invoice"),
284
+ line_items=line_items or None,
285
+ send_notification=metadata.get("send_notification", True),
286
+ draft=metadata.get("draft", False),
287
+ has_invoice=metadata.get("has_invoice", True),
288
+ split_code=metadata.get("split_code"),
232
289
  )
233
290
  if not inv.get("status"):
234
291
  raise RuntimeError(inv.get("message", "invoice create failed"))
@@ -241,20 +298,22 @@ class PaystackBillingProvider(
241
298
  return result
242
299
 
243
300
  def _finalize_invoice(self, invoice_id: str) -> Mapping[str, Any]:
301
+ self._ensure()
302
+ res = self._invoice.finalize_draft(invoice_id)
244
303
  result = {
245
304
  "invoice_id": invoice_id,
246
- "status": "finalized",
305
+ "status": res.get("message", "finalized"),
247
306
  "provider": self.component_name,
248
- "raw": None,
307
+ "raw": res,
249
308
  }
250
309
  return result
251
310
 
252
311
  def _void_invoice(self, invoice_id: str) -> Mapping[str, Any]:
253
312
  self._ensure()
254
- res = self._invoice.notify(invoice_code=invoice_id)
313
+ res = self._invoice.archive(invoice_id)
255
314
  result = {
256
315
  "invoice_id": invoice_id,
257
- "status": "void_requested",
316
+ "status": res.get("message", "archived"),
258
317
  "provider": self.component_name,
259
318
  "raw": res,
260
319
  }
@@ -269,15 +328,22 @@ class PaystackBillingProvider(
269
328
  }
270
329
  return result
271
330
 
272
- # ---------------------------------------------------------------- Marketplace
331
+ # ----------------------------------------------------------------
332
+ # Marketplace
273
333
  def _create_split(
274
334
  self, spec: SplitSpec, *, idempotency_key: str
275
335
  ) -> Mapping[str, Any]:
276
336
  self._ensure()
277
- entries = [{"subaccount": e.account, "share": e.share} for e in spec.entries]
337
+ entries = [
338
+ {"subaccount": e.account, "share": e.share} for e in spec.entries
339
+ ]
340
+ if not entries:
341
+ raise ValueError(
342
+ "Paystack split creation requires at least one subaccount"
343
+ )
278
344
  sp = self._split.create(
279
345
  name=spec.name,
280
- type=spec.type,
346
+ type=spec.type or "percentage",
281
347
  currency=spec.currency.upper(),
282
348
  subaccounts=entries,
283
349
  bearer_type="account",
@@ -318,6 +384,43 @@ class PaystackBillingProvider(
318
384
  }
319
385
  return result
320
386
 
387
+ # ---------------------------------------------------------------- Refunds
388
+ def _create_refund(
389
+ self, payment: PaymentRef, req: RefundRequest, *, idempotency_key: str
390
+ ) -> Mapping[str, Any]:
391
+ self._ensure()
392
+ metadata = dict(req.metadata or {})
393
+ res = self._refund.create(
394
+ transaction=payment.id,
395
+ amount=req.amount_minor,
396
+ currency=(
397
+ payment.currency or metadata.get("currency") or "NGN"
398
+ ).upper(),
399
+ customer_note=req.reason,
400
+ merchant_note=metadata.get("merchant_note", req.reason),
401
+ )
402
+ if not res.get("status"):
403
+ raise RuntimeError(res.get("message", "refund create failed"))
404
+ data = res.get("data", {})
405
+ return {
406
+ "id": str(data.get("id") or data.get("refund_code") or payment.id),
407
+ "status": data.get("status", res.get("message")),
408
+ "provider": self.component_name,
409
+ "raw": res,
410
+ }
411
+
412
+ def _get_refund(self, refund_id: str) -> Mapping[str, Any]:
413
+ self._ensure()
414
+ res = self._refund.fetch(refund_id)
415
+ if not res.get("status"):
416
+ raise RuntimeError(res.get("message", "refund fetch failed"))
417
+ return {
418
+ "id": refund_id,
419
+ "status": res.get("data", {}).get("status"),
420
+ "provider": self.component_name,
421
+ "raw": res,
422
+ }
423
+
321
424
  # ---------------------------------------------------------------- Risk
322
425
  def _verify_webhook_signature(
323
426
  self, raw_body: bytes, headers: Mapping[str, str], secret: str
@@ -326,11 +429,15 @@ class PaystackBillingProvider(
326
429
  import hmac
327
430
 
328
431
  signature = headers.get("X-Paystack-Signature", "")
329
- digest = hmac.new(secret.encode(), raw_body, hashlib.sha512).hexdigest()
432
+ digest = hmac.new(
433
+ secret.encode(), raw_body, hashlib.sha512
434
+ ).hexdigest()
330
435
  result = hmac.compare_digest(digest, signature)
331
436
  return result
332
437
 
333
- def _list_disputes(self, *, limit: int = 50) -> Sequence[Mapping[str, Any]]:
438
+ def _list_disputes(
439
+ self, *, limit: int = 50
440
+ ) -> Sequence[Mapping[str, Any]]:
334
441
  from paystackapi.dispute import Dispute
335
442
 
336
443
  res = Dispute.list()
@@ -0,0 +1,224 @@
1
+ Metadata-Version: 2.4
2
+ Name: swarmauri_billing_paystack
3
+ Version: 0.11.0.dev1
4
+ Summary: Paystack-backed Swarmauri billing provider for checkout, payment initialization, subscriptions, invoices, refunds, splits, and webhook verification.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: swarmauri,sdk,billing,paystack,paystack billing provider,paystack payments,community,payments,payment gateway,hosted checkout,payment initialization,recurring billing,subscription management,invoicing,refunds,marketplace splits,webhook verification,merchant services,e-commerce integration
8
+ Author: Jacob Stewart
9
+ Author-email: jacob@swarmauri.com
10
+ Requires-Python: >=3.10,<3.15
11
+ Classifier: Development Status :: 1 - Planning
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Information Technology
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Topic :: Internet :: WWW/HTTP
17
+ Classifier: Topic :: Office/Business :: Financial
18
+ Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
21
+ Classifier: Programming Language :: Python
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3 :: Only
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: 3.14
29
+ Requires-Dist: paystackapi (>=2.0.0)
30
+ Requires-Dist: swarmauri_base
31
+ Requires-Dist: swarmauri_core
32
+ Description-Content-Type: text/markdown
33
+
34
+ ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
35
+
36
+ <p align="center">
37
+ <a href="https://pepy.tech/project/swarmauri_billing_paystack/">
38
+ <img src="https://static.pepy.tech/badge/swarmauri_billing_paystack/month" alt="PyPI - Downloads"/></a>
39
+ <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_billing_paystack/">
40
+ <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_billing_paystack.svg"/></a>
41
+ <a href="https://pypi.org/project/swarmauri_billing_paystack/">
42
+ <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
43
+ <a href="https://pypi.org/project/swarmauri_billing_paystack/">
44
+ <img src="https://img.shields.io/pypi/l/swarmauri_billing_paystack" alt="PyPI - License"/></a>
45
+ <a href="https://pypi.org/project/swarmauri_billing_paystack/">
46
+ <img src="https://img.shields.io/pypi/v/swarmauri_billing_paystack?label=swarmauri_billing_paystack&color=green" alt="PyPI - swarmauri_billing_paystack"/></a>
47
+ <a href="https://discord.gg/N4UpBuQv8T">
48
+ <img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
49
+
50
+ # Swarmauri Billing Paystack
51
+
52
+ `swarmauri_billing_paystack` provides a Paystack-backed billing provider for the Swarmauri SDK. It connects Swarmauri billing interfaces to the `paystackapi` SDK for products, price-like product codes, hosted checkout, payment initialization, subscriptions, invoices, refunds, marketplace splits, split charges, disputes, and Paystack webhook HMAC verification.
53
+
54
+ ## Why Swarmauri Billing Paystack?
55
+
56
+ Use `swarmauri_billing_paystack` when a Swarmauri application needs Paystack payment flows without coupling business logic directly to Paystack SDK calls. The provider keeps Paystack products, transactions, subscriptions, invoices, refunds, splits, and risk checks behind the same Swarmauri billing interfaces used by other billing providers.
57
+
58
+ ## FAQ
59
+
60
+ ### Q: Does this package call live Paystack APIs?
61
+
62
+ A: Yes. The provider imports `paystackapi`, sets `Paystack.SECRET_KEY`, and calls SDK classes such as `Transaction`, `Product`, `Subscription`, `Invoice`, `TransactionSplit`, `Refund`, and `Dispute`.
63
+
64
+ ### Q: Which Swarmauri billing flows does it support?
65
+
66
+ A: It supports product creation, price-like product creation, hosted checkout, payment initialization, subscription create/cancel, invoice create/finalize/archive/uncollectible flows, refund create/fetch, marketplace split creation, split charges, dispute listing, and webhook signature verification.
67
+
68
+ ### Q: What credential does it need?
69
+
70
+ A: Pass a Paystack secret key through `secret_key`. Tests and examples use sandbox-style keys such as `sk_test_...`; production deployments should load secrets from a secure environment or vault.
71
+
72
+ ## Features
73
+
74
+ - Paystack-backed provider class registered as `PaystackBillingProvider`.
75
+ - Product and price workflows built on Paystack product APIs.
76
+ - Hosted checkout and payment intent initialization through Paystack transactions.
77
+ - Subscription lifecycle methods for creating and disabling subscriptions.
78
+ - Invoice creation and notification-oriented invoice actions.
79
+ - Refund creation and lookup through Paystack refund APIs.
80
+ - Marketplace split creation and split-charge initialization.
81
+ - Paystack webhook signature verification with `X-Paystack-Signature` and HMAC-SHA512.
82
+ - Python 3.10, 3.11, 3.12, 3.13, and 3.14 support.
83
+
84
+ ## Installation
85
+
86
+ Install with `uv`:
87
+
88
+ ```bash
89
+ uv add swarmauri_billing_paystack
90
+ ```
91
+
92
+ Install with `pip`:
93
+
94
+ ```bash
95
+ pip install swarmauri_billing_paystack
96
+ ```
97
+
98
+ ## Usage
99
+
100
+ Create a product, price, and Paystack checkout session:
101
+
102
+ ```python
103
+ from swarmauri_billing_paystack import PaystackBillingProvider
104
+ from swarmauri_base.billing import CheckoutRequest, PriceSpec, ProductSpec
105
+
106
+ provider = PaystackBillingProvider(
107
+ api_key="paystack",
108
+ secret_key="sk_test_xxxxx",
109
+ )
110
+
111
+ product = provider.create_product(
112
+ ProductSpec(name="Learning Portal", description="Online academy access"),
113
+ idempotency_key="paystack-prod-001",
114
+ )
115
+
116
+ price = provider.create_price(
117
+ product,
118
+ PriceSpec(currency="NGN", unit_amount_minor=150000, nickname="Annual"),
119
+ idempotency_key="paystack-price-001",
120
+ )
121
+
122
+ checkout = provider.create_checkout(
123
+ price,
124
+ CheckoutRequest(
125
+ quantity=1,
126
+ success_url="https://merchant.example/paystack/callback",
127
+ customer_email="learner@example.com",
128
+ idempotency_key="paystack-checkout-001",
129
+ ),
130
+ )
131
+
132
+ print(product.id, price.id, checkout.url)
133
+ ```
134
+
135
+ Initialize a Paystack payment intent:
136
+
137
+ ```python
138
+ from swarmauri_billing_paystack import PaystackBillingProvider
139
+ from swarmauri_base.billing import PaymentIntentRequest
140
+
141
+ provider = PaystackBillingProvider(
142
+ api_key="paystack",
143
+ secret_key="sk_test_xxxxx",
144
+ )
145
+
146
+ payment = provider.create_payment_intent(
147
+ PaymentIntentRequest(
148
+ amount_minor=500000,
149
+ currency="NGN",
150
+ idempotency_key="paystack-payment-001",
151
+ metadata={"order_id": "order-1001"},
152
+ )
153
+ )
154
+
155
+ print(payment.id, payment.status)
156
+ ```
157
+
158
+ Verify a Paystack webhook signature:
159
+
160
+ ```python
161
+ from swarmauri_billing_paystack import PaystackBillingProvider
162
+
163
+ provider = PaystackBillingProvider(
164
+ api_key="paystack",
165
+ secret_key="sk_test_xxxxx",
166
+ )
167
+
168
+ is_valid = provider.verify_webhook_signature(
169
+ raw_body=b'{"event":"charge.success"}',
170
+ headers={"X-Paystack-Signature": "expected-hmac"},
171
+ secret="sk_test_xxxxx",
172
+ )
173
+
174
+ print(is_valid)
175
+ ```
176
+
177
+ ## Important Scope Notes
178
+
179
+ This package uses Paystack SDK calls for provider operations. Network access, Paystack credentials, API availability, account configuration, and Paystack response formats affect runtime behavior. Use sandbox keys for development and isolate live credentials through deployment secrets.
180
+
181
+ ## Entry Point
182
+
183
+ The package exposes a Swarmauri billing provider entry point:
184
+
185
+ ```toml
186
+ [project.entry-points.'swarmauri.billing_providers']
187
+ PaystackBillingProvider = "swarmauri_billing_paystack.provider:PaystackBillingProvider"
188
+ ```
189
+
190
+ ## Related Packages
191
+
192
+ Billing provider packages:
193
+
194
+ - [swarmauri_billing_adyen](https://pypi.org/project/swarmauri_billing_adyen/)
195
+ - [swarmauri_billing_authorize_net](https://pypi.org/project/swarmauri_billing_authorize_net/)
196
+ - [swarmauri_billing_braintree](https://pypi.org/project/swarmauri_billing_braintree/)
197
+ - [swarmauri_billing_mock](https://pypi.org/project/swarmauri_billing_mock/)
198
+ - [swarmauri_billing_paypal](https://pypi.org/project/swarmauri_billing_paypal/)
199
+ - [swarmauri_billing_razorpay](https://pypi.org/project/swarmauri_billing_razorpay/)
200
+ - [swarmauri_billing_square](https://pypi.org/project/swarmauri_billing_square/)
201
+ - [swarmauri_billing_stripe](https://pypi.org/project/swarmauri_billing_stripe/)
202
+
203
+ Foundational packages:
204
+
205
+ - [swarmauri_core](https://pypi.org/project/swarmauri_core/) defines billing capabilities and interfaces.
206
+ - [swarmauri_base](https://pypi.org/project/swarmauri_base/) provides billing specs, refs, mixins, and `BillingProviderBase`.
207
+ - [swarmauri](https://pypi.org/project/swarmauri/) provides namespace imports and plugin discovery.
208
+
209
+ ## Documentation
210
+
211
+ - [Paystack provider source](swarmauri_billing_paystack/provider.py)
212
+ - [Swarmauri SDK repository](https://github.com/swarmauri/swarmauri-sdk)
213
+ - [Paystack API documentation](https://paystack.com/docs/api/)
214
+
215
+ ## License
216
+
217
+ Apache-2.0
218
+
219
+ ## Contributing
220
+
221
+ Contributions that expand Paystack coverage or improve resiliency are welcome. Include request and response traces with secrets redacted, update usage examples, and add tests for each billing capability you change.
222
+
223
+
224
+
@@ -0,0 +1,7 @@
1
+ swarmauri_billing_paystack/__init__.py,sha256=eShhSnlceqDDYlGrggPBsgxZCAfk4ErilkcR1HGdC-4,127
2
+ swarmauri_billing_paystack/provider.py,sha256=-L2t-kH1u4dXtr3PKgebii842vvphL-pjo-nN64e5t0,14886
3
+ swarmauri_billing_paystack-0.11.0.dev1.dist-info/METADATA,sha256=SbrMiubyuG2LdI-_rznc9F3BFOCL36jeuqRr3Xa8go8,9529
4
+ swarmauri_billing_paystack-0.11.0.dev1.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
5
+ swarmauri_billing_paystack-0.11.0.dev1.dist-info/entry_points.txt,sha256=XFT16iRLcdlXMxVu0NSkxg12DRW7F48ZWpnOX9vYIiA,115
6
+ swarmauri_billing_paystack-0.11.0.dev1.dist-info/licenses/LICENSE,sha256=djUXOlCxLVszShEpZXshZ7v33G-2qIC_j9KXpWKZSzQ,11359
7
+ swarmauri_billing_paystack-0.11.0.dev1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.4.0
2
+ Generator: poetry-core 2.4.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,107 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: swarmauri_billing_paystack
3
- Version: 0.9.3.dev3
4
- Summary: Paystack billing provider for the Swarmauri SDK.
5
- License-Expression: Apache-2.0
6
- License-File: LICENSE
7
- Keywords: swarmauri,sdk,billing,paystack,community,payments,payment gateway,recurring billing,subscription management,merchant services,e-commerce integration
8
- Author: Jacob Stewart
9
- Author-email: jacob@swarmauri.com
10
- Requires-Python: >=3.10,<3.15
11
- Classifier: Development Status :: 1 - Planning
12
- Classifier: Intended Audience :: Developers
13
- Classifier: Intended Audience :: Information Technology
14
- Classifier: License :: OSI Approved :: Apache Software License
15
- Classifier: Operating System :: OS Independent
16
- Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
17
- Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
18
- Classifier: Programming Language :: Python
19
- Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3 :: Only
21
- Classifier: Programming Language :: Python :: 3.10
22
- Classifier: Programming Language :: Python :: 3.11
23
- Classifier: Programming Language :: Python :: 3.12
24
- Classifier: Programming Language :: Python :: 3.13
25
- Classifier: Programming Language :: Python :: 3.14
26
- Requires-Dist: paystackapi (>=2.0.0)
27
- Requires-Dist: swarmauri_base
28
- Requires-Dist: swarmauri_core
29
- Description-Content-Type: text/markdown
30
-
31
- ![Swarmauri Logo](https://raw.githubusercontent.com/swarmauri/swarmauri-sdk/master/assets/swarmauri_sdk_brand.png)
32
-
33
- <p align="center">
34
- <a href="https://pepy.tech/project/swarmauri_billing_paystack/">
35
- <img src="https://static.pepy.tech/badge/swarmauri_billing_paystack/month" alt="PyPI - Downloads"/></a>
36
- <a href="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_billing_paystack/">
37
- <img alt="Hits" src="https://hits.sh/github.com/swarmauri/swarmauri-sdk/tree/master/pkgs/community/swarmauri_billing_paystack.svg"/></a>
38
- <a href="https://pypi.org/project/swarmauri_billing_paystack/">
39
- <img src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-blue" alt="PyPI - Python Version"/></a>
40
- <a href="https://pypi.org/project/swarmauri_billing_paystack/">
41
- <img src="https://img.shields.io/pypi/l/swarmauri_billing_paystack" alt="PyPI - License"/></a>
42
- <a href="https://pypi.org/project/swarmauri_billing_paystack/">
43
- <img src="https://img.shields.io/pypi/v/swarmauri_billing_paystack?label=swarmauri_billing_paystack&color=green" alt="PyPI - swarmauri_billing_paystack"/></a>
44
- </p>
45
-
46
- # Swarmauri Billing Paystack
47
-
48
- The **Swarmauri Billing Paystack** package provides an integration between the Paystack API and the Swarmauri billing interfaces. It exposes product, price, hosted checkout, payment intent, subscription, invoice, and split operations powered by the `paystackapi` SDK.
49
-
50
- ## Features
51
-
52
- - ✅ Manages Paystack products and price codes with Swarmauri references.
53
- - ✅ Initializes hosted checkout sessions and card-not-present payments.
54
- - ✅ Integrates Paystack's subscription lifecycle endpoints.
55
- - ✅ Issues invoices and forwards notifications as required.
56
- - ✅ Configures split codes and marketplace charges while validating webhooks.
57
-
58
- ## Installation
59
-
60
- ```bash
61
- pip install swarmauri_billing_paystack
62
- ```
63
-
64
- ```bash
65
- uv add swarmauri_billing_paystack
66
- ```
67
-
68
- ## Usage
69
-
70
- ```python
71
- from swarmauri_billing_paystack import PaystackBillingProvider
72
- from swarmauri_base.billing import CheckoutRequest, PriceSpec, ProductSpec
73
-
74
- provider = PaystackBillingProvider(secret_key="sk_test_xxxxx")
75
-
76
- product = provider.create_product(
77
- ProductSpec(name="Learning Portal", description="Online academy access"),
78
- idempotency_key="paystack-prod-001",
79
- )
80
-
81
- price = provider.create_price(
82
- product,
83
- PriceSpec(currency="NGN", unit_amount_minor=150000, nickname="Annual"),
84
- idempotency_key="paystack-price-001",
85
- )
86
-
87
- checkout = provider.create_checkout(
88
- price,
89
- CheckoutRequest(
90
- quantity=1,
91
- success_url="https://merchant.example/paystack/callback",
92
- customer_email="learner@example.com",
93
- idempotency_key="paystack-checkout-001",
94
- ),
95
- )
96
-
97
- print(product.id, price.id, checkout.url)
98
- ```
99
-
100
- ## Capability Mapping
101
-
102
- All Paystack features surfaced here align with `swarmauri_core.billing.Capability`. Translate them to tigrbl using `capabilities_to_tigrbl` when coordinating with legacy services.
103
-
104
- ## Contributing
105
-
106
- Contributions that expand Paystack coverage or improve resiliency are appreciated. Please include request/response traces (with secrets redacted) when filing bugs.
107
-
@@ -1,7 +0,0 @@
1
- swarmauri_billing_paystack/__init__.py,sha256=eShhSnlceqDDYlGrggPBsgxZCAfk4ErilkcR1HGdC-4,127
2
- swarmauri_billing_paystack/provider.py,sha256=kryfnWBrNaWWrshpa29Poc1gyyevGhM3KHHi5deldGs,11107
3
- swarmauri_billing_paystack-0.9.3.dev3.dist-info/METADATA,sha256=CL8ApS0NMWXjqOCe3NK8y_zlQG9A-rkdHR4lwey70S4,4629
4
- swarmauri_billing_paystack-0.9.3.dev3.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
5
- swarmauri_billing_paystack-0.9.3.dev3.dist-info/entry_points.txt,sha256=XFT16iRLcdlXMxVu0NSkxg12DRW7F48ZWpnOX9vYIiA,115
6
- swarmauri_billing_paystack-0.9.3.dev3.dist-info/licenses/LICENSE,sha256=djUXOlCxLVszShEpZXshZ7v33G-2qIC_j9KXpWKZSzQ,11359
7
- swarmauri_billing_paystack-0.9.3.dev3.dist-info/RECORD,,