-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xendit-devx-bot
committed
Nov 29, 2023
1 parent
6c60b12
commit 988b18b
Showing
134 changed files
with
3,658 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,4 @@ target/ | |
.ipynb_checkpoints | ||
|
||
.vscode/ | ||
test.py | ||
|
||
# virtual environment | ||
xendit-python | ||
test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Configuration | ||
|
||
To start using the API, you need to configure the secret key and initiate the client instance. | ||
You can use all the configurable parameters in the `configuration.py` file to customize your client (e.g. setting up proxy) | ||
|
||
## Configuration Parameters | ||
|
||
Here are the parameters you can set: | ||
|
||
| Name | Type | Description | Default | Example | | ||
|-------------|:----------:|:---------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|--------------------------------------------------------------------------| | ||
| **host** | **str** | Base URL | https://api.xendit.co | https://www.example.com | | ||
| **api_key** | **str** | Xendit API Key | None | `xnd_development_abcdefghijke9112015j1nuq808912tr` | | ||
| **proxy** | **str** | Proxy URL | None | https://www.proxy.example.com | | ||
| **ssl_ca_cert** | **str** | Specifies the path to a PEM format CA certificate files, which can be used to verify the backend server certificates | None | `/path/to/your/example_cert.crt` | | ||
| **logger** | **map** | Logging Settings (e.g. `package_logger`, `urllib3_logger`) | `{"package_logger": "xendit", "urllib3_logger": "urllib3"}` | `{"package_logger": "your_logger_package", "urllib3_logger": "urllib3"}` | | ||
| **logger_format** | **str** | Log format | `%(asctime)s %(levelname)s %(message)s` | `%(asctime)s %(levelname)s %(message)s` | | ||
| **logger_file** | **str** | Debug file location | None | `/path/to/your/debug_file.txt` | | ||
| **debug** | **bool** | Debug Switch | `False` | `True` | | ||
| **connection_pool_maxsize** | **number** | urllib3 connection pool's maximum number of connections saved per pool. | `multiprocessing.cpu_count() * 5` | 5 | | ||
|
||
## Sample Usage | ||
|
||
Some parameters are able to set during initialization, e.g. `host`, `api_key` | ||
Some are set after initialization, e.g. `proxy` | ||
|
||
```python | ||
import xendit | ||
|
||
configuration = xendit.Configuration( | ||
host='https://www.example.com', | ||
api_key='xnd_development_abcdefghijke9112015j1nuq808912tr' | ||
) | ||
configuration.proxy = 'https://www.proxy.example.com' | ||
configuration.ssl_ca_cert = '/path/to/your/example_cert.crt' | ||
configuration.logger["package_logger"] = 'your_logger_package' | ||
configuration.logger["urllib3_logger"] = 'urllib3_logger' | ||
configuration.logger_format = '%(asctime)s %(levelname)s %(message)s`' | ||
configuration.logger_file = 'path/to/your/debug_file.txt' | ||
configuration.connection_pool_maxsize = 10 | ||
|
||
# Enter a context with an instance of the API client | ||
api_client = xendit.ApiClient(configuration) | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,7 +146,7 @@ create_invoice_request = CreateInvoiceRequest( | |
), | ||
], | ||
) # CreateInvoiceRequest | ||
for_user_id = "62efe4c33e45694d63f585f8" # str | Business ID of the sub-account merchant (XP feature) | ||
for_user_id = "62efe4c33e45694d63f585f0" # str | Business ID of the sub-account merchant (XP feature) | ||
|
||
# example passing only required values which don't have defaults set | ||
try: | ||
|
@@ -204,7 +204,7 @@ api_client = xendit.ApiClient() | |
# Create an instance of the API class | ||
api_instance = InvoiceApi(api_client) | ||
invoice_id = "62efe4c33e45294d63f585f2" # str | Invoice ID | ||
for_user_id = "62efe4c33e45694d63f585f8" # str | Business ID of the sub-account merchant (XP feature) | ||
for_user_id = "62efe4c33e45694d63f585f0" # str | Business ID of the sub-account merchant (XP feature) | ||
|
||
# example passing only required values which don't have defaults set | ||
try: | ||
|
@@ -275,7 +275,7 @@ xendit.set_api_key('XENDIT API KEY') | |
api_client = xendit.ApiClient() | ||
# Create an instance of the API class | ||
api_instance = InvoiceApi(api_client) | ||
for_user_id = "62efe4c33e45694d63f585f8" # str | Business ID of the sub-account merchant (XP feature) | ||
for_user_id = "62efe4c33e45694d63f585f0" # str | Business ID of the sub-account merchant (XP feature) | ||
external_id = "test-external" # str | ||
statuses = [ | ||
InvoiceStatus("["PENDING","SETTLED"]"), | ||
|
@@ -342,7 +342,7 @@ api_client = xendit.ApiClient() | |
# Create an instance of the API class | ||
api_instance = InvoiceApi(api_client) | ||
invoice_id = "5f4708b7bd394b0400b96276" # str | Invoice ID to be expired | ||
for_user_id = "62efe4c33e45694d63f585f8" # str | Business ID of the sub-account merchant (XP feature) | ||
for_user_id = "62efe4c33e45694d63f585f0" # str | Business ID of the sub-account merchant (XP feature) | ||
|
||
# example passing only required values which don't have defaults set | ||
try: | ||
|
@@ -362,4 +362,47 @@ except xendit.XenditSdkException as e: | |
print("Exception when calling InvoiceApi->expire_invoice: %s\n" % e) | ||
``` | ||
|
||
|
||
## Callback Objects | ||
Use the following callback objects provided by Xendit to receive callbacks (also known as webhooks) that Xendit sends you on events, such as successful payments. Note that the example is meant to illustrate the contents of the callback object -- you will not need to instantiate these objects in practice | ||
### InvoiceCallback Object | ||
>Invoice Callback Object | ||
Model Documentation: [InvoiceCallback](/InvoiceCallback.md) | ||
#### Usage Example | ||
Note that the example is meant to illustrate the contents of the callback object -- you will not need to instantiate these objects in practice | ||
```python | ||
import xendit | ||
from xendit.invoice.model import InvoiceCallback | ||
import json | ||
from pprint import pprint | ||
|
||
invoice_callback_obj = { | ||
"id" : "593f4ed1c3d3bb7f39733d83", | ||
"external_id" : "testing-invoice", | ||
"user_id" : "5848fdf860053555135587e7", | ||
"payment_method" : "RETAIL_OUTLET", | ||
"status" : "PAID", | ||
"merchant_name" : "Xendit", | ||
"amount" : 2000000, | ||
"paid_amount" : 2000000, | ||
"paid_at" : "2020-01-14T02:32:50.912Z", | ||
"payer_email" : "[email protected]", | ||
"description" : "Invoice webhook test", | ||
"created" : "2020-01-13T02:32:49.827Z", | ||
"updated" : "2020-01-13T02:32:50.912Z", | ||
"currency" : "IDR", | ||
"payment_channel" : "ALFAMART", | ||
"payment_destination" : "TEST815" | ||
} | ||
invoice_callback_json = json.dumps(invoice_callback_obj) | ||
``` | ||
|
||
You may then use the callback object in your webhook or callback handler like so, | ||
```python | ||
def SimulateInvoiceCallback(invoice_callback_json) { | ||
callback_obj = InvoiceCallback(**json.loads(invoice_callback_json)) | ||
// do things here with the callback | ||
} | ||
``` | ||
[[Back to README]](../README.md) |
Oops, something went wrong.