WalletD developers
Catalog

Set a cashback or loyalty rule for this merchant, common or per-product

Sets one of the merchant's own reward rules, either common to the whole shop or bound to one offering by offering_id; a per-product rule overrides the common one for that product.

POST/v1/clients/{clientId}/reward_rules

Sets one of the merchant's own reward rules, either common to the whole shop or bound to one offering by offering_id; a per-product rule overrides the common one for that product. kind: cashback pays from the merchant's own marketing pot; kind: accrual issues tenant loyalty points, so it carries no funding merchant even though the merchant configured it. Needs authority over the client — membership of its organization, an API key bound to this client, or tenant staff holding clients:manage; anything else is refused not_client_member or insufficient_scope (403), and an unknown client client_not_found (404). Refuses invalid_request (400) for any other kind or parameters the rule engine rejects, and rule_exists (409) when the merchant already has a rule in that slot.

Authorization

bearerAuth
AuthorizationBearer <token>

A tenant API key (sk_{env}_{id}_{secret}), a wallet user token, or an IdP access token. Which principal the credential resolves to decides the scopes it carries; see the authentication guide.

In: header

Path Parameters

clientId*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Scope and funding are pinned to the calling merchant; the rule is either common (all products) or per-product, and either cashback or loyalty.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://example.com/v1/clients/497f6eca-6276-4993-bfeb-53cbbbba6f08/reward_rules" \  -H "Content-Type: application/json" \  -d '{}'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "kind": "string",  "params": {},  "scope": {},  "caps": {},  "starts_at": "2019-08-24T14:15:22Z",  "ends_at": "2019-08-24T14:15:22Z",  "version": 0,  "status": "string",  "created_at": "2019-08-24T14:15:22Z",  "disabled_at": "2019-08-24T14:15:22Z"}