payra-sdk 1.2.6__tar.gz → 1.2.7__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: payra_sdk
3
- Version: 1.2.6
3
+ Version: 1.2.7
4
4
  Summary: Python SDK for Payra payment signature generation (backend)
5
5
  Author: Your Name
6
6
  Author-email: Wraith <support@payra.cash>
@@ -28,8 +28,7 @@ Official **Python SDK** for integrating **Payra's on-chain payment system** into
28
28
 
29
29
  This SDK provides:
30
30
  - Secure generation of **ECDSA signatures** compatible with the Payra smart contract, used for order payment verification.
31
- - Simple methods for **checking the on-chain status of orders** to confirm completed payments.
32
-
31
+ - Simple methods for **checking the on-chain details of orders** to confirm completed payments.
33
32
 
34
33
  ## How It Works
35
34
 
@@ -48,20 +47,18 @@ The typical flow for signing and verifying a Payra transaction:
48
47
 
49
48
  This process ensures full compatibility between your backend and Payra’s on-chain verification logic.
50
49
 
51
-
52
50
  ## Features
53
51
 
54
52
  - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
55
53
  - Fully compatible with **Payra's Solidity smart contracts** (`ERC-1155` payment verification).
56
54
  - Supports `.env` and `config/payra.php` configuration for multiple blockchain networks.
57
55
  - Laravel IoC container integration (easy dependency injection)
58
- - Verifies **order payment status directly on-chain** via RPC or blockchain explorer API.
56
+ - Verifies **order payment details directly on-chain** via RPC or blockchain explorer API.
59
57
  - Provides **secure backend integration** for signing and verifying transactions.
60
58
  - Includes optional utility helpers for:
61
59
  - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
62
60
  - **USD ⇄ WEI** conversion for token precision handling.
63
61
 
64
-
65
62
  ## Setup
66
63
 
67
64
  Before installing this package, make sure you have an active **Payra** account:
@@ -87,7 +84,6 @@ To obtain your **RPC URLs** which are required for reading on-chain order status
87
84
  Optional (recommended):
88
85
  - Create a free API key at [ExchangeRate API](https://www.exchangerate-api.com/) to enable **automatic fiat → USD conversions** using the built-in utility helpers.
89
86
 
90
-
91
87
  ## Installation
92
88
 
93
89
  ### From PyPI
@@ -129,7 +125,6 @@ cp .env.example .env
129
125
 
130
126
  This file stores your **private configuration** and connection settings for all supported networks. Never commit `.env` to version control.
131
127
 
132
-
133
128
  ### Required Variables
134
129
 
135
130
  #### Exchange Rate (optional)
@@ -175,10 +170,10 @@ PAYRA_LINEA_RPC_URL_2=
175
170
 
176
171
  ## Usage Example
177
172
 
178
- ### Generating and verifying a Payra signature in your backend
173
+ ### Generating signature
179
174
 
180
175
  ```python
181
- from payra_sdk import PayraUtils, PayraSignatureGenerator, PayraSDKException
176
+ from payra_sdk import PayraUtils, PayraSignature, PayraSDKException
182
177
 
183
178
  try:
184
179
  # Convert amount to smallest unit (wei or token decimals
@@ -186,24 +181,24 @@ try:
186
181
 
187
182
  PAYMENT_DATA = {
188
183
  "network": "polygon",
189
- "tokenAddress": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", # USDT on Polygon
190
- "orderId": "ORDER-1753824905006-301-322",
191
- "amountWei": amount_wei, # e.g. 3.34 USDT in smallest unit
184
+ "token_address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", # USDT on Polygon
185
+ "order_id": "ord-258",
186
+ "amount_wei": amount_wei, # e.g. 3.34 USDT in smallest unit
192
187
  "timestamp": 1753826059, # current Unix timestamp
193
- "payerAddress": "0xe6c961D6ad9a27Ea8e5d99e40abaC365DE9Cc162"
188
+ "payer_address": "0xe6c961D6ad9a27Ea8e5d99e40abaC365DE9Cc162"
194
189
  }
195
190
 
196
191
  # Initialize signer
197
- payra_signer = PayraSignatureGenerator()
192
+ payra_signature = PayraSignature()
198
193
 
199
194
  # Generate cryptographic signature
200
- signature = payra_signer.generate_signature(
195
+ signature = payra_signature.generate(
201
196
  network=PAYMENT_DATA["network"],
202
- token_address=PAYMENT_DATA["tokenAddress"],
203
- order_id=PAYMENT_DATA["orderId"],
204
- amount_wei=PAYMENT_DATA["amountWei"],
197
+ token_address=PAYMENT_DATA["token_address"],
198
+ order_id=PAYMENT_DATA["order_id"],
199
+ amount_wei=PAYMENT_DATA["amount_wei"],
205
200
  timestamp=PAYMENT_DATA["timestamp"],
206
- payer_address=PAYMENT_DATA["payerAddress"]
201
+ payer_address=PAYMENT_DATA["payer_address"]
207
202
  )
208
203
 
209
204
  print(f"Generated signature: {signature}")
@@ -218,11 +213,11 @@ except Exception as e:
218
213
  | Field | Type | Description |
219
214
  |--------------|----------|----------------------------------------------|
220
215
  | **`network`** | `string` | Selected network name |
221
- | **`tokenAddress`** | `string` | ERC20 token contract address |
222
- | **`orderId`** | `string` | Unique order reference (e.g. ORDER-123) |
223
- | **`amountWei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
216
+ | **`token_address`** | `string` | ERC20 token contract address |
217
+ | **`order_id`** | `string` | Unique order reference (e.g. ORDER-123) |
218
+ | **`amount_wei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
224
219
  | **`timestamp`** | `number` | Unix timestamp of signature creation |
225
- | **`payerAddress`** | `string` | Payer Wallet Address
220
+ | **`payer_address`** | `string` | Payer Wallet Address
226
221
 
227
222
  #### Behind the Scenes
228
223
 
@@ -233,7 +228,7 @@ except Exception as e:
233
228
 
234
229
  ---
235
230
 
236
- ### Get Order Status
231
+ ### Get Order Details
237
232
 
238
233
  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:
239
234
  - whether the order has been paid,
@@ -245,18 +240,18 @@ Retrieve **full payment details** for a specific order from the Payra smart cont
245
240
  Use this method when you need **detailed information** about the payment or want to display full transaction data.
246
241
 
247
242
  ```python
248
- from payra_sdk import PayraOrderVerification, PayraSDKException
243
+ from payra_sdk import PayraOrderService, PayraSDKException
249
244
 
250
245
  try:
251
246
  ORDER_ID = "ord-258"
252
247
  # Initialize verifier for a specific network
253
- verifier = PayraOrderVerification("polygon")
248
+ order_service = PayraOrderService("polygon")
254
249
 
255
- print("\nGet order status...")
256
- result = verifier.get_order_status(ORDER_ID)
250
+ print("\nGet order details...")
251
+ details = order_service.get_details(ORDER_ID)
257
252
 
258
253
  print("Order ID:", ORDER_ID)
259
- print("Result:", result)
254
+ print("Details:", details)
260
255
 
261
256
  except PayraSDKException as e:
262
257
  print(f"Payra SDK error: {e}")
@@ -266,8 +261,8 @@ except Exception as e:
266
261
 
267
262
  #### Behind the Scenes
268
263
 
269
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
270
- 2. It calls `get_order_status(order_id)` to check if the order transaction exists and is confirmed on-chain.
264
+ 1. The backend initializes a `PayraOrderService` object for the desired blockchain network.
265
+ 2. It calls `get_details(order_id)` to check if the order transaction exists and is confirmed on-chain.
271
266
  3. The function returns a dictionary with:
272
267
 
273
268
  ```python
@@ -291,16 +286,16 @@ Perform a **simple payment check** for a specific order. This method only verifi
291
286
  Use this method when you only need a **quick boolean confirmation** of the payment status.
292
287
 
293
288
  ```python
294
- from payra_sdk import PayraOrderVerification, PayraSDKException
289
+ from payra_sdk import PayraOrderService, PayraSDKException
295
290
 
296
291
  try:
297
292
  ORDER_ID = "ord-258"
298
293
 
299
294
  # Initialize verifier for a specific network
300
- verifier = PayraOrderVerification("polygon")
295
+ order_service = PayraOrderService("polygon")
301
296
 
302
297
  print("\nChecking order status...")
303
- result = verifier.is_order_paid(ORDER_ID)
298
+ result = order_service.is_paid(ORDER_ID)
304
299
 
305
300
  print("Order ID:", ORDER_ID)
306
301
  print("Result:", result)
@@ -320,7 +315,7 @@ except Exception as e:
320
315
 
321
316
  #### Behind the Scenes
322
317
 
323
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
318
+ 1. The backend initializes a `PayraOrderService` object for the desired blockchain network.
324
319
  2. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
325
320
  3. The function returns a dictionary with:
326
321
  ```python
@@ -365,14 +360,14 @@ print(f"100 EUR = {usd_value} USD")
365
360
  - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
366
361
  - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
367
362
 
368
-
369
363
  ## Testing
370
364
 
371
365
  You can run the included `examples` to test signing and verification:
372
366
 
373
367
  ```python
374
368
  python3 example_signature.py
375
- python3 example_order_verification.py
369
+ python3 example_order_get_details.py
370
+ python3 example_order_is_paid
376
371
  python3 example_utils.py
377
372
  ```
378
373
 
@@ -384,7 +379,6 @@ Make sure your `.env` file contains correct values for the `network` being used.
384
379
  - The SDK examples are safe to run, they use **read-only RPC calls** (no real transactions are broadcast).
385
380
  - You can modify `example_signature.py` to test custom token addresses or order parameters.
386
381
 
387
-
388
382
  ## Projects
389
383
 
390
384
  - [GitHub/Home](https://github.com/payracash)
@@ -398,7 +392,6 @@ Make sure your `.env` file contains correct values for the `network` being used.
398
392
  - [https://payra.xyz](https://payra.xyz)
399
393
  - [https://payra.eth](https://payra.eth.limo) - suporrted by Brave and Opera Browser or .limo
400
394
 
401
-
402
395
  ## Social Media
403
396
 
404
397
  - [Telegram Payra Group](https://t.me/+GhTyJJrd4SMyMDA0)
@@ -4,8 +4,7 @@ Official **Python SDK** for integrating **Payra's on-chain payment system** into
4
4
 
5
5
  This SDK provides:
6
6
  - Secure generation of **ECDSA signatures** compatible with the Payra smart contract, used for order payment verification.
7
- - Simple methods for **checking the on-chain status of orders** to confirm completed payments.
8
-
7
+ - Simple methods for **checking the on-chain details of orders** to confirm completed payments.
9
8
 
10
9
  ## How It Works
11
10
 
@@ -24,20 +23,18 @@ The typical flow for signing and verifying a Payra transaction:
24
23
 
25
24
  This process ensures full compatibility between your backend and Payra’s on-chain verification logic.
26
25
 
27
-
28
26
  ## Features
29
27
 
30
28
  - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
31
29
  - Fully compatible with **Payra's Solidity smart contracts** (`ERC-1155` payment verification).
32
30
  - Supports `.env` and `config/payra.php` configuration for multiple blockchain networks.
33
31
  - Laravel IoC container integration (easy dependency injection)
34
- - Verifies **order payment status directly on-chain** via RPC or blockchain explorer API.
32
+ - Verifies **order payment details directly on-chain** via RPC or blockchain explorer API.
35
33
  - Provides **secure backend integration** for signing and verifying transactions.
36
34
  - Includes optional utility helpers for:
37
35
  - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
38
36
  - **USD ⇄ WEI** conversion for token precision handling.
39
37
 
40
-
41
38
  ## Setup
42
39
 
43
40
  Before installing this package, make sure you have an active **Payra** account:
@@ -63,7 +60,6 @@ To obtain your **RPC URLs** which are required for reading on-chain order status
63
60
  Optional (recommended):
64
61
  - Create a free API key at [ExchangeRate API](https://www.exchangerate-api.com/) to enable **automatic fiat → USD conversions** using the built-in utility helpers.
65
62
 
66
-
67
63
  ## Installation
68
64
 
69
65
  ### From PyPI
@@ -105,7 +101,6 @@ cp .env.example .env
105
101
 
106
102
  This file stores your **private configuration** and connection settings for all supported networks. Never commit `.env` to version control.
107
103
 
108
-
109
104
  ### Required Variables
110
105
 
111
106
  #### Exchange Rate (optional)
@@ -151,10 +146,10 @@ PAYRA_LINEA_RPC_URL_2=
151
146
 
152
147
  ## Usage Example
153
148
 
154
- ### Generating and verifying a Payra signature in your backend
149
+ ### Generating signature
155
150
 
156
151
  ```python
157
- from payra_sdk import PayraUtils, PayraSignatureGenerator, PayraSDKException
152
+ from payra_sdk import PayraUtils, PayraSignature, PayraSDKException
158
153
 
159
154
  try:
160
155
  # Convert amount to smallest unit (wei or token decimals
@@ -162,24 +157,24 @@ try:
162
157
 
163
158
  PAYMENT_DATA = {
164
159
  "network": "polygon",
165
- "tokenAddress": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", # USDT on Polygon
166
- "orderId": "ORDER-1753824905006-301-322",
167
- "amountWei": amount_wei, # e.g. 3.34 USDT in smallest unit
160
+ "token_address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", # USDT on Polygon
161
+ "order_id": "ord-258",
162
+ "amount_wei": amount_wei, # e.g. 3.34 USDT in smallest unit
168
163
  "timestamp": 1753826059, # current Unix timestamp
169
- "payerAddress": "0xe6c961D6ad9a27Ea8e5d99e40abaC365DE9Cc162"
164
+ "payer_address": "0xe6c961D6ad9a27Ea8e5d99e40abaC365DE9Cc162"
170
165
  }
171
166
 
172
167
  # Initialize signer
173
- payra_signer = PayraSignatureGenerator()
168
+ payra_signature = PayraSignature()
174
169
 
175
170
  # Generate cryptographic signature
176
- signature = payra_signer.generate_signature(
171
+ signature = payra_signature.generate(
177
172
  network=PAYMENT_DATA["network"],
178
- token_address=PAYMENT_DATA["tokenAddress"],
179
- order_id=PAYMENT_DATA["orderId"],
180
- amount_wei=PAYMENT_DATA["amountWei"],
173
+ token_address=PAYMENT_DATA["token_address"],
174
+ order_id=PAYMENT_DATA["order_id"],
175
+ amount_wei=PAYMENT_DATA["amount_wei"],
181
176
  timestamp=PAYMENT_DATA["timestamp"],
182
- payer_address=PAYMENT_DATA["payerAddress"]
177
+ payer_address=PAYMENT_DATA["payer_address"]
183
178
  )
184
179
 
185
180
  print(f"Generated signature: {signature}")
@@ -194,11 +189,11 @@ except Exception as e:
194
189
  | Field | Type | Description |
195
190
  |--------------|----------|----------------------------------------------|
196
191
  | **`network`** | `string` | Selected network name |
197
- | **`tokenAddress`** | `string` | ERC20 token contract address |
198
- | **`orderId`** | `string` | Unique order reference (e.g. ORDER-123) |
199
- | **`amountWei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
192
+ | **`token_address`** | `string` | ERC20 token contract address |
193
+ | **`order_id`** | `string` | Unique order reference (e.g. ORDER-123) |
194
+ | **`amount_wei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
200
195
  | **`timestamp`** | `number` | Unix timestamp of signature creation |
201
- | **`payerAddress`** | `string` | Payer Wallet Address
196
+ | **`payer_address`** | `string` | Payer Wallet Address
202
197
 
203
198
  #### Behind the Scenes
204
199
 
@@ -209,7 +204,7 @@ except Exception as e:
209
204
 
210
205
  ---
211
206
 
212
- ### Get Order Status
207
+ ### Get Order Details
213
208
 
214
209
  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:
215
210
  - whether the order has been paid,
@@ -221,18 +216,18 @@ Retrieve **full payment details** for a specific order from the Payra smart cont
221
216
  Use this method when you need **detailed information** about the payment or want to display full transaction data.
222
217
 
223
218
  ```python
224
- from payra_sdk import PayraOrderVerification, PayraSDKException
219
+ from payra_sdk import PayraOrderService, PayraSDKException
225
220
 
226
221
  try:
227
222
  ORDER_ID = "ord-258"
228
223
  # Initialize verifier for a specific network
229
- verifier = PayraOrderVerification("polygon")
224
+ order_service = PayraOrderService("polygon")
230
225
 
231
- print("\nGet order status...")
232
- result = verifier.get_order_status(ORDER_ID)
226
+ print("\nGet order details...")
227
+ details = order_service.get_details(ORDER_ID)
233
228
 
234
229
  print("Order ID:", ORDER_ID)
235
- print("Result:", result)
230
+ print("Details:", details)
236
231
 
237
232
  except PayraSDKException as e:
238
233
  print(f"Payra SDK error: {e}")
@@ -242,8 +237,8 @@ except Exception as e:
242
237
 
243
238
  #### Behind the Scenes
244
239
 
245
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
246
- 2. It calls `get_order_status(order_id)` to check if the order transaction exists and is confirmed on-chain.
240
+ 1. The backend initializes a `PayraOrderService` object for the desired blockchain network.
241
+ 2. It calls `get_details(order_id)` to check if the order transaction exists and is confirmed on-chain.
247
242
  3. The function returns a dictionary with:
248
243
 
249
244
  ```python
@@ -267,16 +262,16 @@ Perform a **simple payment check** for a specific order. This method only verifi
267
262
  Use this method when you only need a **quick boolean confirmation** of the payment status.
268
263
 
269
264
  ```python
270
- from payra_sdk import PayraOrderVerification, PayraSDKException
265
+ from payra_sdk import PayraOrderService, PayraSDKException
271
266
 
272
267
  try:
273
268
  ORDER_ID = "ord-258"
274
269
 
275
270
  # Initialize verifier for a specific network
276
- verifier = PayraOrderVerification("polygon")
271
+ order_service = PayraOrderService("polygon")
277
272
 
278
273
  print("\nChecking order status...")
279
- result = verifier.is_order_paid(ORDER_ID)
274
+ result = order_service.is_paid(ORDER_ID)
280
275
 
281
276
  print("Order ID:", ORDER_ID)
282
277
  print("Result:", result)
@@ -296,7 +291,7 @@ except Exception as e:
296
291
 
297
292
  #### Behind the Scenes
298
293
 
299
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
294
+ 1. The backend initializes a `PayraOrderService` object for the desired blockchain network.
300
295
  2. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
301
296
  3. The function returns a dictionary with:
302
297
  ```python
@@ -341,14 +336,14 @@ print(f"100 EUR = {usd_value} USD")
341
336
  - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
342
337
  - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
343
338
 
344
-
345
339
  ## Testing
346
340
 
347
341
  You can run the included `examples` to test signing and verification:
348
342
 
349
343
  ```python
350
344
  python3 example_signature.py
351
- python3 example_order_verification.py
345
+ python3 example_order_get_details.py
346
+ python3 example_order_is_paid
352
347
  python3 example_utils.py
353
348
  ```
354
349
 
@@ -360,7 +355,6 @@ Make sure your `.env` file contains correct values for the `network` being used.
360
355
  - The SDK examples are safe to run, they use **read-only RPC calls** (no real transactions are broadcast).
361
356
  - You can modify `example_signature.py` to test custom token addresses or order parameters.
362
357
 
363
-
364
358
  ## Projects
365
359
 
366
360
  - [GitHub/Home](https://github.com/payracash)
@@ -374,7 +368,6 @@ Make sure your `.env` file contains correct values for the `network` being used.
374
368
  - [https://payra.xyz](https://payra.xyz)
375
369
  - [https://payra.eth](https://payra.eth.limo) - suporrted by Brave and Opera Browser or .limo
376
370
 
377
-
378
371
  ## Social Media
379
372
 
380
373
  - [Telegram Payra Group](https://t.me/+GhTyJJrd4SMyMDA0)
@@ -1,13 +1,13 @@
1
1
  # payra-sdk-python/payra_sdk/__init__.py
2
2
 
3
- from .signature import PayraSignatureGenerator
4
- from .order_verification import PayraOrderVerification
3
+ from .signature import PayraSignature
4
+ from .order_service import PayraOrderService
5
5
  from .exceptions import PayraSDKException, InvalidArgumentError, SignatureError
6
6
  from .utils import PayraUtils
7
7
 
8
8
  __all__ = [
9
- "PayraSignatureGenerator",
10
- "PayraOrderVerification",
9
+ "PayraSignature",
10
+ "PayraOrderService",
11
11
  "PayraSDKException",
12
12
  "InvalidArgumentError",
13
13
  "SignatureError",
@@ -11,7 +11,7 @@ from .exceptions import InvalidArgumentError, SignatureError
11
11
  # load env
12
12
  load_dotenv()
13
13
 
14
- class PayraOrderVerification:
14
+ class PayraOrderService:
15
15
  """
16
16
  SDK for verifying if an order has been paid using the Payra smart contract.
17
17
  """
@@ -22,7 +22,7 @@ class PayraOrderVerification:
22
22
 
23
23
  self.web3 = Web3(Web3.HTTPProvider(self.rpc_url))
24
24
  if not self.web3.is_connected():
25
- raise ConnectionError(f"Failed to connect to QuickNode RPC for {self.network}")
25
+ raise ConnectionError(f"Failed to connect to RPC for {self.network}")
26
26
 
27
27
  self.merchant_id = os.getenv(f"PAYRA_{self.network}_MERCHANT_ID")
28
28
  self.gateway_address = os.getenv(f"PAYRA_{self.network}_OCP_GATEWAY_CONTRACT_ADDRESS")
@@ -53,7 +53,7 @@ class PayraOrderVerification:
53
53
  # Return the actual contract responsible for order data
54
54
  return self.web3.eth.contract(address=user_data_address, abi=self.abi)
55
55
 
56
- def is_order_paid(self, order_id: str) -> dict:
56
+ def is_paid(self, order_id: str) -> dict:
57
57
  """
58
58
  Verify if an order is paid on Payra contract.
59
59
  """
@@ -76,7 +76,7 @@ class PayraOrderVerification:
76
76
  "error": str(e)
77
77
  }
78
78
 
79
- def get_order_status(self, order_id: str) -> dict:
79
+ def get_details(self, order_id: str) -> dict:
80
80
  """
81
81
  Detailed status of an order from Payra smart contract.
82
82
  Equivalent to getOrderDetails in Node.js version.
@@ -12,7 +12,7 @@ from .exceptions import InvalidArgumentError, SignatureError
12
12
  # Load environment variables from .env file
13
13
  load_dotenv()
14
14
 
15
- class PayraSignatureGenerator:
15
+ class PayraSignature:
16
16
  """
17
17
  SDK for generating Payra payment signatures on the backend.
18
18
  This version assumes `amount_wei` is already in the token's smallest unit (e.g., wei)
@@ -22,10 +22,10 @@ class PayraSignatureGenerator:
22
22
  def __init__(self):
23
23
 
24
24
  """
25
- Initializes the PayraSignatureGenerator.
25
+ Initializes the PayraSignature.
26
26
  """
27
27
 
28
- def generate_signature(
28
+ def generate(
29
29
  self,
30
30
  network: str,
31
31
  token_address: str,
@@ -117,7 +117,7 @@ class PayraSignatureGenerator:
117
117
  raise SignatureError(f"Error generating signature: {e}")
118
118
 
119
119
  # Optional: Add a verification method if you ever need to verify a signature offline
120
- def verify_signature(
120
+ def verify(
121
121
  self,
122
122
  network: str,
123
123
  token_address: str,
@@ -168,7 +168,7 @@ class PayraSignatureGenerator:
168
168
  ) -> bytes:
169
169
  """
170
170
  Generates the raw Keccak256 hash of the ABI-encoded payment data.
171
- This is a helper for internal use, especially for `verify_signature`.
171
+ This is a helper for internal use, especially for `verify`.
172
172
  """
173
173
  checksum_token_address = to_checksum_address(token_address)
174
174
  checksum_payer_address = to_checksum_address(payer_address)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: payra_sdk
3
- Version: 1.2.6
3
+ Version: 1.2.7
4
4
  Summary: Python SDK for Payra payment signature generation (backend)
5
5
  Author: Your Name
6
6
  Author-email: Wraith <support@payra.cash>
@@ -28,8 +28,7 @@ Official **Python SDK** for integrating **Payra's on-chain payment system** into
28
28
 
29
29
  This SDK provides:
30
30
  - Secure generation of **ECDSA signatures** compatible with the Payra smart contract, used for order payment verification.
31
- - Simple methods for **checking the on-chain status of orders** to confirm completed payments.
32
-
31
+ - Simple methods for **checking the on-chain details of orders** to confirm completed payments.
33
32
 
34
33
  ## How It Works
35
34
 
@@ -48,20 +47,18 @@ The typical flow for signing and verifying a Payra transaction:
48
47
 
49
48
  This process ensures full compatibility between your backend and Payra’s on-chain verification logic.
50
49
 
51
-
52
50
  ## Features
53
51
 
54
52
  - Generates **Ethereum ECDSA signatures** using the `secp256k1` curve.
55
53
  - Fully compatible with **Payra's Solidity smart contracts** (`ERC-1155` payment verification).
56
54
  - Supports `.env` and `config/payra.php` configuration for multiple blockchain networks.
57
55
  - Laravel IoC container integration (easy dependency injection)
58
- - Verifies **order payment status directly on-chain** via RPC or blockchain explorer API.
56
+ - Verifies **order payment details directly on-chain** via RPC or blockchain explorer API.
59
57
  - Provides **secure backend integration** for signing and verifying transactions.
60
58
  - Includes optional utility helpers for:
61
59
  - **Currency conversion** (via [ExchangeRate API](https://www.exchangerate-api.com/))
62
60
  - **USD ⇄ WEI** conversion for token precision handling.
63
61
 
64
-
65
62
  ## Setup
66
63
 
67
64
  Before installing this package, make sure you have an active **Payra** account:
@@ -87,7 +84,6 @@ To obtain your **RPC URLs** which are required for reading on-chain order status
87
84
  Optional (recommended):
88
85
  - Create a free API key at [ExchangeRate API](https://www.exchangerate-api.com/) to enable **automatic fiat → USD conversions** using the built-in utility helpers.
89
86
 
90
-
91
87
  ## Installation
92
88
 
93
89
  ### From PyPI
@@ -129,7 +125,6 @@ cp .env.example .env
129
125
 
130
126
  This file stores your **private configuration** and connection settings for all supported networks. Never commit `.env` to version control.
131
127
 
132
-
133
128
  ### Required Variables
134
129
 
135
130
  #### Exchange Rate (optional)
@@ -175,10 +170,10 @@ PAYRA_LINEA_RPC_URL_2=
175
170
 
176
171
  ## Usage Example
177
172
 
178
- ### Generating and verifying a Payra signature in your backend
173
+ ### Generating signature
179
174
 
180
175
  ```python
181
- from payra_sdk import PayraUtils, PayraSignatureGenerator, PayraSDKException
176
+ from payra_sdk import PayraUtils, PayraSignature, PayraSDKException
182
177
 
183
178
  try:
184
179
  # Convert amount to smallest unit (wei or token decimals
@@ -186,24 +181,24 @@ try:
186
181
 
187
182
  PAYMENT_DATA = {
188
183
  "network": "polygon",
189
- "tokenAddress": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", # USDT on Polygon
190
- "orderId": "ORDER-1753824905006-301-322",
191
- "amountWei": amount_wei, # e.g. 3.34 USDT in smallest unit
184
+ "token_address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", # USDT on Polygon
185
+ "order_id": "ord-258",
186
+ "amount_wei": amount_wei, # e.g. 3.34 USDT in smallest unit
192
187
  "timestamp": 1753826059, # current Unix timestamp
193
- "payerAddress": "0xe6c961D6ad9a27Ea8e5d99e40abaC365DE9Cc162"
188
+ "payer_address": "0xe6c961D6ad9a27Ea8e5d99e40abaC365DE9Cc162"
194
189
  }
195
190
 
196
191
  # Initialize signer
197
- payra_signer = PayraSignatureGenerator()
192
+ payra_signature = PayraSignature()
198
193
 
199
194
  # Generate cryptographic signature
200
- signature = payra_signer.generate_signature(
195
+ signature = payra_signature.generate(
201
196
  network=PAYMENT_DATA["network"],
202
- token_address=PAYMENT_DATA["tokenAddress"],
203
- order_id=PAYMENT_DATA["orderId"],
204
- amount_wei=PAYMENT_DATA["amountWei"],
197
+ token_address=PAYMENT_DATA["token_address"],
198
+ order_id=PAYMENT_DATA["order_id"],
199
+ amount_wei=PAYMENT_DATA["amount_wei"],
205
200
  timestamp=PAYMENT_DATA["timestamp"],
206
- payer_address=PAYMENT_DATA["payerAddress"]
201
+ payer_address=PAYMENT_DATA["payer_address"]
207
202
  )
208
203
 
209
204
  print(f"Generated signature: {signature}")
@@ -218,11 +213,11 @@ except Exception as e:
218
213
  | Field | Type | Description |
219
214
  |--------------|----------|----------------------------------------------|
220
215
  | **`network`** | `string` | Selected network name |
221
- | **`tokenAddress`** | `string` | ERC20 token contract address |
222
- | **`orderId`** | `string` | Unique order reference (e.g. ORDER-123) |
223
- | **`amountWei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
216
+ | **`token_address`** | `string` | ERC20 token contract address |
217
+ | **`order_id`** | `string` | Unique order reference (e.g. ORDER-123) |
218
+ | **`amount_wei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
224
219
  | **`timestamp`** | `number` | Unix timestamp of signature creation |
225
- | **`payerAddress`** | `string` | Payer Wallet Address
220
+ | **`payer_address`** | `string` | Payer Wallet Address
226
221
 
227
222
  #### Behind the Scenes
228
223
 
@@ -233,7 +228,7 @@ except Exception as e:
233
228
 
234
229
  ---
235
230
 
236
- ### Get Order Status
231
+ ### Get Order Details
237
232
 
238
233
  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:
239
234
  - whether the order has been paid,
@@ -245,18 +240,18 @@ Retrieve **full payment details** for a specific order from the Payra smart cont
245
240
  Use this method when you need **detailed information** about the payment or want to display full transaction data.
246
241
 
247
242
  ```python
248
- from payra_sdk import PayraOrderVerification, PayraSDKException
243
+ from payra_sdk import PayraOrderService, PayraSDKException
249
244
 
250
245
  try:
251
246
  ORDER_ID = "ord-258"
252
247
  # Initialize verifier for a specific network
253
- verifier = PayraOrderVerification("polygon")
248
+ order_service = PayraOrderService("polygon")
254
249
 
255
- print("\nGet order status...")
256
- result = verifier.get_order_status(ORDER_ID)
250
+ print("\nGet order details...")
251
+ details = order_service.get_details(ORDER_ID)
257
252
 
258
253
  print("Order ID:", ORDER_ID)
259
- print("Result:", result)
254
+ print("Details:", details)
260
255
 
261
256
  except PayraSDKException as e:
262
257
  print(f"Payra SDK error: {e}")
@@ -266,8 +261,8 @@ except Exception as e:
266
261
 
267
262
  #### Behind the Scenes
268
263
 
269
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
270
- 2. It calls `get_order_status(order_id)` to check if the order transaction exists and is confirmed on-chain.
264
+ 1. The backend initializes a `PayraOrderService` object for the desired blockchain network.
265
+ 2. It calls `get_details(order_id)` to check if the order transaction exists and is confirmed on-chain.
271
266
  3. The function returns a dictionary with:
272
267
 
273
268
  ```python
@@ -291,16 +286,16 @@ Perform a **simple payment check** for a specific order. This method only verifi
291
286
  Use this method when you only need a **quick boolean confirmation** of the payment status.
292
287
 
293
288
  ```python
294
- from payra_sdk import PayraOrderVerification, PayraSDKException
289
+ from payra_sdk import PayraOrderService, PayraSDKException
295
290
 
296
291
  try:
297
292
  ORDER_ID = "ord-258"
298
293
 
299
294
  # Initialize verifier for a specific network
300
- verifier = PayraOrderVerification("polygon")
295
+ order_service = PayraOrderService("polygon")
301
296
 
302
297
  print("\nChecking order status...")
303
- result = verifier.is_order_paid(ORDER_ID)
298
+ result = order_service.is_paid(ORDER_ID)
304
299
 
305
300
  print("Order ID:", ORDER_ID)
306
301
  print("Result:", result)
@@ -320,7 +315,7 @@ except Exception as e:
320
315
 
321
316
  #### Behind the Scenes
322
317
 
323
- 1. The backend initializes a `PayraOrderVerification` object for the desired blockchain network.
318
+ 1. The backend initializes a `PayraOrderService` object for the desired blockchain network.
324
319
  2. It calls `is_order_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
325
320
  3. The function returns a dictionary with:
326
321
  ```python
@@ -365,14 +360,14 @@ print(f"100 EUR = {usd_value} USD")
365
360
  - `get_decimals(network, token)` – Returns the number of decimals for the given token on that network.
366
361
  - `convert_to_usd(amount, currency)` – Converts fiat amounts (e.g. EUR, GBP) to USD using your ExchangeRate API key.
367
362
 
368
-
369
363
  ## Testing
370
364
 
371
365
  You can run the included `examples` to test signing and verification:
372
366
 
373
367
  ```python
374
368
  python3 example_signature.py
375
- python3 example_order_verification.py
369
+ python3 example_order_get_details.py
370
+ python3 example_order_is_paid
376
371
  python3 example_utils.py
377
372
  ```
378
373
 
@@ -384,7 +379,6 @@ Make sure your `.env` file contains correct values for the `network` being used.
384
379
  - The SDK examples are safe to run, they use **read-only RPC calls** (no real transactions are broadcast).
385
380
  - You can modify `example_signature.py` to test custom token addresses or order parameters.
386
381
 
387
-
388
382
  ## Projects
389
383
 
390
384
  - [GitHub/Home](https://github.com/payracash)
@@ -398,7 +392,6 @@ Make sure your `.env` file contains correct values for the `network` being used.
398
392
  - [https://payra.xyz](https://payra.xyz)
399
393
  - [https://payra.eth](https://payra.eth.limo) - suporrted by Brave and Opera Browser or .limo
400
394
 
401
-
402
395
  ## Social Media
403
396
 
404
397
  - [Telegram Payra Group](https://t.me/+GhTyJJrd4SMyMDA0)
@@ -6,7 +6,7 @@ pyproject.toml
6
6
  setup.cfg
7
7
  payra_sdk/__init__.py
8
8
  payra_sdk/exceptions.py
9
- payra_sdk/order_verification.py
9
+ payra_sdk/order_service.py
10
10
  payra_sdk/signature.py
11
11
  payra_sdk/utils.py
12
12
  payra_sdk.egg-info/PKG-INFO
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "payra_sdk"
5
- version = "1.2.6"
5
+ version = "1.2.7"
6
6
  description = "Python SDK for Payra payment signature generation (backend)"
7
7
  readme = "README.md"
8
8
  authors = [{ name = "Wraith", email = "support@payra.cash" }]
File without changes
File without changes
File without changes
File without changes
File without changes