Skip to content

Commit 5b4625b

Browse files
Merge pull request #3 from BrantaOps/readme
Add parent platform to readme
2 parents 6d6b5d2 + f961de9 commit 5b4625b

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,57 @@ is_valid = await service.is_api_key_valid(BrantaClientOptions(
9696
))
9797
```
9898

99+
### For parent platforms
100+
101+
Choose a variant based on how API keys are structured. Shared key needs only an API key; per-client keys also require HMAC.
102+
103+
**Shared key — one API key covers all children (Recommended)**
104+
105+
Construct with a single API key; identify the child platform per-payment. Do not include `hmac_secret`.
106+
107+
```python
108+
options = BrantaClientOptions(
109+
base_url=BrantaServerBaseUrl.Production,
110+
default_api_key="<shared-api-key>",
111+
privacy=PrivacyMode.Strict,
112+
)
113+
service = BrantaService(options)
114+
115+
payment = (
116+
service.create_payment_builder()
117+
.add_destination("bc1q...", DestinationType.BitcoinAddress).set_zk()
118+
.set_description("Order #1234")
119+
.set_child_platform("ChildBrand", logo_url="https://example.com/logo.png")
120+
.build()
121+
)
122+
123+
result = await service.add_payment(payment)
124+
```
125+
126+
**Per-client keys — each child has its own API key**
127+
128+
Construct the service with the parent HMAC secret only; pass each child's API key per-call.
129+
130+
```python
131+
options = BrantaClientOptions(
132+
base_url=BrantaServerBaseUrl.Production,
133+
hmac_secret="<hmac-secret>",
134+
privacy=PrivacyMode.Strict,
135+
)
136+
service = BrantaService(options)
137+
138+
payment = (
139+
service.create_payment_builder()
140+
.add_destination("bc1q...", DestinationType.BitcoinAddress).set_zk()
141+
.build()
142+
)
143+
144+
result = await service.add_payment(
145+
payment,
146+
BrantaClientOptions(default_api_key="<child-api-key>"),
147+
)
148+
```
149+
99150
### Per-call option overrides
100151

101152
Every public method accepts an optional `BrantaClientOptions` parameter that overrides the service's default options for that call only:

0 commit comments

Comments
 (0)