|
| 1 | +# Solidgate API |
| 2 | + |
1 | 3 | [](https://badge.fury.io/py/solidgate-sdk)
|
2 | 4 |
|
3 |
| -# SolidGate API |
4 |
| -This library provides basic API options of SolidGate payment gateway. |
| 5 | +Python SDK provides API options for integrating Solidgate’s payment orchestrator into your Python applications. |
| 6 | + |
| 7 | +Check our |
| 8 | +* <a href="https://docs.solidgate.com/" target="_blank">Payment guide</a> to understand business value better |
| 9 | +* <a href="https://api-docs.solidgate.com/" target="_blank">API Reference</a> to find more examples of usage |
| 10 | + |
| 11 | +## Structure |
| 12 | + |
| 13 | +<table style="width: 100%; background: transparent;"> |
| 14 | + <colgroup> |
| 15 | + <col style="width: 50%;"> |
| 16 | + <col style="width: 50%;"> |
| 17 | + </colgroup> |
| 18 | + <tr> |
| 19 | + <th>SDK for Python contains</th> |
| 20 | + <th>Table of contents</th> |
| 21 | + </tr> |
| 22 | + <tr> |
| 23 | + <td> |
| 24 | + <ul> |
| 25 | + <li> |
| 26 | + <code>solidgate/</code> – main library source code for development |
| 27 | + <ul> |
| 28 | + <li><code>__init__.py</code> – initializes the SDK package for importing</li> |
| 29 | + <li><code>api_client.py</code> – main file for API integration and HTTP request handling</li> |
| 30 | + <li><code>encryption.py</code> – library for encryption-related operations</li> |
| 31 | + <li><code>model.py</code> – defines data structures for payment attributes and responses</li> |
| 32 | + </ul> |
| 33 | + </li> |
| 34 | + <li><code>setup.py</code> – script for managing dependencies and library imports</li> |
| 35 | + </ul> |
| 36 | + </td> |
| 37 | + <td> |
| 38 | + <a href="https://github.com/solidgate-tech/python-sdk?tab=readme-ov-file#requirements">Requirements</a><br> |
| 39 | + <a href="https://github.com/solidgate-tech/python-sdk?tab=readme-ov-file#installation">Installation</a><br> |
| 40 | + <a href="https://github.com/solidgate-tech/python-sdk?tab=readme-ov-file#usage">Usage</a><br> |
| 41 | + <a href="https://github.com/solidgate-tech/python-sdk?tab=readme-ov-file#errors">Errors</a><br> |
| 42 | + </td> |
| 43 | + </tr> |
| 44 | +</table> |
| 45 | + |
| 46 | +<br> |
5 | 47 |
|
6 | 48 | ## Requirements
|
7 | 49 |
|
8 |
| -- Python 3.7 |
9 |
| -- Packages: requests |
10 |
| -- SolidGate account. If you don’t have this you can request it by contacting [email protected] |
| 50 | +* **Python**: 3.7 or later |
| 51 | +* **Packages**: `requests` library |
| 52 | +* **Solidgate account **: Public and secret key (request via < a href= "mailto:[email protected]"> [email protected]</ a>) |
| 53 | + |
| 54 | +<br> |
11 | 55 |
|
12 | 56 | ## Installation
|
13 | 57 |
|
14 |
| -Use pip command: ```pip3 install solidgate-card-sdk``` |
| 58 | +To start using the Python SDK: |
| 59 | + |
| 60 | +1. Ensure you have your public and secret key. |
| 61 | +2. Install the SDK in your project using pip: |
| 62 | + ```bash |
| 63 | + pip install solidgate-card-sdk |
| 64 | + ``` |
| 65 | +3. Import the classes into your project: |
| 66 | + ``` |
| 67 | + from solidgate import ApiClient |
| 68 | + client = ApiClient(public_key='YourMerchantId', secret_key='YourPrivateKey') |
| 69 | + ``` |
| 70 | +4. Use test credentials for integration testing. After successful testing, switch to production credentials. |
| 71 | + |
| 72 | +<br> |
15 | 73 |
|
16 | 74 | ## Usage
|
17 | 75 |
|
18 |
| -Create a class instance of the 'ApiClient' class. |
| 76 | +### Charge a payment |
| 77 | + |
| 78 | +Create a class instance of the `ApiClient` class. |
| 79 | + |
19 | 80 | ```
|
20 | 81 | from solidgate import ApiClient
|
21 | 82 |
|
22 | 83 | client = ApiClient(public_key, secret_key)
|
23 | 84 | ```
|
24 |
| -- public_key - unique merchant identification; |
25 |
| -- secret_key - secret code for request signature. It's provided at the moment of merchant registration. |
26 | 85 |
|
27 |
| -## Documentation |
28 |
| -* https://docs.solidgate.com |
| 86 | +- `public_key` - unique merchant identification |
| 87 | +- `secret_key` - secret code for request signature, it is provided at the moment of merchant registration |
| 88 | + |
| 89 | +### Resign form |
| 90 | + |
| 91 | +```python |
| 92 | +response = client.form_resign({'order_id': '12345'}) |
| 93 | +``` |
| 94 | + |
| 95 | +<br> |
| 96 | + |
| 97 | +## Errors |
| 98 | + |
| 99 | +Handle <a href="https://docs.solidgate.com/payments/payments-insights/error-codes/" target="_blank">errors</a>. |
29 | 100 |
|
30 |
| -## Support |
31 |
| -If you have any problems, questions or suggestions send your inquiry to [email protected]. |
| 101 | +```python |
| 102 | +try: |
| 103 | + response = client.charge({...}) |
| 104 | +except Exception as e: |
| 105 | + print(e) |
| 106 | +``` |
0 commit comments