Skip to content

Commit

Permalink
Add callback param and change the redirect_url to callback_url. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
isrugeek committed Jun 2, 2022
1 parent 0d08fb5 commit 03869f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data = {
'last_name': 'Bikila',
'tx_ref': '<your-unique-transaction-id>',
# optional
'redirect_url': 'https://www.your-site.com/callback',
'callback_url': 'https://www.your-site.com/callback',
'customization': {
'title': '<Your-Company>',
'description': 'Payment for your services',
Expand Down Expand Up @@ -75,7 +75,7 @@ Base endpoint https://api.chapa.co/v1
| `last_name` | `string` | **Required**. A customer’s last name. |
| `tx_ref` | `string` | **Required**. A unique reference given to each transaction. |
| `currency` | `string` | **Required**. The currency in which all the charges are made. Currency allowed is ETB. |
| `redirect_url` | `string` | The URL to redirect the customer to after payment is done. |
| `callback_url` | `string` | The URL to redirect the customer to after payment is done. |
| `customization[title]` | `string` | The customizations field (optional) allows you to customize the look and feel of the payment modal. You can set a logo, the store name to be displayed (title), and a description for the payment. |

| HEADER Key | Value |
Expand Down
8 changes: 4 additions & 4 deletions chapa/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _construct_request(self, *args, **kwargs):
return res

def initialize(self, email: str, amount: int, first_name: str, last_name: str, tx_ref: str,
currency='ETB', redirect_url=None, customization=None, headers=None):
currency='ETB', callback_url=None, customization=None, headers=None):
"""
Initialize the Transaction
Expand All @@ -100,7 +100,7 @@ def initialize(self, email: str, amount: int, first_name: str, last_name: str, t
last_name (str): last name of the customer
tx_ref (str): your transaction id
currency (str, optional): currency the transaction. Defaults to 'ETB'.
redirect_url (str, optional): url for the customer to redirect after payment.
callback_url (str, optional): url for the customer to redirect after payment.
Defaults to None.
customization (dict, optional): customization, currently 'title' and 'description'
are available. Defaults to None.
Expand Down Expand Up @@ -134,8 +134,8 @@ def initialize(self, email: str, amount: int, first_name: str, last_name: str, t

data['email'] = email

if redirect_url:
data['redirect_url'] = redirect_url
if callback_url:
data['callback_url'] = callback_url

if customization:
if 'title' in customization:
Expand Down

0 comments on commit 03869f6

Please sign in to comment.