payra-sdk 1.2.3__tar.gz → 1.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- EXCHANGE_RATE_API_KEY=
2
- EXCHANGE_RATE_CACHE_TIME=720 # in minutes
1
+ PAYRA_EXCHANGE_RATE_API_KEY=
2
+ PAYRA_EXCHANGE_RATE_CACHE_TIME=720 # in minutes
3
3
 
4
4
  PAYRA_POLYGON_CORE_FORWARD_CONTRACT_ADDRESS=0xf30070da76B55E5cB5750517E4DECBD6Cc5ce5a8
5
5
  PAYRA_POLYGON_PRIVATE_KEY=
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: payra_sdk
3
- Version: 1.2.3
3
+ Version: 1.2.5
4
4
  Summary: Python SDK for Payra payment signature generation (backend)
5
5
  Author: Your Name
6
6
  Author-email: Wraith <contact@payra.cash>
@@ -26,7 +26,7 @@ Dynamic: license-file
26
26
 
27
27
  # Payra Python SDK
28
28
 
29
- Official Python SDK for integrating **Payra's on-chain payment system** into your backend applications.
29
+ Official **Python SDK** for integrating **Payra's on-chain payment system** into your backend applications.
30
30
 
31
31
  This SDK provides:
32
32
  - Secure generation of **ECDSA signatures** compatible with the Payra smart contract — used for order payment verification.
@@ -36,40 +36,40 @@ This SDK provides:
36
36
 
37
37
  The typical flow for signing and verifying a Payra transaction:
38
38
 
39
- 1. The **frontend** prepares all required payment parameters:
40
- - **Network** – blockchain name (e.g. Polygon, Linea)
41
- - **Token address** – ERC-20 token contract address
42
- - **Order ID** – unique order identifier
43
- - **AmountWei** – already converted to the smallest unit (e.g. wei, 10⁶)
44
- - **Timestamp** – Unix timestamp of the order
45
- - **Payer wallet address**
46
-
47
- 2. The frontend sends these parameters to your **backend**.
48
- 3. The **backend** uses this SDK to generate a cryptographic **ECDSA signature** with its private key (performed **offline**).
49
- 4. The backend returns the generated signature to the frontend.
50
- 5. The **frontend** calls the Payra smart contract (`payOrder`) with all parameters **plus** the signature.
39
+ 1. The **frontend** prepares all required payment parameters:
40
+ - **Network** – blockchain name (e.g. Polygon, Linea)
41
+ - **Token address** – ERC-20 token contract address
42
+ - **Order ID** – unique order identifier
43
+ - **Amount Wei** – already converted to the smallest unit (e.g. wei, 10⁶)
44
+ - **Timestamp** – Unix timestamp of the order
45
+ - **Payer wallet address** – the wallet address from which the user will make the on-chain payment
46
+ 2. The frontend sends these parameters to your **backend**.
47
+ 3. The **backend** uses this SDK to generate a cryptographic **ECDSA signature** with its private key (performed **offline**).
48
+ 4. The backend returns the generated signature to the frontend.
49
+ 5. The **frontend** calls the Payra smart contract (`payOrder`) with all parameters **plus** the signature.
51
50
 
52
51
  This process ensures full compatibility between your backend and Payra’s on-chain verification logic.
53
52
 
54
53
  ## Features
55
54
 
56
- - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
55
+ - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
57
56
  - Fully compatible with **Payra's Solidity smart contracts** (`ERC-1155` payment verification).
58
- - Includes built-in **ABI encoding and decoding** via [`web3.py`](https://github.com/ethereum/web3.py).
59
- - Supports environment-based configuration (`.env`) for managing multiple blockchain networks.
57
+ - Includes built-in **ABI encoding and decoding** via `web3.php`.
58
+ - Supports `.env` and `config/payra.php` configuration for multiple blockchain networks.
59
+ - Laravel IoC container integration (easy dependency injection)
60
60
  - Verifies **order payment status directly on-chain** via RPC or blockchain explorer API.
61
- - Provides **secure backend integration** using merchant private keys.
61
+ - Provides **secure backend integration** for signing and verifying transactions.
62
62
  - Includes optional utility helpers for:
63
- - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
64
- - **USD ⇄ WEI** conversion for token precision handling.
63
+ - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
64
+ - **USD ⇄ WEI** conversion for token precision handling.
65
65
 
66
66
  ## Setup
67
67
 
68
68
  Before installing this package, make sure you have an active **Payra** account:
69
69
 
70
- 👉 [https://payra.cash](https://payra.cash)
70
+ [https://payra.cash/products/on-chain-payments/merchant-registration](https://payra.cash/products/on-chain-payments/merchant-registration)
71
71
 
72
- You will need:
72
+ Before installing this package, make sure you have a **MerchantID**
73
73
 
74
74
  - Your **Merchant ID** (unique for each blockchain network)
75
75
  - Your **Private Key** (used to sign Payra transactions securely)
@@ -118,13 +118,13 @@ This SDK requires:
118
118
 
119
119
  ## Environment Configuration
120
120
 
121
- Create a (`.env`) file in your project root (you can copy from example):
121
+ Create a `.env` file in your project root (you can copy from example):
122
122
 
123
123
  ```bash
124
124
  cp .env.example .env
125
125
  ```
126
126
 
127
- This file stores your **private configuration** and connection settings for all supported networks. Never commit (`.env`) to version control.
127
+ This file stores your **private configuration** and connection settings for all supported networks. Never commit `.env` to version control.
128
128
 
129
129
  ### Required Variables
130
130
 
@@ -133,8 +133,9 @@ This file stores your **private configuration** and connection settings for all
133
133
  Used for automatic fiat → USD conversions via the built-in Payra utilities.
134
134
 
135
135
  ```bash
136
- EXCHANGE_RATE_API_KEY= # Your ExchangeRate API key (from exchangerate-api.com)
137
- EXCHANGE_RATE_CACHE_TIME=720 # Cache duration in minutes (default: 720 = 12h)
136
+ # Optional only needed if you want to use the built-in currency conversion helper
137
+ PAYRA_EXCHANGE_RATE_API_KEY= # Your ExchangeRate API key (from exchangerate-api.com)
138
+ PAYRA_EXCHANGE_RATE_CACHE_TIME=720 # Cache duration in minutes (default: 720 = 12h)
138
139
 
139
140
  PAYRA_POLYGON_CORE_FORWARD_CONTRACT_ADDRESS=0xf30070da76B55E5cB5750517E4DECBD6Cc5ce5a8
140
141
  PAYRA_POLYGON_PRIVATE_KEY=
@@ -158,7 +159,7 @@ PAYRA_LINEA_RPC_URL_2=
158
159
  #### Important Notes
159
160
 
160
161
  - The cache automatically refreshes when it expires.
161
- - You can adjust the cache duration by setting `EXCHANGE_RATE_CACHE_TIME`:
162
+ - You can adjust the cache duration by setting `PAYRA_EXCHANGE_RATE_CACHE_TIME`:
162
163
  - `5` → cache for 5 minutes
163
164
  - `60` → cache for 1 hour
164
165
  - `720` → cache for 12 hours (default)
@@ -208,24 +209,89 @@ except Exception as e:
208
209
  print(f"Unexpected error: {e}")
209
210
  ```
210
211
 
212
+ #### Input Parameters
213
+
214
+ | Field | Type | Description |
215
+ |--------------|----------|----------------------------------------------|
216
+ | **`network`** | `string` | Selected network name |
217
+ | **`tokenAddress`** | `string` | ERC20 token contract address |
218
+ | **`orderId`** | `string` | Unique order reference (e.g. ORDER-123) |
219
+ | **`amountWei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
220
+ | **`timestamp`** | `number` | Unix timestamp of signature creation |
221
+ | **`payerAddress`** | `string` | Payer Wallet Address
222
+
211
223
  #### Behind the Scenes
212
224
 
213
225
  1. The backend converts the amount to the smallest blockchain unit (e.g. wei).
214
- 3. A `PayraSignatureGenerator` instance is created using your private key from (`.env`).
226
+ 3. A `PayraSignatureGenerator` instance is created using your private key from `.env`
215
227
  4. It generates an ECDSA signature that is fully verifiable on-chain by the Payra smart contract.
216
228
  5. The resulting signature should be sent to the **frontend**, which must call `payOrder(...)` using the same parameters (`timestamp`, `orderId`, `amount`, `tokenAddress`, etc.) that were used to generate the signature.
217
229
 
218
230
  ---
219
231
 
220
- ### Checking On-Chain Order Status
232
+ ### Get Order Status
233
+
234
+ Retrieve **full payment details** for a specific order from the Payra smart contract. This method returns the complete on-chain payment data associated with the order, including:
235
+
236
+ - whether the order has been paid,
237
+ - the payment token address,
238
+ - the paid amount,
239
+ - the fee amount,
240
+ - and the payment timestamp.
241
+
242
+ Use this method when you need **detailed information** about the payment or want to display full transaction data.
243
+
244
+ ```python
245
+ from payra_sdk import PayraOrderVerification, PayraSDKException
246
+
247
+ try:
248
+ ORDER_ID = "ORDER-1765138911744-126-5"
249
+
250
+ # Initialize verifier for a specific network
251
+ verifier = PayraOrderVerification("polygon")
252
+
253
+ print("\nGet order status...")
254
+ result = verifier.get_order_status(ORDER_ID)
255
+
256
+ print("Order ID:", ORDER_ID)
257
+ print("Result:", result)
258
+
259
+ except PayraSDKException as e:
260
+ print(f"Payra SDK error: {e}")
261
+ except Exception as e:
262
+ print(f"Unexpected error: {e}")
263
+ ```
264
+
265
+ #### Behind the Scenes
266
+
267
+ 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
268
+ 3. It calls `get_order_status(order_id)` to check if the order transaction exists and is confirmed on-chain.
269
+ 4. The function returns a dictionary with:
270
+ ```python
271
+ {
272
+ "success": True,
273
+ "paid": True,
274
+ "error": None.
275
+ "toke": '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
276
+ "amount": 400000,
277
+ "fee": 3600,
278
+ "timestamp": 1765138941
279
+ }
280
+ ```
281
+
282
+ ---
283
+
284
+ ### Check Order Paid Status
285
+
286
+ Perform a **simple payment check** for a specific order. This method only verifies whether the order has been paid (`true` or `false`) and does **not** return any additional payment details.
221
287
 
222
- You can verify whether a Payra order has been successfully paid on-chain:
288
+ Use this method when you only need a **quick boolean confirmation** of the payment status.
223
289
 
224
290
  ```python
225
291
  from payra_sdk import PayraOrderVerification, PayraSDKException
226
292
 
227
293
  try:
228
- ORDER_ID = "ORDER-1753824905006-301-322"
294
+ ORDER_ID = "ORDER-1765138911744-126-5"
229
295
 
230
296
  # Initialize verifier for a specific network
231
297
  verifier = PayraOrderVerification("polygon")
@@ -251,9 +317,9 @@ except Exception as e:
251
317
 
252
318
  #### Behind the Scenes
253
319
 
254
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
255
- 3. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
256
- 4. The function returns a dictionary with:
320
+ 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
321
+ 3. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
322
+ 4. The function returns a dictionary with:
257
323
  ```python
258
324
  {
259
325
  "success": True,
@@ -261,7 +327,7 @@ except Exception as e:
261
327
  "error": None
262
328
  }
263
329
  ```
264
- 5. If `paid` is `True`, the order has been successfully processed and confirmed by the Payra smart contract.
330
+ 5. If `paid` is `True`, the order has been successfully processed and confirmed by the Payra smart contract.
265
331
 
266
332
  ---
267
333
 
@@ -272,29 +338,29 @@ The `PayraUtils` module provides convenient helpers for token conversion, precis
272
338
  ```python
273
339
  from payra_sdk import PayraUtils
274
340
 
275
- # 🔹 Convert USD/token amount to smallest unit (Wei or token decimals)
341
+ # Convert USD/token amount to smallest unit (Wei or token decimals)
276
342
  amount_wei = PayraUtils.to_wei(3.34, 'polygon', 'usdt')
277
343
  print("Amount in Wei:", amount_wei) # 3340000
278
344
 
279
- # 🔹 Convert from Wei back to readable token amount
345
+ # Convert from Wei back to readable token amount
280
346
  amount = PayraUtils.from_wei(3340000, 'polygon', 'usdt', precision=2)
281
347
  print("Readable amount:", amount) # "3.34"
282
348
 
283
- # 🔹 Get token decimals for any supported network
349
+ # Get token decimals for any supported network
284
350
  print("USDT decimals on Polygon:", PayraUtils.get_decimals("polygon", "usdt"))
285
351
  print("POL decimals on Polygon:", PayraUtils.get_decimals("polygon", "pol"))
286
352
 
287
- # 🔹 Convert fiat currency to USD using the built-in ExchangeRate API
353
+ # Convert fiat currency to USD using the built-in ExchangeRate API
288
354
  usd_value = PayraUtils.convert_to_usd(100, "EUR")
289
355
  print(f"100 EUR = {usd_value} USD")
290
356
  ```
291
357
 
292
358
  #### Behind the Scenes
293
359
 
294
- - `to_wei(amount, network, token)` – Converts a human-readable token amount into the smallest unit (used on-chain).
295
- - `from_wei(amount, network, token, precision)` – Converts back from smallest unit to a formatted amount.
296
- - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
297
- - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
360
+ - `to_wei(amount, network, token)` – Converts a human-readable token amount into the smallest unit (used on-chain).
361
+ - `from_wei(amount, network, token, precision)` – Converts back from smallest unit to a formatted amount.
362
+ - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
363
+ - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
298
364
 
299
365
  ## Testing
300
366
  You can run the included `examples` to test signing and verification:
@@ -305,34 +371,34 @@ python3 example_order_verification.py
305
371
  python3 example_utils.py
306
372
  ```
307
373
 
308
- Make sure your (`.env`) file contains correct values for the `network` being used.
374
+ Make sure your `.env` file contains correct values for the `network` being used.
309
375
 
310
376
  ### Tips
311
377
 
312
- - Always verify your (`.env`) configuration before running any signing or on-chain verification examples.
378
+ - Always verify your `.env` configuration before running any signing or on-chain verification examples.
313
379
  - The SDK examples are safe to run — they use **read-only RPC calls** (no real transactions are broadcast).
314
380
  - You can modify `example_signature.py` to test custom token addresses or order parameters.
315
381
 
316
382
  ## Projects
317
383
 
318
- - [GitHub / Home](https://github.com/payracash)
319
- - [GitHub / Source](https://github.com/payracash/payra-sdk-python)
320
- - [GitHub / Issues](https://github.com/payracash/payra-sdk-python/issues)
384
+ - [GitHub/Home](https://github.com/payracash)
385
+ - [GitHub/Source](https://github.com/payracash/payra-sdk-python)
386
+ - [GitHub/Issues](https://github.com/payracash/payra-sdk-python/issues)
321
387
 
322
388
  ## Project
323
389
 
324
- - [https://payra.cash](https://payra.cash)
325
- - [https://payra.tech](https://payra.tech)
326
- - [https://payra.xyz](https://payra.xyz)
327
- - [https://payra.eth](https://payra.eth)
390
+ - [https://payra.cash](https://payra.cash)
391
+ - [https://payra.tech](https://payra.tech)
392
+ - [https://payra.xyz](https://payra.xyz)
393
+ - [https://payra.eth](https://payra.eth.limo) - suporrted by Brave Browser or .limo
328
394
 
329
395
  ## Social Media
330
396
 
331
397
  - [Telegram Payra Group](https://t.me/+GhTyJJrd4SMyMDA0)
332
398
  - [Telegram Announcements](https://t.me/payracash)
333
399
  - [Twix (X)](https://x.com/PayraCash)
334
- - [Hashnode](https://payra.hashnode.dev)
400
+ - [Dev.to](https://dev.to/payracash)
335
401
 
336
402
  ## License
337
403
 
338
- MIT © [Payra](https://github.com/payracash)
404
+ MIT © [Payra](https://payra.cash)
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Payra Python SDK
4
4
 
5
- Official Python SDK for integrating **Payra's on-chain payment system** into your backend applications.
5
+ Official **Python SDK** for integrating **Payra's on-chain payment system** into your backend applications.
6
6
 
7
7
  This SDK provides:
8
8
  - Secure generation of **ECDSA signatures** compatible with the Payra smart contract — used for order payment verification.
@@ -12,40 +12,40 @@ This SDK provides:
12
12
 
13
13
  The typical flow for signing and verifying a Payra transaction:
14
14
 
15
- 1. The **frontend** prepares all required payment parameters:
16
- - **Network** – blockchain name (e.g. Polygon, Linea)
17
- - **Token address** – ERC-20 token contract address
18
- - **Order ID** – unique order identifier
19
- - **AmountWei** – already converted to the smallest unit (e.g. wei, 10⁶)
20
- - **Timestamp** – Unix timestamp of the order
21
- - **Payer wallet address**
22
-
23
- 2. The frontend sends these parameters to your **backend**.
24
- 3. The **backend** uses this SDK to generate a cryptographic **ECDSA signature** with its private key (performed **offline**).
25
- 4. The backend returns the generated signature to the frontend.
26
- 5. The **frontend** calls the Payra smart contract (`payOrder`) with all parameters **plus** the signature.
15
+ 1. The **frontend** prepares all required payment parameters:
16
+ - **Network** – blockchain name (e.g. Polygon, Linea)
17
+ - **Token address** – ERC-20 token contract address
18
+ - **Order ID** – unique order identifier
19
+ - **Amount Wei** – already converted to the smallest unit (e.g. wei, 10⁶)
20
+ - **Timestamp** – Unix timestamp of the order
21
+ - **Payer wallet address** – the wallet address from which the user will make the on-chain payment
22
+ 2. The frontend sends these parameters to your **backend**.
23
+ 3. The **backend** uses this SDK to generate a cryptographic **ECDSA signature** with its private key (performed **offline**).
24
+ 4. The backend returns the generated signature to the frontend.
25
+ 5. The **frontend** calls the Payra smart contract (`payOrder`) with all parameters **plus** the signature.
27
26
 
28
27
  This process ensures full compatibility between your backend and Payra’s on-chain verification logic.
29
28
 
30
29
  ## Features
31
30
 
32
- - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
31
+ - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
33
32
  - Fully compatible with **Payra's Solidity smart contracts** (`ERC-1155` payment verification).
34
- - Includes built-in **ABI encoding and decoding** via [`web3.py`](https://github.com/ethereum/web3.py).
35
- - Supports environment-based configuration (`.env`) for managing multiple blockchain networks.
33
+ - Includes built-in **ABI encoding and decoding** via `web3.php`.
34
+ - Supports `.env` and `config/payra.php` configuration for multiple blockchain networks.
35
+ - Laravel IoC container integration (easy dependency injection)
36
36
  - Verifies **order payment status directly on-chain** via RPC or blockchain explorer API.
37
- - Provides **secure backend integration** using merchant private keys.
37
+ - Provides **secure backend integration** for signing and verifying transactions.
38
38
  - Includes optional utility helpers for:
39
- - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
40
- - **USD ⇄ WEI** conversion for token precision handling.
39
+ - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
40
+ - **USD ⇄ WEI** conversion for token precision handling.
41
41
 
42
42
  ## Setup
43
43
 
44
44
  Before installing this package, make sure you have an active **Payra** account:
45
45
 
46
- 👉 [https://payra.cash](https://payra.cash)
46
+ [https://payra.cash/products/on-chain-payments/merchant-registration](https://payra.cash/products/on-chain-payments/merchant-registration)
47
47
 
48
- You will need:
48
+ Before installing this package, make sure you have a **MerchantID**
49
49
 
50
50
  - Your **Merchant ID** (unique for each blockchain network)
51
51
  - Your **Private Key** (used to sign Payra transactions securely)
@@ -94,13 +94,13 @@ This SDK requires:
94
94
 
95
95
  ## Environment Configuration
96
96
 
97
- Create a (`.env`) file in your project root (you can copy from example):
97
+ Create a `.env` file in your project root (you can copy from example):
98
98
 
99
99
  ```bash
100
100
  cp .env.example .env
101
101
  ```
102
102
 
103
- This file stores your **private configuration** and connection settings for all supported networks. Never commit (`.env`) to version control.
103
+ This file stores your **private configuration** and connection settings for all supported networks. Never commit `.env` to version control.
104
104
 
105
105
  ### Required Variables
106
106
 
@@ -109,8 +109,9 @@ This file stores your **private configuration** and connection settings for all
109
109
  Used for automatic fiat → USD conversions via the built-in Payra utilities.
110
110
 
111
111
  ```bash
112
- EXCHANGE_RATE_API_KEY= # Your ExchangeRate API key (from exchangerate-api.com)
113
- EXCHANGE_RATE_CACHE_TIME=720 # Cache duration in minutes (default: 720 = 12h)
112
+ # Optional only needed if you want to use the built-in currency conversion helper
113
+ PAYRA_EXCHANGE_RATE_API_KEY= # Your ExchangeRate API key (from exchangerate-api.com)
114
+ PAYRA_EXCHANGE_RATE_CACHE_TIME=720 # Cache duration in minutes (default: 720 = 12h)
114
115
 
115
116
  PAYRA_POLYGON_CORE_FORWARD_CONTRACT_ADDRESS=0xf30070da76B55E5cB5750517E4DECBD6Cc5ce5a8
116
117
  PAYRA_POLYGON_PRIVATE_KEY=
@@ -134,7 +135,7 @@ PAYRA_LINEA_RPC_URL_2=
134
135
  #### Important Notes
135
136
 
136
137
  - The cache automatically refreshes when it expires.
137
- - You can adjust the cache duration by setting `EXCHANGE_RATE_CACHE_TIME`:
138
+ - You can adjust the cache duration by setting `PAYRA_EXCHANGE_RATE_CACHE_TIME`:
138
139
  - `5` → cache for 5 minutes
139
140
  - `60` → cache for 1 hour
140
141
  - `720` → cache for 12 hours (default)
@@ -184,24 +185,89 @@ except Exception as e:
184
185
  print(f"Unexpected error: {e}")
185
186
  ```
186
187
 
188
+ #### Input Parameters
189
+
190
+ | Field | Type | Description |
191
+ |--------------|----------|----------------------------------------------|
192
+ | **`network`** | `string` | Selected network name |
193
+ | **`tokenAddress`** | `string` | ERC20 token contract address |
194
+ | **`orderId`** | `string` | Unique order reference (e.g. ORDER-123) |
195
+ | **`amountWei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
196
+ | **`timestamp`** | `number` | Unix timestamp of signature creation |
197
+ | **`payerAddress`** | `string` | Payer Wallet Address
198
+
187
199
  #### Behind the Scenes
188
200
 
189
201
  1. The backend converts the amount to the smallest blockchain unit (e.g. wei).
190
- 3. A `PayraSignatureGenerator` instance is created using your private key from (`.env`).
202
+ 3. A `PayraSignatureGenerator` instance is created using your private key from `.env`
191
203
  4. It generates an ECDSA signature that is fully verifiable on-chain by the Payra smart contract.
192
204
  5. The resulting signature should be sent to the **frontend**, which must call `payOrder(...)` using the same parameters (`timestamp`, `orderId`, `amount`, `tokenAddress`, etc.) that were used to generate the signature.
193
205
 
194
206
  ---
195
207
 
196
- ### Checking On-Chain Order Status
208
+ ### Get Order Status
209
+
210
+ Retrieve **full payment details** for a specific order from the Payra smart contract. This method returns the complete on-chain payment data associated with the order, including:
211
+
212
+ - whether the order has been paid,
213
+ - the payment token address,
214
+ - the paid amount,
215
+ - the fee amount,
216
+ - and the payment timestamp.
217
+
218
+ Use this method when you need **detailed information** about the payment or want to display full transaction data.
219
+
220
+ ```python
221
+ from payra_sdk import PayraOrderVerification, PayraSDKException
222
+
223
+ try:
224
+ ORDER_ID = "ORDER-1765138911744-126-5"
225
+
226
+ # Initialize verifier for a specific network
227
+ verifier = PayraOrderVerification("polygon")
228
+
229
+ print("\nGet order status...")
230
+ result = verifier.get_order_status(ORDER_ID)
231
+
232
+ print("Order ID:", ORDER_ID)
233
+ print("Result:", result)
234
+
235
+ except PayraSDKException as e:
236
+ print(f"Payra SDK error: {e}")
237
+ except Exception as e:
238
+ print(f"Unexpected error: {e}")
239
+ ```
240
+
241
+ #### Behind the Scenes
242
+
243
+ 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
244
+ 3. It calls `get_order_status(order_id)` to check if the order transaction exists and is confirmed on-chain.
245
+ 4. The function returns a dictionary with:
246
+ ```python
247
+ {
248
+ "success": True,
249
+ "paid": True,
250
+ "error": None.
251
+ "toke": '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
252
+ "amount": 400000,
253
+ "fee": 3600,
254
+ "timestamp": 1765138941
255
+ }
256
+ ```
257
+
258
+ ---
259
+
260
+ ### Check Order Paid Status
261
+
262
+ Perform a **simple payment check** for a specific order. This method only verifies whether the order has been paid (`true` or `false`) and does **not** return any additional payment details.
197
263
 
198
- You can verify whether a Payra order has been successfully paid on-chain:
264
+ Use this method when you only need a **quick boolean confirmation** of the payment status.
199
265
 
200
266
  ```python
201
267
  from payra_sdk import PayraOrderVerification, PayraSDKException
202
268
 
203
269
  try:
204
- ORDER_ID = "ORDER-1753824905006-301-322"
270
+ ORDER_ID = "ORDER-1765138911744-126-5"
205
271
 
206
272
  # Initialize verifier for a specific network
207
273
  verifier = PayraOrderVerification("polygon")
@@ -227,9 +293,9 @@ except Exception as e:
227
293
 
228
294
  #### Behind the Scenes
229
295
 
230
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
231
- 3. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
232
- 4. The function returns a dictionary with:
296
+ 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
297
+ 3. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
298
+ 4. The function returns a dictionary with:
233
299
  ```python
234
300
  {
235
301
  "success": True,
@@ -237,7 +303,7 @@ except Exception as e:
237
303
  "error": None
238
304
  }
239
305
  ```
240
- 5. If `paid` is `True`, the order has been successfully processed and confirmed by the Payra smart contract.
306
+ 5. If `paid` is `True`, the order has been successfully processed and confirmed by the Payra smart contract.
241
307
 
242
308
  ---
243
309
 
@@ -248,29 +314,29 @@ The `PayraUtils` module provides convenient helpers for token conversion, precis
248
314
  ```python
249
315
  from payra_sdk import PayraUtils
250
316
 
251
- # 🔹 Convert USD/token amount to smallest unit (Wei or token decimals)
317
+ # Convert USD/token amount to smallest unit (Wei or token decimals)
252
318
  amount_wei = PayraUtils.to_wei(3.34, 'polygon', 'usdt')
253
319
  print("Amount in Wei:", amount_wei) # 3340000
254
320
 
255
- # 🔹 Convert from Wei back to readable token amount
321
+ # Convert from Wei back to readable token amount
256
322
  amount = PayraUtils.from_wei(3340000, 'polygon', 'usdt', precision=2)
257
323
  print("Readable amount:", amount) # "3.34"
258
324
 
259
- # 🔹 Get token decimals for any supported network
325
+ # Get token decimals for any supported network
260
326
  print("USDT decimals on Polygon:", PayraUtils.get_decimals("polygon", "usdt"))
261
327
  print("POL decimals on Polygon:", PayraUtils.get_decimals("polygon", "pol"))
262
328
 
263
- # 🔹 Convert fiat currency to USD using the built-in ExchangeRate API
329
+ # Convert fiat currency to USD using the built-in ExchangeRate API
264
330
  usd_value = PayraUtils.convert_to_usd(100, "EUR")
265
331
  print(f"100 EUR = {usd_value} USD")
266
332
  ```
267
333
 
268
334
  #### Behind the Scenes
269
335
 
270
- - `to_wei(amount, network, token)` – Converts a human-readable token amount into the smallest unit (used on-chain).
271
- - `from_wei(amount, network, token, precision)` – Converts back from smallest unit to a formatted amount.
272
- - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
273
- - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
336
+ - `to_wei(amount, network, token)` – Converts a human-readable token amount into the smallest unit (used on-chain).
337
+ - `from_wei(amount, network, token, precision)` – Converts back from smallest unit to a formatted amount.
338
+ - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
339
+ - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
274
340
 
275
341
  ## Testing
276
342
  You can run the included `examples` to test signing and verification:
@@ -281,34 +347,34 @@ python3 example_order_verification.py
281
347
  python3 example_utils.py
282
348
  ```
283
349
 
284
- Make sure your (`.env`) file contains correct values for the `network` being used.
350
+ Make sure your `.env` file contains correct values for the `network` being used.
285
351
 
286
352
  ### Tips
287
353
 
288
- - Always verify your (`.env`) configuration before running any signing or on-chain verification examples.
354
+ - Always verify your `.env` configuration before running any signing or on-chain verification examples.
289
355
  - The SDK examples are safe to run — they use **read-only RPC calls** (no real transactions are broadcast).
290
356
  - You can modify `example_signature.py` to test custom token addresses or order parameters.
291
357
 
292
358
  ## Projects
293
359
 
294
- - [GitHub / Home](https://github.com/payracash)
295
- - [GitHub / Source](https://github.com/payracash/payra-sdk-python)
296
- - [GitHub / Issues](https://github.com/payracash/payra-sdk-python/issues)
360
+ - [GitHub/Home](https://github.com/payracash)
361
+ - [GitHub/Source](https://github.com/payracash/payra-sdk-python)
362
+ - [GitHub/Issues](https://github.com/payracash/payra-sdk-python/issues)
297
363
 
298
364
  ## Project
299
365
 
300
- - [https://payra.cash](https://payra.cash)
301
- - [https://payra.tech](https://payra.tech)
302
- - [https://payra.xyz](https://payra.xyz)
303
- - [https://payra.eth](https://payra.eth)
366
+ - [https://payra.cash](https://payra.cash)
367
+ - [https://payra.tech](https://payra.tech)
368
+ - [https://payra.xyz](https://payra.xyz)
369
+ - [https://payra.eth](https://payra.eth.limo) - suporrted by Brave Browser or .limo
304
370
 
305
371
  ## Social Media
306
372
 
307
373
  - [Telegram Payra Group](https://t.me/+GhTyJJrd4SMyMDA0)
308
374
  - [Telegram Announcements](https://t.me/payracash)
309
375
  - [Twix (X)](https://x.com/PayraCash)
310
- - [Hashnode](https://payra.hashnode.dev)
376
+ - [Dev.to](https://dev.to/payracash)
311
377
 
312
378
  ## License
313
379
 
314
- MIT © [Payra](https://github.com/payracash)
380
+ MIT © [Payra](https://payra.cash)
@@ -66,37 +66,84 @@ class PayraOrderVerification:
66
66
 
67
67
  return random.choice(urls)
68
68
 
69
+
69
70
  def is_order_paid(self, order_id: str) -> dict:
70
71
  """
71
72
  Calls the Payra Forward contract to check if an order is paid.
72
73
  """
73
74
  try:
74
- # encode isOrderPaid call manually
75
- core_fn_selector = PayraUtils.function_selector(self.core_fn)
76
- encoded_params = self.web3.codec.encode(
77
- [inp["type"] for inp in self.core_fn["inputs"]],
75
+ raw = self._call_core_function(
76
+ "isOrderPaid",
78
77
  [int(self.merchant_id), order_id]
79
78
  )
80
- data = core_fn_selector + encoded_params.hex()
81
79
 
82
- # call forward()
83
- result = self.forward_contract.functions.forward("0x" + data).call()
80
+ decoded = self.web3.codec.decode(["bool"], raw)
81
+
82
+ return {
83
+ "success": True,
84
+ "paid": bool(decoded[0]),
85
+ "error": None
86
+ }
87
+
88
+ except Exception as e:
89
+ return {
90
+ "success": False,
91
+ "paid": None,
92
+ "error": str(e)
93
+ }
94
+
95
+
96
+ def get_order_status(self, order_id: str) -> dict:
97
+ """
98
+ Calls the Payra Forward contract to get order status.
99
+ """
100
+ try:
101
+ raw = self._call_core_function(
102
+ "getOrderStatus",
103
+ [int(self.merchant_id), order_id]
104
+ )
84
105
 
85
- # decode result
86
106
  decoded = self.web3.codec.decode(
87
- [out["type"] for out in self.core_fn["outputs"]],
88
- result
107
+ ["bool", "address", "uint256", "uint256", "uint256"],
108
+ raw
89
109
  )
90
110
 
91
111
  return {
92
112
  "success": True,
113
+ "error": None,
93
114
  "paid": bool(decoded[0]),
94
- "error": None
115
+ "token": decoded[1],
116
+ "amount": int(decoded[2]),
117
+ "fee": int(decoded[3]),
118
+ "timestamp": int(decoded[4]),
95
119
  }
96
120
 
97
121
  except Exception as e:
98
122
  return {
99
123
  "success": False,
124
+ "error": str(e),
100
125
  "paid": None,
101
- "error": str(e)
126
+ "token": None,
127
+ "amount": None,
128
+ "fee": None,
129
+ "timestamp": None,
102
130
  }
131
+
132
+ def _call_core_function(self, function_name: str, params: list) -> bytes:
133
+ """
134
+ Calls Payra Core contract via Forward and returns raw bytes.
135
+ """
136
+ core_fn = PayraUtils.find_function(self.abi, function_name)
137
+
138
+ selector = PayraUtils.function_selector(core_fn)
139
+
140
+ encoded_params = self.web3.codec.encode(
141
+ [inp["type"] for inp in core_fn["inputs"]],
142
+ params
143
+ )
144
+
145
+ data = selector + encoded_params.hex()
146
+
147
+ return self.forward_contract.functions.forward(
148
+ "0x" + data
149
+ ).call()
@@ -84,11 +84,11 @@ class PayraUtils:
84
84
  Default cache time: 720 minutes (12 hours).
85
85
  """
86
86
 
87
- api_key = os.getenv("EXCHANGE_RATE_API_KEY")
87
+ api_key = os.getenv("PAYRA_EXCHANGE_RATE_API_KEY")
88
88
  if not api_key:
89
- raise InvalidArgumentError("EXCHANGE_RATE_API_KEY is not set in .env")
89
+ raise InvalidArgumentError("PAYRA_EXCHANGE_RATE_API_KEY is not set in .env")
90
90
 
91
- cache_minutes = int(os.getenv("EXCHANGE_RATE_CACHE_TIME", 720))
91
+ cache_minutes = int(os.getenv("PAYRA_EXCHANGE_RATE_CACHE_TIME", 720))
92
92
  cache_ttl = cache_minutes * 60
93
93
 
94
94
  api_url = f"https://v6.exchangerate-api.com/v6/{api_key}/latest/USD"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: payra_sdk
3
- Version: 1.2.3
3
+ Version: 1.2.5
4
4
  Summary: Python SDK for Payra payment signature generation (backend)
5
5
  Author: Your Name
6
6
  Author-email: Wraith <contact@payra.cash>
@@ -26,7 +26,7 @@ Dynamic: license-file
26
26
 
27
27
  # Payra Python SDK
28
28
 
29
- Official Python SDK for integrating **Payra's on-chain payment system** into your backend applications.
29
+ Official **Python SDK** for integrating **Payra's on-chain payment system** into your backend applications.
30
30
 
31
31
  This SDK provides:
32
32
  - Secure generation of **ECDSA signatures** compatible with the Payra smart contract — used for order payment verification.
@@ -36,40 +36,40 @@ This SDK provides:
36
36
 
37
37
  The typical flow for signing and verifying a Payra transaction:
38
38
 
39
- 1. The **frontend** prepares all required payment parameters:
40
- - **Network** – blockchain name (e.g. Polygon, Linea)
41
- - **Token address** – ERC-20 token contract address
42
- - **Order ID** – unique order identifier
43
- - **AmountWei** – already converted to the smallest unit (e.g. wei, 10⁶)
44
- - **Timestamp** – Unix timestamp of the order
45
- - **Payer wallet address**
46
-
47
- 2. The frontend sends these parameters to your **backend**.
48
- 3. The **backend** uses this SDK to generate a cryptographic **ECDSA signature** with its private key (performed **offline**).
49
- 4. The backend returns the generated signature to the frontend.
50
- 5. The **frontend** calls the Payra smart contract (`payOrder`) with all parameters **plus** the signature.
39
+ 1. The **frontend** prepares all required payment parameters:
40
+ - **Network** – blockchain name (e.g. Polygon, Linea)
41
+ - **Token address** – ERC-20 token contract address
42
+ - **Order ID** – unique order identifier
43
+ - **Amount Wei** – already converted to the smallest unit (e.g. wei, 10⁶)
44
+ - **Timestamp** – Unix timestamp of the order
45
+ - **Payer wallet address** – the wallet address from which the user will make the on-chain payment
46
+ 2. The frontend sends these parameters to your **backend**.
47
+ 3. The **backend** uses this SDK to generate a cryptographic **ECDSA signature** with its private key (performed **offline**).
48
+ 4. The backend returns the generated signature to the frontend.
49
+ 5. The **frontend** calls the Payra smart contract (`payOrder`) with all parameters **plus** the signature.
51
50
 
52
51
  This process ensures full compatibility between your backend and Payra’s on-chain verification logic.
53
52
 
54
53
  ## Features
55
54
 
56
- - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
55
+ - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
57
56
  - Fully compatible with **Payra's Solidity smart contracts** (`ERC-1155` payment verification).
58
- - Includes built-in **ABI encoding and decoding** via [`web3.py`](https://github.com/ethereum/web3.py).
59
- - Supports environment-based configuration (`.env`) for managing multiple blockchain networks.
57
+ - Includes built-in **ABI encoding and decoding** via `web3.php`.
58
+ - Supports `.env` and `config/payra.php` configuration for multiple blockchain networks.
59
+ - Laravel IoC container integration (easy dependency injection)
60
60
  - Verifies **order payment status directly on-chain** via RPC or blockchain explorer API.
61
- - Provides **secure backend integration** using merchant private keys.
61
+ - Provides **secure backend integration** for signing and verifying transactions.
62
62
  - Includes optional utility helpers for:
63
- - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
64
- - **USD ⇄ WEI** conversion for token precision handling.
63
+ - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
64
+ - **USD ⇄ WEI** conversion for token precision handling.
65
65
 
66
66
  ## Setup
67
67
 
68
68
  Before installing this package, make sure you have an active **Payra** account:
69
69
 
70
- 👉 [https://payra.cash](https://payra.cash)
70
+ [https://payra.cash/products/on-chain-payments/merchant-registration](https://payra.cash/products/on-chain-payments/merchant-registration)
71
71
 
72
- You will need:
72
+ Before installing this package, make sure you have a **MerchantID**
73
73
 
74
74
  - Your **Merchant ID** (unique for each blockchain network)
75
75
  - Your **Private Key** (used to sign Payra transactions securely)
@@ -118,13 +118,13 @@ This SDK requires:
118
118
 
119
119
  ## Environment Configuration
120
120
 
121
- Create a (`.env`) file in your project root (you can copy from example):
121
+ Create a `.env` file in your project root (you can copy from example):
122
122
 
123
123
  ```bash
124
124
  cp .env.example .env
125
125
  ```
126
126
 
127
- This file stores your **private configuration** and connection settings for all supported networks. Never commit (`.env`) to version control.
127
+ This file stores your **private configuration** and connection settings for all supported networks. Never commit `.env` to version control.
128
128
 
129
129
  ### Required Variables
130
130
 
@@ -133,8 +133,9 @@ This file stores your **private configuration** and connection settings for all
133
133
  Used for automatic fiat → USD conversions via the built-in Payra utilities.
134
134
 
135
135
  ```bash
136
- EXCHANGE_RATE_API_KEY= # Your ExchangeRate API key (from exchangerate-api.com)
137
- EXCHANGE_RATE_CACHE_TIME=720 # Cache duration in minutes (default: 720 = 12h)
136
+ # Optional only needed if you want to use the built-in currency conversion helper
137
+ PAYRA_EXCHANGE_RATE_API_KEY= # Your ExchangeRate API key (from exchangerate-api.com)
138
+ PAYRA_EXCHANGE_RATE_CACHE_TIME=720 # Cache duration in minutes (default: 720 = 12h)
138
139
 
139
140
  PAYRA_POLYGON_CORE_FORWARD_CONTRACT_ADDRESS=0xf30070da76B55E5cB5750517E4DECBD6Cc5ce5a8
140
141
  PAYRA_POLYGON_PRIVATE_KEY=
@@ -158,7 +159,7 @@ PAYRA_LINEA_RPC_URL_2=
158
159
  #### Important Notes
159
160
 
160
161
  - The cache automatically refreshes when it expires.
161
- - You can adjust the cache duration by setting `EXCHANGE_RATE_CACHE_TIME`:
162
+ - You can adjust the cache duration by setting `PAYRA_EXCHANGE_RATE_CACHE_TIME`:
162
163
  - `5` → cache for 5 minutes
163
164
  - `60` → cache for 1 hour
164
165
  - `720` → cache for 12 hours (default)
@@ -208,24 +209,89 @@ except Exception as e:
208
209
  print(f"Unexpected error: {e}")
209
210
  ```
210
211
 
212
+ #### Input Parameters
213
+
214
+ | Field | Type | Description |
215
+ |--------------|----------|----------------------------------------------|
216
+ | **`network`** | `string` | Selected network name |
217
+ | **`tokenAddress`** | `string` | ERC20 token contract address |
218
+ | **`orderId`** | `string` | Unique order reference (e.g. ORDER-123) |
219
+ | **`amountWei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
220
+ | **`timestamp`** | `number` | Unix timestamp of signature creation |
221
+ | **`payerAddress`** | `string` | Payer Wallet Address
222
+
211
223
  #### Behind the Scenes
212
224
 
213
225
  1. The backend converts the amount to the smallest blockchain unit (e.g. wei).
214
- 3. A `PayraSignatureGenerator` instance is created using your private key from (`.env`).
226
+ 3. A `PayraSignatureGenerator` instance is created using your private key from `.env`
215
227
  4. It generates an ECDSA signature that is fully verifiable on-chain by the Payra smart contract.
216
228
  5. The resulting signature should be sent to the **frontend**, which must call `payOrder(...)` using the same parameters (`timestamp`, `orderId`, `amount`, `tokenAddress`, etc.) that were used to generate the signature.
217
229
 
218
230
  ---
219
231
 
220
- ### Checking On-Chain Order Status
232
+ ### Get Order Status
233
+
234
+ Retrieve **full payment details** for a specific order from the Payra smart contract. This method returns the complete on-chain payment data associated with the order, including:
235
+
236
+ - whether the order has been paid,
237
+ - the payment token address,
238
+ - the paid amount,
239
+ - the fee amount,
240
+ - and the payment timestamp.
241
+
242
+ Use this method when you need **detailed information** about the payment or want to display full transaction data.
243
+
244
+ ```python
245
+ from payra_sdk import PayraOrderVerification, PayraSDKException
246
+
247
+ try:
248
+ ORDER_ID = "ORDER-1765138911744-126-5"
249
+
250
+ # Initialize verifier for a specific network
251
+ verifier = PayraOrderVerification("polygon")
252
+
253
+ print("\nGet order status...")
254
+ result = verifier.get_order_status(ORDER_ID)
255
+
256
+ print("Order ID:", ORDER_ID)
257
+ print("Result:", result)
258
+
259
+ except PayraSDKException as e:
260
+ print(f"Payra SDK error: {e}")
261
+ except Exception as e:
262
+ print(f"Unexpected error: {e}")
263
+ ```
264
+
265
+ #### Behind the Scenes
266
+
267
+ 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
268
+ 3. It calls `get_order_status(order_id)` to check if the order transaction exists and is confirmed on-chain.
269
+ 4. The function returns a dictionary with:
270
+ ```python
271
+ {
272
+ "success": True,
273
+ "paid": True,
274
+ "error": None.
275
+ "toke": '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
276
+ "amount": 400000,
277
+ "fee": 3600,
278
+ "timestamp": 1765138941
279
+ }
280
+ ```
281
+
282
+ ---
283
+
284
+ ### Check Order Paid Status
285
+
286
+ Perform a **simple payment check** for a specific order. This method only verifies whether the order has been paid (`true` or `false`) and does **not** return any additional payment details.
221
287
 
222
- You can verify whether a Payra order has been successfully paid on-chain:
288
+ Use this method when you only need a **quick boolean confirmation** of the payment status.
223
289
 
224
290
  ```python
225
291
  from payra_sdk import PayraOrderVerification, PayraSDKException
226
292
 
227
293
  try:
228
- ORDER_ID = "ORDER-1753824905006-301-322"
294
+ ORDER_ID = "ORDER-1765138911744-126-5"
229
295
 
230
296
  # Initialize verifier for a specific network
231
297
  verifier = PayraOrderVerification("polygon")
@@ -251,9 +317,9 @@ except Exception as e:
251
317
 
252
318
  #### Behind the Scenes
253
319
 
254
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
255
- 3. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
256
- 4. The function returns a dictionary with:
320
+ 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
321
+ 3. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
322
+ 4. The function returns a dictionary with:
257
323
  ```python
258
324
  {
259
325
  "success": True,
@@ -261,7 +327,7 @@ except Exception as e:
261
327
  "error": None
262
328
  }
263
329
  ```
264
- 5. If `paid` is `True`, the order has been successfully processed and confirmed by the Payra smart contract.
330
+ 5. If `paid` is `True`, the order has been successfully processed and confirmed by the Payra smart contract.
265
331
 
266
332
  ---
267
333
 
@@ -272,29 +338,29 @@ The `PayraUtils` module provides convenient helpers for token conversion, precis
272
338
  ```python
273
339
  from payra_sdk import PayraUtils
274
340
 
275
- # 🔹 Convert USD/token amount to smallest unit (Wei or token decimals)
341
+ # Convert USD/token amount to smallest unit (Wei or token decimals)
276
342
  amount_wei = PayraUtils.to_wei(3.34, 'polygon', 'usdt')
277
343
  print("Amount in Wei:", amount_wei) # 3340000
278
344
 
279
- # 🔹 Convert from Wei back to readable token amount
345
+ # Convert from Wei back to readable token amount
280
346
  amount = PayraUtils.from_wei(3340000, 'polygon', 'usdt', precision=2)
281
347
  print("Readable amount:", amount) # "3.34"
282
348
 
283
- # 🔹 Get token decimals for any supported network
349
+ # Get token decimals for any supported network
284
350
  print("USDT decimals on Polygon:", PayraUtils.get_decimals("polygon", "usdt"))
285
351
  print("POL decimals on Polygon:", PayraUtils.get_decimals("polygon", "pol"))
286
352
 
287
- # 🔹 Convert fiat currency to USD using the built-in ExchangeRate API
353
+ # Convert fiat currency to USD using the built-in ExchangeRate API
288
354
  usd_value = PayraUtils.convert_to_usd(100, "EUR")
289
355
  print(f"100 EUR = {usd_value} USD")
290
356
  ```
291
357
 
292
358
  #### Behind the Scenes
293
359
 
294
- - `to_wei(amount, network, token)` – Converts a human-readable token amount into the smallest unit (used on-chain).
295
- - `from_wei(amount, network, token, precision)` – Converts back from smallest unit to a formatted amount.
296
- - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
297
- - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
360
+ - `to_wei(amount, network, token)` – Converts a human-readable token amount into the smallest unit (used on-chain).
361
+ - `from_wei(amount, network, token, precision)` – Converts back from smallest unit to a formatted amount.
362
+ - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
363
+ - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
298
364
 
299
365
  ## Testing
300
366
  You can run the included `examples` to test signing and verification:
@@ -305,34 +371,34 @@ python3 example_order_verification.py
305
371
  python3 example_utils.py
306
372
  ```
307
373
 
308
- Make sure your (`.env`) file contains correct values for the `network` being used.
374
+ Make sure your `.env` file contains correct values for the `network` being used.
309
375
 
310
376
  ### Tips
311
377
 
312
- - Always verify your (`.env`) configuration before running any signing or on-chain verification examples.
378
+ - Always verify your `.env` configuration before running any signing or on-chain verification examples.
313
379
  - The SDK examples are safe to run — they use **read-only RPC calls** (no real transactions are broadcast).
314
380
  - You can modify `example_signature.py` to test custom token addresses or order parameters.
315
381
 
316
382
  ## Projects
317
383
 
318
- - [GitHub / Home](https://github.com/payracash)
319
- - [GitHub / Source](https://github.com/payracash/payra-sdk-python)
320
- - [GitHub / Issues](https://github.com/payracash/payra-sdk-python/issues)
384
+ - [GitHub/Home](https://github.com/payracash)
385
+ - [GitHub/Source](https://github.com/payracash/payra-sdk-python)
386
+ - [GitHub/Issues](https://github.com/payracash/payra-sdk-python/issues)
321
387
 
322
388
  ## Project
323
389
 
324
- - [https://payra.cash](https://payra.cash)
325
- - [https://payra.tech](https://payra.tech)
326
- - [https://payra.xyz](https://payra.xyz)
327
- - [https://payra.eth](https://payra.eth)
390
+ - [https://payra.cash](https://payra.cash)
391
+ - [https://payra.tech](https://payra.tech)
392
+ - [https://payra.xyz](https://payra.xyz)
393
+ - [https://payra.eth](https://payra.eth.limo) - suporrted by Brave Browser or .limo
328
394
 
329
395
  ## Social Media
330
396
 
331
397
  - [Telegram Payra Group](https://t.me/+GhTyJJrd4SMyMDA0)
332
398
  - [Telegram Announcements](https://t.me/payracash)
333
399
  - [Twix (X)](https://x.com/PayraCash)
334
- - [Hashnode](https://payra.hashnode.dev)
400
+ - [Dev.to](https://dev.to/payracash)
335
401
 
336
402
  ## License
337
403
 
338
- MIT © [Payra](https://github.com/payracash)
404
+ MIT © [Payra](https://payra.cash)
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "payra_sdk"
5
- version = "1.2.3"
5
+ version = "1.2.5"
6
6
  description = "Python SDK for Payra payment signature generation (backend)"
7
7
  readme = "README.md"
8
8
  authors = [{ name = "Wraith", email = "contact@payra.cash" }]
File without changes
File without changes
File without changes