Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Paynow Zimbabwe Python SDK

Python SDK for Paynow Zimbabwe's API
- Python SDK for Paynow Zimbabwe's API

# Prerequisites

This library has a set of prerequisites that must be met for it to work
- This library has a set of prerequisites that must be met for it to work

1. requests

# Installation

Install the library using pip
- Install the library using pip

```sh
$ pip install paynow
$ pip3 install paynow
```

and import the Paynow class into your project
- import the Paynow class into your project

```python
from paynow import Paynow
Expand All @@ -34,8 +34,8 @@ Create an instance of the Paynow class optionally setting the result and return
paynow = Paynow(
'INTEGRATION_ID',
'INTEGRATION_KEY',
'http://google.com',
'http://google.com'
'http://yourweb.com/returnurl', # merchant return url
'http://yourweb.com/results', # merchant result url
)
```

Expand All @@ -60,7 +60,7 @@ When you're finally ready to send your payment to Paynow, you can use the `send`
response = paynow.send(payment)
```

The response from Paynow will b have some useful information like whether the request was successful or not. If it was, for example, it contains the url to redirect the user so they can make the payment. You can view the full list of data contained in the response in our wiki
The response from Paynow will be having some useful information like whether the request was successful or not. If it was, for example, it contains the url to redirect the user so they can make the payment. You can view the full list of data contained in the response in our wiki

If request was successful, you should consider saving the poll url sent from Paynow in the database

Expand Down Expand Up @@ -118,12 +118,11 @@ else :
```python
from paynow import Paynow


paynow = Paynow(
'INTEGRATION_ID',
'INTEGRATION_KEY',
'http://google.com',
'http://google.com'
'http://yourweb.com/returnurl', # merchant return url
'http://yourweb.com/results', # merchant result url
)

payment = paynow.create_payment('Order', 'test@example.com')
Expand Down
6 changes: 3 additions & 3 deletions paynow/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@ class InitResponse:
"""

def __init__(self, data):
# TODO return dict of kwargs

self.status = data['status']
self.success = data['status'].lower() != 'error'
self.has_redirect = 'browserurl' in data
self.hash = 'hash' in data

if not self.success:
self.error = data['error']
return

self.poll_url = data['pollurl']

if not self.success:
self.error = data['error']

if self.has_redirect:
self.redirect_url = data['browserurl']

Expand Down