Skip to content

Commit 4d6598c

Browse files
author
andela-sjames
authored
Merge pull request #39 from andela-sjames/develop
Develop
2 parents d275783 + 3c2e49e commit 4d6598c

File tree

8 files changed

+429
-100
lines changed

8 files changed

+429
-100
lines changed

README.md

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@ pip install paystackapi
1616
```python
1717
from paystackapi.paystack import Paystack
1818
paystack_secret_key = "5om3secretK3y"
19-
paystack = Paystack(secret_key=paystack_secret_key)
19+
paystack = Paystack(secret_key=paystack_secret_key)
2020

2121
# to use transaction class
2222
paystack.transaction.list()
2323

2424
# to use customer class
25-
paystack.customer.get(transaction_id)
25+
paystack.customer.get(transaction_id)
2626

2727
# to use plan class
28-
paystack.plan.get(plan_id)
28+
paystack.plan.get(plan_id)
29+
30+
# to use subscription class
31+
paystack.subscription.list()
2932
```
3033
#####Other methods can be found below...
3134

@@ -330,3 +333,90 @@ response = Customer.update(customer_id=24, first_name=None,
330333

331334
JSON data from paystack API.
332335

336+
## Subscription
337+
338+
##### `Subscription.create(customer, plan, authorization, start_date)` - Create subscription.
339+
340+
```python
341+
from paystackapi.subscription import Subscription
342+
response = Subscription.create(customer='CUS_xnxdt6s1zg1f4nx',
343+
plan='Pln_2yudUnIds2p',
344+
authorization='34',
345+
start_date=None)
346+
```
347+
348+
*Arguments*
349+
- `customer`: Customer's email address or customer code.
350+
- `plan`: Plan code.
351+
- `authorization`: customers authorization code.
352+
- `start_date`: the date for the first debit. (ISO 8601 format)
353+
354+
*Returns*
355+
356+
JSON data from paystack API.
357+
358+
##### `Subscription.fetch(subscription_id)` - Fetch subscription.
359+
360+
```python
361+
from paystackapi.subscription import Subscription
362+
response = Subscription.fetch(subscription_id=4033)
363+
```
364+
365+
*Arguments*
366+
- `subscription_id`: subscription id.
367+
368+
*Returns*
369+
370+
JSON data from paystack API.
371+
372+
373+
##### `Subscription.list()` - List subscriptions.
374+
375+
```python
376+
from paystackapi.subscription import Subscription
377+
response = Subscription.list()
378+
```
379+
380+
*Arguments*
381+
382+
No argument required.
383+
384+
*Returns*
385+
386+
JSON data from paystack API.
387+
388+
##### `Subscription.disable(code="SUB_vsyqdmlzble3uii",token="d7gofp6yppn3qz7")` - Disable subscriptions.
389+
390+
```python
391+
from paystackapi.subscription import Subscription
392+
response = Subscription.disable(code="SUB_vsyqdmlzble3uii",
393+
token="d7gofp6yppn3qz7")
394+
```
395+
396+
*Arguments*
397+
398+
*Arguments*
399+
- `code`: Subscription code.
400+
- `token`: Email token.
401+
402+
403+
*Returns*
404+
405+
JSON data from paystack API.
406+
407+
##### `Subscription.enable(code="SUB_vsyqdmlzble3uii",token="d7gofp6yppn3qz7")` - Enable subscriptions.
408+
409+
```python
410+
from paystackapi.subscription import Subscription
411+
response = Subscription.enable(code="SUB_vsyqdmlzble3uii",
412+
token="d7gofp6yppn3qz7")
413+
```
414+
415+
*Arguments*
416+
- `code`: Subscription code.
417+
- `token`: Email token.
418+
419+
420+
*Returns*
421+
422+
JSON data from paystack API.

0 commit comments

Comments
 (0)