Skip to content

Commit ab879cf

Browse files
authored
PTHMINT-121: Add scoped credential docs and env vars (#60)
Update README with a new "Initialize with scoped credentials" section showing how to use ScopedCredentialResolver (making api_key optional) and providing a code example for per-scope API key resolution.
1 parent 745578b commit ab879cf

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
API_KEY=
2+
TERMINAL_GROUP_API_KEY_GROUP_DEFAULT=
3+
CLOUD_POS_TERMINAL_GROUP_ID=Default
4+
CLOUD_POS_TERMINAL_ID=
5+
CLOUD_POS_ORDER_ID=
6+
POS_ORDER_ID=
27
E2E_API_KEY=
38
E2E_BASE_URL=https://testapi.multisafepay.com/v1/
9+
E2E_TERMINAL_GROUP_API_KEY_GROUP_DEFAULT=
10+
E2E_CLOUD_POS_TERMINAL_ID=

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,29 @@ from multisafepay import Sdk
7575
multisafepay_sdk: Sdk = Sdk(api_key='<api_key>', is_production=True)
7676
```
7777

78+
### Initialize with scoped credentials
79+
80+
Use `ScopedCredentialResolver` when the API key must change per auth scope.
81+
When `credential_resolver` is provided, `api_key` becomes optional.
82+
83+
```python
84+
from multisafepay import Sdk
85+
from multisafepay.client import ScopedCredentialResolver
86+
87+
88+
credential_resolver = ScopedCredentialResolver(
89+
default_api_key="<default_api_key>",
90+
terminal_group_api_keys={
91+
"Default": "<terminal_group_api_key>",
92+
},
93+
)
94+
95+
sdk = Sdk(
96+
is_production=False,
97+
credential_resolver=credential_resolver,
98+
)
99+
```
100+
78101
### Development-only custom base URL override
79102

80103
By default, the SDK only targets:

0 commit comments

Comments
 (0)