@@ -27,14 +27,14 @@ This documentation is for the new Mollie's SDK. You can find more details on how
27
27
* [ IDE Support] ( #ide-support )
28
28
* [ SDK Example Usage] ( #sdk-example-usage )
29
29
* [ Authentication] ( #authentication )
30
+ * [ Idempotency Key] ( #idempotency-key )
30
31
* [ Available Resources and Operations] ( #available-resources-and-operations )
31
32
* [ Retries] ( #retries )
32
33
* [ Error Handling] ( #error-handling )
33
34
* [ Server Selection] ( #server-selection )
34
35
* [ Custom HTTP Client] ( #custom-http-client )
35
36
* [ Resource Management] ( #resource-management )
36
37
* [ Debugging] ( #debugging )
37
- * [ Idempotency Key] ( #idempotency-key )
38
38
* [ Development] ( #development )
39
39
* [ Maturity] ( #maturity )
40
40
* [ Contributions] ( #contributions )
@@ -201,6 +201,46 @@ with ClientSDK(
201
201
```
202
202
<!-- End Authentication [security] -->
203
203
204
+ <!-- Start Idempotency Key -->
205
+ ## Idempotency Key
206
+
207
+ This SDK supports the usage of Idempotency Keys. See our [ documentation] ( https://docs.mollie.com/reference/api-idempotency ) on how to use it.
208
+
209
+ ``` python
210
+ import os
211
+ from mollie import ClientSDK, Security
212
+
213
+ client = ClientSDK(
214
+ security = Security(
215
+ api_key = os.getenv(" CLIENT_API_KEY" , " test_..." ),
216
+ )
217
+ )
218
+
219
+ payload = {
220
+ " description" : " Description" ,
221
+ " amount" : {
222
+ " currency" : " EUR" ,
223
+ " value" : " 5.00" ,
224
+ },
225
+ " redirect_url" : " https://example.org/redirect" ,
226
+ }
227
+
228
+ idempotency_key = " <some-idempotency-key>"
229
+ payment1 = client.payments.create(
230
+ payment_request = payload,
231
+ idempotency_key = idempotency_key
232
+ )
233
+
234
+ payment2 = client.payments.create(
235
+ payment_request = payload,
236
+ idempotency_key = idempotency_key
237
+ )
238
+ print (f " Payment created with ID: { payment1.id} " )
239
+ print (f " Payment created with ID: { payment2.id} " )
240
+ print (" Payments are the same" if payment1.id == payment2.id else " Payments are different" )
241
+ ```
242
+ <!-- End Idempotency Key -->
243
+
204
244
<!-- Start Available Resources and Operations [operations] -->
205
245
## Available Resources and Operations
206
246
@@ -664,48 +704,6 @@ You can also enable a default debug logger by setting an environment variable `C
664
704
665
705
<!-- Placeholder for Future Speakeasy SDK Sections -->
666
706
667
- ## Idempotency Key
668
-
669
- You can setup an Idempotency Key.
670
-
671
- ```
672
- import os
673
- from mollie import ClientSDK, Security
674
-
675
- client = ClientSDK(
676
- security = Security(
677
- api_key = os.getenv("MOLLIE_API_KEY", "test_..."),
678
- )
679
- )
680
-
681
- payload = {
682
- "description": "Some Description",
683
- "amount": {
684
- "currency": "EUR",
685
- "value": "0.01",
686
- },
687
- "redirect_url": "https://example.org/redirect",
688
- }
689
-
690
- idempotency_key = "unique-idempotency-key-12345"
691
- payment1 = client.payments.create(
692
- request_body=payload,
693
- http_headers={
694
- "Idempotency-Key": idempotency_key
695
- }
696
- )
697
-
698
- payment2 = client.payments.create(
699
- request_body=payload,
700
- http_headers={
701
- "Idempotency-Key": idempotency_key
702
- }
703
- )
704
- print(f"Payment created with ID: {payment1.id}")
705
- print(f"Payment created with ID: {payment2.id}")
706
- print("Payments are the same" if payment1.id == payment2.id else "Payments are different")
707
- ```
708
-
709
707
# Development
710
708
711
709
## Maturity
0 commit comments