From 03869f6ba7806759f9ae7bbcfb72a3b59df6bbbb Mon Sep 17 00:00:00 2001 From: Israel Goytom Date: Thu, 2 Jun 2022 01:07:27 -0600 Subject: [PATCH] Add callback param and change the redirect_url to callback_url. (#3) --- README.md | 4 ++-- chapa/api.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2353c44..b6e7f18 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ data = { 'last_name': 'Bikila', 'tx_ref': '', # optional - 'redirect_url': 'https://www.your-site.com/callback', + 'callback_url': 'https://www.your-site.com/callback', 'customization': { 'title': '', 'description': 'Payment for your services', @@ -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 | diff --git a/chapa/api.py b/chapa/api.py index 83d62d3..83debcb 100644 --- a/chapa/api.py +++ b/chapa/api.py @@ -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 @@ -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. @@ -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: