payra-sdk 1.2.7__py3-none-any.whl → 1.2.8__py3-none-any.whl
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.
- {payra_sdk-1.2.7.dist-info → payra_sdk-1.2.8.dist-info}/METADATA +26 -26
- {payra_sdk-1.2.7.dist-info → payra_sdk-1.2.8.dist-info}/RECORD +5 -5
- {payra_sdk-1.2.7.dist-info → payra_sdk-1.2.8.dist-info}/WHEEL +0 -0
- {payra_sdk-1.2.7.dist-info → payra_sdk-1.2.8.dist-info}/licenses/LICENSE +0 -0
- {payra_sdk-1.2.7.dist-info → payra_sdk-1.2.8.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: payra_sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.8
|
|
4
4
|
Summary: Python SDK for Payra payment signature generation (backend)
|
|
5
5
|
Author: Your Name
|
|
6
6
|
Author-email: Wraith <support@payra.cash>
|
|
@@ -159,9 +159,9 @@ PAYRA_LINEA_RPC_URL_2=
|
|
|
159
159
|
|
|
160
160
|
- The cache automatically refreshes when it expires.
|
|
161
161
|
- You can adjust the cache duration by setting `PAYRA_EXCHANGE_RATE_CACHE_TIME`:
|
|
162
|
-
- `5` → cache for 5 minutes
|
|
163
|
-
- `60` → cache for 1 hour
|
|
164
|
-
- `720` → cache for 12 hours (default)
|
|
162
|
+
- `5` → cache for 5 minutes
|
|
163
|
+
- `60` → cache for 1 hour
|
|
164
|
+
- `720` → cache for 12 hours (default)
|
|
165
165
|
- Each network (Polygon, Ethereum, Linea) has its own **merchant ID**, **signature key**, and **RPC URLs**.
|
|
166
166
|
- The SDK automatically detects which chain configuration to use based on the selected network.
|
|
167
167
|
- You can use multiple RPC URLs for redundancy (the SDK will automatically fall back if one fails).
|
|
@@ -181,11 +181,11 @@ try:
|
|
|
181
181
|
|
|
182
182
|
PAYMENT_DATA = {
|
|
183
183
|
"network": "polygon",
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
184
|
+
"tokenAddress": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", # USDT on Polygon
|
|
185
|
+
"orderId": "ord-258",
|
|
186
|
+
"amountWei": amount_wei, # e.g. 3.34 USDT in smallest unit
|
|
187
187
|
"timestamp": 1753826059, # current Unix timestamp
|
|
188
|
-
"
|
|
188
|
+
"payerAddress": "0xe6c961D6ad9a27Ea8e5d99e40abaC365DE9Cc162"
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
# Initialize signer
|
|
@@ -194,11 +194,11 @@ try:
|
|
|
194
194
|
# Generate cryptographic signature
|
|
195
195
|
signature = payra_signature.generate(
|
|
196
196
|
network=PAYMENT_DATA["network"],
|
|
197
|
-
token_address=PAYMENT_DATA["
|
|
198
|
-
order_id=PAYMENT_DATA["
|
|
199
|
-
amount_wei=PAYMENT_DATA["
|
|
197
|
+
token_address=PAYMENT_DATA["tokenAddress"],
|
|
198
|
+
order_id=PAYMENT_DATA["orderId"],
|
|
199
|
+
amount_wei=PAYMENT_DATA["amountWei"],
|
|
200
200
|
timestamp=PAYMENT_DATA["timestamp"],
|
|
201
|
-
payer_address=PAYMENT_DATA["
|
|
201
|
+
payer_address=PAYMENT_DATA["payerAddress"]
|
|
202
202
|
)
|
|
203
203
|
|
|
204
204
|
print(f"Generated signature: {signature}")
|
|
@@ -213,16 +213,16 @@ except Exception as e:
|
|
|
213
213
|
| Field | Type | Description |
|
|
214
214
|
|--------------|----------|----------------------------------------------|
|
|
215
215
|
| **`network`** | `string` | Selected network name |
|
|
216
|
-
| **`
|
|
217
|
-
| **`
|
|
218
|
-
| **`
|
|
216
|
+
| **`tokenAddress`** | `string` | ERC20 token contract address |
|
|
217
|
+
| **`orderId`** | `string` | Unique order reference (e.g. ORDER-123) |
|
|
218
|
+
| **`amountWei`** | `string` or `integer` | Token amount in smallest unit (e.g. wei) |
|
|
219
219
|
| **`timestamp`** | `number` | Unix timestamp of signature creation |
|
|
220
|
-
| **`
|
|
220
|
+
| **`payerAddress`** | `string` | Payer Wallet Address
|
|
221
221
|
|
|
222
222
|
#### Behind the Scenes
|
|
223
223
|
|
|
224
224
|
1. The backend converts the amount to the smallest blockchain unit (e.g. wei).
|
|
225
|
-
2. A `
|
|
225
|
+
2. A `PayraSignature` instance is created using your signature key from `.env`
|
|
226
226
|
3. It generates an ECDSA signature that is fully verifiable on-chain by the Payra smart contract.
|
|
227
227
|
4. 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.
|
|
228
228
|
|
|
@@ -252,7 +252,7 @@ try:
|
|
|
252
252
|
|
|
253
253
|
print("Order ID:", ORDER_ID)
|
|
254
254
|
print("Details:", details)
|
|
255
|
-
|
|
255
|
+
|
|
256
256
|
except PayraSDKException as e:
|
|
257
257
|
print(f"Payra SDK error: {e}")
|
|
258
258
|
except Exception as e:
|
|
@@ -262,14 +262,14 @@ except Exception as e:
|
|
|
262
262
|
#### Behind the Scenes
|
|
263
263
|
|
|
264
264
|
1. The backend initializes a `PayraOrderService` object for the desired blockchain network.
|
|
265
|
-
2. It calls `get_details(order_id)` to
|
|
265
|
+
2. It calls `get_details(order_id)` to get transaction details from blockchain.
|
|
266
266
|
3. The function returns a dictionary with:
|
|
267
267
|
|
|
268
268
|
```python
|
|
269
269
|
{
|
|
270
270
|
"success": True,
|
|
271
271
|
"paid": True,
|
|
272
|
-
"error": None
|
|
272
|
+
"error": None,
|
|
273
273
|
"toke": '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
|
|
274
274
|
"amount": 400000,
|
|
275
275
|
"fee": 3600,
|
|
@@ -316,7 +316,7 @@ except Exception as e:
|
|
|
316
316
|
#### Behind the Scenes
|
|
317
317
|
|
|
318
318
|
1. The backend initializes a `PayraOrderService` object for the desired blockchain network.
|
|
319
|
-
2. It calls `
|
|
319
|
+
2. It calls `is_paid(order_id)` to check if the order transaction exists and is confirmed on-chain.
|
|
320
320
|
3. The function returns a dictionary with:
|
|
321
321
|
```python
|
|
322
322
|
{
|
|
@@ -367,17 +367,16 @@ You can run the included `examples` to test signing and verification:
|
|
|
367
367
|
```python
|
|
368
368
|
python3 example_signature.py
|
|
369
369
|
python3 example_order_get_details.py
|
|
370
|
-
python3 example_order_is_paid
|
|
370
|
+
python3 example_order_is_paid.py
|
|
371
371
|
python3 example_utils.py
|
|
372
372
|
```
|
|
373
373
|
|
|
374
374
|
Make sure your `.env` file contains correct values for the `network` being used.
|
|
375
375
|
|
|
376
|
-
|
|
376
|
+
## Security Notice
|
|
377
377
|
|
|
378
|
-
|
|
379
|
-
-
|
|
380
|
-
- You can modify `example_signature.py` to test custom token addresses or order parameters.
|
|
378
|
+
Never expose your signature key in frontend or client-side code.
|
|
379
|
+
This SDK is **server-side only** and must be used securely on your backend. Never use it in frontend or browser environments. Also, never commit your `.env` file to version control.
|
|
381
380
|
|
|
382
381
|
## Projects
|
|
383
382
|
|
|
@@ -400,4 +399,5 @@ Make sure your `.env` file contains correct values for the `network` being used.
|
|
|
400
399
|
- [Dev.to](https://dev.to/payracash)
|
|
401
400
|
|
|
402
401
|
## License
|
|
402
|
+
|
|
403
403
|
MIT © [Payra](https://payra.cash)
|
|
@@ -3,8 +3,8 @@ payra_sdk/exceptions.py,sha256=Dr8dy0RohAYII_-YeSu_doPJSr0EsJPcp6Oj02sio9Q,425
|
|
|
3
3
|
payra_sdk/order_service.py,sha256=4fFplTMJh0ZB4tgeSqat5hdMQ7Ijf0aI-mGg7scoy5o,4316
|
|
4
4
|
payra_sdk/signature.py,sha256=Py7iqCc9juy56mFHXEUVCpfKYsdLuVh482GZLv0q4iI,8579
|
|
5
5
|
payra_sdk/utils.py,sha256=mp9xX-6ph_xRMSIHh6PP41RcYyKZMLVPEi9M3IxxC4c,4147
|
|
6
|
-
payra_sdk-1.2.
|
|
7
|
-
payra_sdk-1.2.
|
|
8
|
-
payra_sdk-1.2.
|
|
9
|
-
payra_sdk-1.2.
|
|
10
|
-
payra_sdk-1.2.
|
|
6
|
+
payra_sdk-1.2.8.dist-info/licenses/LICENSE,sha256=mnnujAcvHr1ULEDD2l0ZT6lrpeTv_9bG3n8sngv7ew8,120
|
|
7
|
+
payra_sdk-1.2.8.dist-info/METADATA,sha256=NIKVnAg0xdEKr5rKC_Om8nytkacrfJYYkTVywWBtf5o,14222
|
|
8
|
+
payra_sdk-1.2.8.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
9
|
+
payra_sdk-1.2.8.dist-info/top_level.txt,sha256=oC4dhGzjcpDRRwyU9JjtLu56Uc5moaa76utQGYsPL-g,10
|
|
10
|
+
payra_sdk-1.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|