@spree/docs 0.1.0

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.
Files changed (183) hide show
  1. package/README.md +54 -0
  2. package/dist/api-reference/platform/authentication.md +38 -0
  3. package/dist/api-reference/store-api/authentication.md +188 -0
  4. package/dist/api-reference/store-api/errors.md +277 -0
  5. package/dist/api-reference/store-api/idempotency.md +129 -0
  6. package/dist/api-reference/store-api/introduction.md +34 -0
  7. package/dist/api-reference/store-api/localization.md +279 -0
  8. package/dist/api-reference/store-api/metadata.md +160 -0
  9. package/dist/api-reference/store-api/monetary-amounts.md +65 -0
  10. package/dist/api-reference/store-api/querying.md +399 -0
  11. package/dist/api-reference/store-api/rate-limitting.md +103 -0
  12. package/dist/api-reference/store-api/relations.md +185 -0
  13. package/dist/api-reference/storefront/authentication.md +88 -0
  14. package/dist/api-reference/tutorials/adyen-integration-guide-for-android.md +165 -0
  15. package/dist/api-reference/tutorials/adyen-integration-guide-for-ios.md +194 -0
  16. package/dist/api-reference/tutorials/quick-checkout-with-stripe.md +248 -0
  17. package/dist/api-reference/v2/fetching-multiple-resources.md +26 -0
  18. package/dist/api-reference/v2/filtering-and-sorting.md +53 -0
  19. package/dist/api-reference/v2/introduction.md +22 -0
  20. package/dist/api-reference/v2/pagination.md +37 -0
  21. package/dist/api-reference/webhooks-events.md +883 -0
  22. package/dist/developer/admin/admin.md +205 -0
  23. package/dist/developer/admin/authentication.md +59 -0
  24. package/dist/developer/admin/components.md +711 -0
  25. package/dist/developer/admin/custom-css.md +243 -0
  26. package/dist/developer/admin/custom-javascript.md +116 -0
  27. package/dist/developer/admin/extending-ui.md +1964 -0
  28. package/dist/developer/admin/form-builder.md +444 -0
  29. package/dist/developer/admin/helper-methods.md +531 -0
  30. package/dist/developer/admin/navigation.md +805 -0
  31. package/dist/developer/admin/tables.md +491 -0
  32. package/dist/developer/advanced/adding_spree_to_rails_app.md +106 -0
  33. package/dist/developer/cli/quickstart.md +137 -0
  34. package/dist/developer/contributing/creating-an-extension.md +258 -0
  35. package/dist/developer/contributing/developing-spree.md +339 -0
  36. package/dist/developer/contributing/quickstart.md +32 -0
  37. package/dist/developer/contributing/updating-extensions.md +67 -0
  38. package/dist/developer/core-concepts/addresses.md +265 -0
  39. package/dist/developer/core-concepts/adjustments.md +107 -0
  40. package/dist/developer/core-concepts/architecture.md +177 -0
  41. package/dist/developer/core-concepts/calculators.md +323 -0
  42. package/dist/developer/core-concepts/customers.md +230 -0
  43. package/dist/developer/core-concepts/events.md +624 -0
  44. package/dist/developer/core-concepts/imports-exports.md +698 -0
  45. package/dist/developer/core-concepts/inventory.md +191 -0
  46. package/dist/developer/core-concepts/markets.md +250 -0
  47. package/dist/developer/core-concepts/media.md +167 -0
  48. package/dist/developer/core-concepts/metafields.md +187 -0
  49. package/dist/developer/core-concepts/orders.md +328 -0
  50. package/dist/developer/core-concepts/payments.md +710 -0
  51. package/dist/developer/core-concepts/pricing.md +163 -0
  52. package/dist/developer/core-concepts/products.md +360 -0
  53. package/dist/developer/core-concepts/promotions.md +322 -0
  54. package/dist/developer/core-concepts/reports.md +206 -0
  55. package/dist/developer/core-concepts/search-filtering.md +237 -0
  56. package/dist/developer/core-concepts/shipments.md +212 -0
  57. package/dist/developer/core-concepts/slugs.md +111 -0
  58. package/dist/developer/core-concepts/staff-roles.md +123 -0
  59. package/dist/developer/core-concepts/store-credits-gift-cards.md +317 -0
  60. package/dist/developer/core-concepts/stores.md +117 -0
  61. package/dist/developer/core-concepts/taxes.md +135 -0
  62. package/dist/developer/core-concepts/translations.md +120 -0
  63. package/dist/developer/core-concepts/users.md +299 -0
  64. package/dist/developer/core-concepts/webhooks.md +378 -0
  65. package/dist/developer/create-spree-app/quickstart.md +158 -0
  66. package/dist/developer/customization/api.md +93 -0
  67. package/dist/developer/customization/authentication.md +88 -0
  68. package/dist/developer/customization/checkout.md +204 -0
  69. package/dist/developer/customization/configuration.md +55 -0
  70. package/dist/developer/customization/decorators.md +523 -0
  71. package/dist/developer/customization/dependencies.md +232 -0
  72. package/dist/developer/customization/emails.md +21 -0
  73. package/dist/developer/customization/extensions.md +92 -0
  74. package/dist/developer/customization/metadata.md +236 -0
  75. package/dist/developer/customization/model-preferences.md +130 -0
  76. package/dist/developer/customization/permissions.md +265 -0
  77. package/dist/developer/customization/quickstart.md +229 -0
  78. package/dist/developer/customization/routes.md +24 -0
  79. package/dist/developer/customization/v4/admin-panel.md +78 -0
  80. package/dist/developer/customization/v4/authentication.md +210 -0
  81. package/dist/developer/customization/v4/checkout.md +212 -0
  82. package/dist/developer/customization/v4/deface.md +251 -0
  83. package/dist/developer/customization/v4/images.md +86 -0
  84. package/dist/developer/customization/v4/storefront.md +450 -0
  85. package/dist/developer/deployment/assets.md +87 -0
  86. package/dist/developer/deployment/aws.md +335 -0
  87. package/dist/developer/deployment/caching.md +27 -0
  88. package/dist/developer/deployment/cdn.md +39 -0
  89. package/dist/developer/deployment/database.md +155 -0
  90. package/dist/developer/deployment/docker.md +128 -0
  91. package/dist/developer/deployment/emails.md +77 -0
  92. package/dist/developer/deployment/environment_variables.md +111 -0
  93. package/dist/developer/deployment/heroku.md +51 -0
  94. package/dist/developer/deployment/render.md +95 -0
  95. package/dist/developer/getting-started/quickstart.md +82 -0
  96. package/dist/developer/how-to/custom-payment-method.md +374 -0
  97. package/dist/developer/how-to/custom-promotion.md +373 -0
  98. package/dist/developer/how-to/custom-report.md +387 -0
  99. package/dist/developer/how-to/custom-search-provider.md +230 -0
  100. package/dist/developer/multi-store/quickstart.md +71 -0
  101. package/dist/developer/multi-store/setup.md +38 -0
  102. package/dist/developer/multi-tenant/configuration.md +41 -0
  103. package/dist/developer/multi-tenant/core-concepts.md +75 -0
  104. package/dist/developer/multi-tenant/installation.md +96 -0
  105. package/dist/developer/multi-tenant/quickstart.md +20 -0
  106. package/dist/developer/multi-vendor/installation.md +45 -0
  107. package/dist/developer/multi-vendor/quickstart.md +17 -0
  108. package/dist/developer/sdk/admin/quickstart.md +22 -0
  109. package/dist/developer/sdk/authentication.md +89 -0
  110. package/dist/developer/sdk/configuration.md +225 -0
  111. package/dist/developer/sdk/quickstart.md +82 -0
  112. package/dist/developer/sdk/store/account.md +67 -0
  113. package/dist/developer/sdk/store/cart-checkout.md +140 -0
  114. package/dist/developer/sdk/store/markets.md +151 -0
  115. package/dist/developer/sdk/store/payments.md +96 -0
  116. package/dist/developer/sdk/store/products.md +149 -0
  117. package/dist/developer/sdk/store/wishlists.md +52 -0
  118. package/dist/developer/security/pci_compliance.md +15 -0
  119. package/dist/developer/security/security_policy.md +68 -0
  120. package/dist/developer/storefront/blocks.md +285 -0
  121. package/dist/developer/storefront/custom-css.md +260 -0
  122. package/dist/developer/storefront/custom-javascript.md +166 -0
  123. package/dist/developer/storefront/helper-methods.md +1288 -0
  124. package/dist/developer/storefront/links.md +298 -0
  125. package/dist/developer/storefront/nextjs/architecture.md +150 -0
  126. package/dist/developer/storefront/nextjs/customization.md +141 -0
  127. package/dist/developer/storefront/nextjs/deployment.md +180 -0
  128. package/dist/developer/storefront/nextjs/quickstart.md +92 -0
  129. package/dist/developer/storefront/nextjs/spree-next-package.md +314 -0
  130. package/dist/developer/storefront/pages.md +163 -0
  131. package/dist/developer/storefront/sections.md +569 -0
  132. package/dist/developer/storefront/storefront.md +56 -0
  133. package/dist/developer/storefront/themes.md +161 -0
  134. package/dist/developer/tutorial/admin.md +134 -0
  135. package/dist/developer/tutorial/extending-models.md +380 -0
  136. package/dist/developer/tutorial/file-uploads.md +121 -0
  137. package/dist/developer/tutorial/introduction.md +33 -0
  138. package/dist/developer/tutorial/model.md +41 -0
  139. package/dist/developer/tutorial/page-builder.md +487 -0
  140. package/dist/developer/tutorial/rich-text.md +73 -0
  141. package/dist/developer/tutorial/seo.md +332 -0
  142. package/dist/developer/tutorial/storefront.md +352 -0
  143. package/dist/developer/tutorial/testing.md +558 -0
  144. package/dist/developer/upgrades/2.0-to-2.1.md +46 -0
  145. package/dist/developer/upgrades/2.1-to-2.2.md +59 -0
  146. package/dist/developer/upgrades/2.2-to-2.3.md +44 -0
  147. package/dist/developer/upgrades/2.3-to-2.4.md +42 -0
  148. package/dist/developer/upgrades/3.0-to-3.1.md +47 -0
  149. package/dist/developer/upgrades/3.1-to-3.2.md +34 -0
  150. package/dist/developer/upgrades/3.2-to-3.3.md +70 -0
  151. package/dist/developer/upgrades/3.3-to-3.4.md +36 -0
  152. package/dist/developer/upgrades/3.4-to-3.5.md +44 -0
  153. package/dist/developer/upgrades/3.5-to-3.6.md +40 -0
  154. package/dist/developer/upgrades/3.6-to-3.7.md +62 -0
  155. package/dist/developer/upgrades/3.7-to-4.0.md +152 -0
  156. package/dist/developer/upgrades/4.0-to-4.1.md +92 -0
  157. package/dist/developer/upgrades/4.1-to-4.2.md +109 -0
  158. package/dist/developer/upgrades/4.10-to-5.0.md +129 -0
  159. package/dist/developer/upgrades/4.2-to-4.3.md +100 -0
  160. package/dist/developer/upgrades/4.3-to-4.4.md +125 -0
  161. package/dist/developer/upgrades/4.4-to-4.5.md +94 -0
  162. package/dist/developer/upgrades/4.5-to-4.6.md +119 -0
  163. package/dist/developer/upgrades/4.6-to-4.7.md +39 -0
  164. package/dist/developer/upgrades/4.8-to-4.9.md +24 -0
  165. package/dist/developer/upgrades/4.9-to-4.10.md +24 -0
  166. package/dist/developer/upgrades/4.x-to-4.8.md +52 -0
  167. package/dist/developer/upgrades/5.0-to-5.1.md +28 -0
  168. package/dist/developer/upgrades/5.1-to-5.2.md +127 -0
  169. package/dist/developer/upgrades/5.2-to-5.3.md +338 -0
  170. package/dist/developer/upgrades/5.3-to-5.4.md +248 -0
  171. package/dist/developer/upgrades/quickstart.md +36 -0
  172. package/dist/integrations/analytics/google-analytics.md +64 -0
  173. package/dist/integrations/analytics/google-tag-manager.md +78 -0
  174. package/dist/integrations/integrations.md +39 -0
  175. package/dist/integrations/marketing/klaviyo.md +99 -0
  176. package/dist/integrations/payments/adyen.md +90 -0
  177. package/dist/integrations/payments/paypal.md +41 -0
  178. package/dist/integrations/payments/razorpay.md +45 -0
  179. package/dist/integrations/payments/stripe.md +109 -0
  180. package/dist/integrations/search/meilisearch.md +236 -0
  181. package/dist/integrations/sso-mfa-social-login/admin-dashboard.md +57 -0
  182. package/dist/integrations/sso-mfa-social-login/storefront.md +56 -0
  183. package/package.json +27 -0
@@ -0,0 +1,317 @@
1
+ ---
2
+ title: Store Credits & Gift Cards
3
+ description: Stored value mechanisms for refunds, loyalty rewards, and gifting
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ Spree provides two stored value mechanisms that customers can use at checkout:
9
+
10
+ - **Store Credits** - Value assigned directly to a customer's account by admins (refunds, loyalty rewards, compensation)
11
+ - **Gift Cards** - Value with a redeemable code that can be shared and redeemed by anyone
12
+
13
+ | Feature | Store Credit | Gift Card |
14
+ |---------|--------------|-----------|
15
+ | Purpose | Refunds, loyalty rewards, compensation | Gifting, promotions, marketing |
16
+ | Requires account | Yes (tied to customer account) | No (guests can use at checkout) |
17
+ | Transferable | No | Yes (code can be shared) |
18
+ | Has code | No | Yes |
19
+ | Created by | Admin | Admin |
20
+ | Assignment | Directly to customer | Applied to order via code |
21
+ | Expiration | Configurable by type | Configurable per card |
22
+
23
+ ## Store Credits
24
+
25
+ Store Credits are monetary values assigned directly to a customer's account. They are commonly used for:
26
+
27
+ - Refunds (instead of returning money to original payment method)
28
+ - Loyalty rewards
29
+ - Customer compensation
30
+ - Promotional credits
31
+
32
+ ### Store Credit Model
33
+
34
+ ```mermaid
35
+ erDiagram
36
+ StoreCredit ||--o{ StoreCreditEvent : "has many"
37
+ StoreCredit ||--o{ Payment : "source for"
38
+ StoreCredit }o--|| User : "belongs to"
39
+ StoreCredit }o--|| Store : "belongs to"
40
+ StoreCredit }o--o| StoreCreditCategory : "belongs to"
41
+ StoreCredit }o--o| StoreCreditType : "belongs to"
42
+
43
+ StoreCredit {
44
+ decimal amount
45
+ decimal amount_used
46
+ decimal amount_authorized
47
+ string currency
48
+ string memo
49
+ }
50
+
51
+ StoreCreditCategory {
52
+ string name
53
+ }
54
+
55
+ StoreCreditType {
56
+ string name
57
+ integer priority
58
+ }
59
+
60
+ StoreCreditEvent {
61
+ string action
62
+ decimal amount
63
+ string authorization_code
64
+ }
65
+ ```
66
+
67
+ ### Store Credit Attributes
68
+
69
+ | Attribute | Description | Example |
70
+ |-----------|-------------|---------|
71
+ | `amount` | Total credit amount | `100.00` |
72
+ | `amount_used` | Amount already spent | `25.00` |
73
+ | `amount_authorized` | Amount currently authorized for pending orders | `0.00` |
74
+ | `currency` | Currency code | `USD` |
75
+ | `memo` | Optional note about the credit | `Refund for order #R123` |
76
+
77
+ ### Store Credit Categories
78
+
79
+ Categories help organize store credits by their purpose:
80
+
81
+ | Category | Description |
82
+ |----------|-------------|
83
+ | Default | General purpose store credit |
84
+ | Gift Card | Store credit created from gift card redemption |
85
+
86
+ > **INFO:** Categories can be configured as non-expiring. By default, the "Gift Card" category is non-expiring.
87
+
88
+ ### Store Credit Types
89
+
90
+ Types define the priority in which store credits are applied at checkout:
91
+
92
+ | Type | Description |
93
+ |------|-------------|
94
+ | Expiring | Credits that may expire (applied first) |
95
+ | Non-expiring | Credits that don't expire (applied last) |
96
+
97
+ ### Store Credit Events
98
+
99
+ Every action on a store credit is recorded as an event for audit purposes:
100
+
101
+ | Action | Description |
102
+ |--------|-------------|
103
+ | `allocation` | Initial credit was assigned |
104
+ | `authorize` | Credit was authorized for an order |
105
+ | `capture` | Authorized credit was captured |
106
+ | `void` | Authorization was voided |
107
+ | `credit` | Credit was returned (e.g., order canceled) |
108
+
109
+ ### Assigning Store Credits
110
+
111
+ Store credits are managed in the Admin Panel:
112
+
113
+ 1. Navigate to **Customers** in the Admin Panel
114
+ 2. Select a customer
115
+ 3. Go to the **Store Credits** tab
116
+ 4. Click **Add Store Credit**
117
+ 5. Enter the amount, category, and optional memo
118
+ 6. Click **Create**
119
+
120
+ Store credits can also be created via the Admin API.
121
+
122
+ ### Store Credit Events
123
+
124
+ The store credit system publishes lifecycle events:
125
+
126
+ | Event | Description |
127
+ |-------|-------------|
128
+ | `store_credit.created` | Store credit was created |
129
+ | `store_credit.updated` | Store credit was updated |
130
+
131
+ ## Gift Cards
132
+
133
+ Gift Cards are stored value codes created by admins that can be shared and redeemed by customers. When redeemed, they create a Store Credit on the customer's account.
134
+
135
+ ### Gift Card Model
136
+
137
+ ```mermaid
138
+ erDiagram
139
+ GiftCard }o--|| Store : "belongs to"
140
+ GiftCard }o--o| User : "belongs to"
141
+ GiftCard }o--o| GiftCardBatch : "belongs to"
142
+ GiftCard ||--o{ StoreCredit : "originator for"
143
+
144
+ GiftCard {
145
+ string code
146
+ string state
147
+ decimal amount
148
+ decimal amount_used
149
+ decimal amount_authorized
150
+ string currency
151
+ datetime expires_at
152
+ datetime redeemed_at
153
+ }
154
+
155
+ GiftCardBatch {
156
+ string prefix
157
+ integer codes_count
158
+ decimal amount
159
+ string currency
160
+ datetime expires_at
161
+ }
162
+ ```
163
+
164
+ ### Gift Card Attributes
165
+
166
+ | Attribute | Description | Example |
167
+ |-----------|-------------|---------|
168
+ | `code` | Unique redemption code | `abc1234def` |
169
+ | `amount` | Total gift card value | `50.00` |
170
+ | `amount_used` | Amount already redeemed | `0.00` |
171
+ | `state` | Current state | `active` |
172
+ | `currency` | Currency code | `USD` |
173
+ | `expires_at` | Optional expiration date | `2025-12-31` |
174
+
175
+ ### Gift Card States
176
+
177
+ ```mermaid
178
+ stateDiagram-v2
179
+ [*] --> active: Created
180
+ active --> partially_redeemed: Partial redemption
181
+ active --> redeemed: Full redemption
182
+ active --> canceled: Admin cancels
183
+ partially_redeemed --> redeemed: Remaining redeemed
184
+ partially_redeemed --> partially_redeemed: Another partial redemption
185
+ ```
186
+
187
+ | State | Description |
188
+ |-------|-------------|
189
+ | `active` | Available for redemption |
190
+ | `partially_redeemed` | Some value has been redeemed |
191
+ | `redeemed` | Fully redeemed |
192
+ | `canceled` | Canceled by admin |
193
+
194
+ > **NOTE:** Gift cards can also be `expired` if `expires_at` date has passed and the card hasn't been fully redeemed.
195
+
196
+ ### Gift Card Lifecycle
197
+
198
+ ```mermaid
199
+ flowchart TB
200
+ A[Admin creates Gift Card] --> B[Code generated]
201
+ B --> C[Admin shares code with recipient]
202
+ C --> D[Recipient enters code at checkout]
203
+ D --> E[Store Credit created for customer]
204
+ E --> F[Gift Card marked as redeemed]
205
+ F --> G[Customer uses Store Credit]
206
+ ```
207
+
208
+ ### Creating Gift Cards
209
+
210
+ #### Single Gift Card
211
+
212
+ 1. Navigate to **Gift Cards** in the Admin Panel
213
+ 2. Click **Create Gift Card**
214
+ 3. Enter the amount and optional expiration date
215
+ 4. Click **Create**
216
+ 5. Share the generated code with the recipient
217
+
218
+ Gift cards can also be created via the Admin API.
219
+
220
+ #### Batch Gift Card Generation
221
+
222
+ For promotions or bulk distribution, you can create multiple gift cards at once using Gift Card Batches:
223
+
224
+ 1. Navigate to **Gift Cards** in the Admin Panel
225
+ 2. Click **Create Batch**
226
+ 3. Enter:
227
+ - **Prefix** - Code prefix for easy identification (e.g., `HOLIDAY`)
228
+ - **Count** - Number of cards to generate
229
+ - **Amount** - Value per card
230
+ - **Expiration** - Optional expiration date
231
+ 4. Click **Create**
232
+
233
+ > **INFO:** Large batches are processed in the background to avoid timeout issues.
234
+
235
+ ### Redeeming Gift Cards
236
+
237
+ Gift cards can be redeemed by both **registered customers** and **guest visitors** at checkout. This is a key difference from Store Credits, which require a customer account.
238
+
239
+ > **INFO:** Unlike Store Credits which are tied to a customer account, Gift Cards can be applied directly to an order during checkout - no account required. This makes them ideal for gifting to anyone.
240
+
241
+ When a gift card is applied to an order:
242
+ - The gift card value is used to pay for the order
243
+ - The gift card is marked as redeemed (or partially redeemed)
244
+ - No Store Credit is created for guest checkouts
245
+
246
+ Gift cards are applied using the same coupon codes endpoint as promotion codes. The endpoint automatically detects whether the code is a promotion coupon or a gift card.
247
+
248
+
249
+ ```typescript SDK
250
+ // Apply gift card code to cart (works for guests and registered customers)
251
+ const cart = await client.carts.couponCodes.apply('cart_abc123', 'abc1234def', {
252
+ spreeToken: '<token>',
253
+ })
254
+ ```
255
+
256
+ ```bash cURL
257
+ # Apply gift card to cart (works for guests and registered customers)
258
+ curl -X POST 'https://api.mystore.com/api/v3/store/carts/cart_abc123/coupon_codes' \
259
+ -H 'Authorization: Bearer spree_pk_xxx' \
260
+ -H 'X-Spree-Token: <token>' \
261
+ -H 'Content-Type: application/json' \
262
+ -d '{ "code": "abc1234def" }'
263
+ ```
264
+
265
+
266
+ ### Gift Card Events
267
+
268
+ The gift card system publishes lifecycle events:
269
+
270
+ | Event | Description |
271
+ |-------|-------------|
272
+ | `gift_card.created` | Gift card was created |
273
+ | `gift_card.redeemed` | Gift card was fully redeemed |
274
+ | `gift_card.partially_redeemed` | Gift card was partially redeemed |
275
+
276
+ ## Using at Checkout
277
+
278
+ Store Credits and Gift Cards work differently at checkout:
279
+
280
+ - **Store Credits** - Require a customer account; applied from the customer's balance
281
+ - **Gift Cards** - Can be used by anyone (guests included); applied directly to the order via code
282
+
283
+ ### Checkout Flow
284
+
285
+ ```mermaid
286
+ flowchart TB
287
+ A[Customer proceeds to payment] --> B{Guest or Registered?}
288
+ B -->|Registered| C{Has Store Credit?}
289
+ B -->|Guest| D{Has Gift Card code?}
290
+ C -->|Yes| E[Display available balance]
291
+ C -->|No| D
292
+ D -->|Yes| F[Apply Gift Card to order]
293
+ D -->|No| G[Show payment methods]
294
+ E --> H{Apply Store Credit?}
295
+ H -->|Yes| I[Authorize store credit]
296
+ H -->|No| D
297
+ F --> J{Covers order total?}
298
+ I --> J
299
+ J -->|Yes| K[Complete order]
300
+ J -->|No| G
301
+ G --> L[Customer pays remaining balance]
302
+ L --> K
303
+ ```
304
+
305
+ ### Store Credit Priority
306
+
307
+ When a registered customer has multiple store credits, they are applied in order of priority:
308
+
309
+ 1. **Expiring credits** - Applied first to ensure they're used before expiration
310
+ 2. **Non-expiring credits** - Applied after expiring credits
311
+
312
+ ## Related Documentation
313
+
314
+ - [Payments](/developer/core-concepts/payments) — Payment processing and methods
315
+ - [Orders](/developer/core-concepts/orders) — Order management
316
+ - [Customers](/developer/core-concepts/customers) — Customer management
317
+ - [Events](/developer/core-concepts/events) — Event system and subscribers
@@ -0,0 +1,117 @@
1
+ ---
2
+ title: Stores
3
+ description: The central model in Spree — every resource is scoped to a store
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ The Store is the central model in Spree. Every resource — products, orders, markets, payment methods, taxonomies — is scoped to a store. Most setups use a single store, but Spree supports [multi-store](/developer/multi-store/quickstart) configurations where each store operates independently with its own catalog, branding, and checkout.
9
+
10
+ ```mermaid
11
+ erDiagram
12
+ Store ||--o{ Market : "has many"
13
+ Store ||--o{ Order : "has many"
14
+ Store }o--o{ Product : "has many"
15
+ Store }o--o{ PaymentMethod : "has many"
16
+ Store }o--o{ ShippingMethod : "has many"
17
+ Store ||--o{ Taxonomy : "has many"
18
+ Store ||--o{ StockLocation : "has many"
19
+
20
+ Store {
21
+ string name
22
+ string code
23
+ string url
24
+ boolean default
25
+ string customer_support_email
26
+ }
27
+
28
+ Market {
29
+ string name
30
+ string currency
31
+ string default_locale
32
+ }
33
+
34
+ Product {
35
+ string name
36
+ string status
37
+ }
38
+
39
+ Order {
40
+ string number
41
+ string state
42
+ }
43
+ ```
44
+
45
+ ## Store Attributes
46
+
47
+ | Attribute | Description |
48
+ |-----------|-------------|
49
+ | `name` | Store name, displayed in the browser title and throughout the site |
50
+ | `code` | Unique identifier for the store |
51
+ | `url` | Primary URL of the store |
52
+ | `meta_description` | SEO description |
53
+ | `meta_keywords` | SEO keywords |
54
+ | `seo_title` | Custom SEO title |
55
+ | `customer_support_email` | Email for customer support inquiries |
56
+ | `mail_from_address` | Sender address for transactional emails |
57
+ | `logo_image_url` | URL to the store's logo |
58
+ | `facebook`, `twitter`, `instagram` | Social media links |
59
+ | `payment_methods` | Payment methods available in this store |
60
+
61
+ ## Fetching Store Information
62
+
63
+ Use the store endpoint to get the current store's configuration — useful for rendering logos, SEO metadata, and footer content:
64
+
65
+
66
+ ```typescript SDK
67
+ const store = await client.store.get()
68
+ // {
69
+ // name: "My Store",
70
+ // url: "https://mystore.com",
71
+ // logo_image_url: "https://cdn.mystore.com/logo.png",
72
+ // customer_support_email: "support@mystore.com",
73
+ // payment_methods: [{ id: "pm_xxx", name: "Stripe", kind: "card" }],
74
+ // ...
75
+ // }
76
+ ```
77
+
78
+ ```bash cURL
79
+ curl 'https://api.mystore.com/api/v3/store/store' \
80
+ -H 'Authorization: Bearer spree_pk_xxx'
81
+ ```
82
+
83
+
84
+ ## Markets
85
+
86
+ [Markets](/developer/core-concepts/markets) let you segment your store into geographic regions, each with its own currency, locale, and set of countries. For example, a single store can have:
87
+
88
+ - **North America** — USD, English, ships to US and Canada
89
+ - **Europe** — EUR, German, ships to DE, FR, AT, NL
90
+ - **United Kingdom** — GBP, English, ships to GB
91
+
92
+ See the [Markets](/developer/core-concepts/markets) guide for details.
93
+
94
+ ## Store Resources
95
+
96
+ Each store has its own set of resources. This means products, orders, and promotions in one store are completely separate from another.
97
+
98
+ | Resource | Relationship |
99
+ |----------|-------------|
100
+ | [**Markets**](/developer/core-concepts/markets) | A store has many markets, each defining a geographic region with its own currency and locale |
101
+ | [**Orders**](/developer/core-concepts/orders) | An order belongs to one store |
102
+ | [**Products**](/developer/core-concepts/products) | A product can be available in multiple stores |
103
+ | [**Payment Methods**](/developer/core-concepts/payments) | A payment method can be available in multiple stores |
104
+ | [**Shipping Methods**](/developer/core-concepts/shipments) | A shipping method can be available in multiple stores |
105
+ | [**Taxonomies**](/developer/core-concepts/products#taxons-and-taxonomies) | A taxonomy belongs to one store |
106
+ | [**Promotions**](/developer/core-concepts/promotions) | A promotion can apply to multiple stores |
107
+
108
+ ## Multi-Store Setup
109
+
110
+ To run multiple stores from a single Spree installation, see the [Multi-Store guide](/developer/multi-store/quickstart). Each store gets its own domain, branding, catalog, and checkout — while sharing the same admin dashboard and infrastructure.
111
+
112
+ ## Related Documentation
113
+
114
+ - [Markets](/developer/core-concepts/markets) — Multi-region commerce within a store
115
+ - [Products](/developer/core-concepts/products) — Product catalog
116
+ - [Orders](/developer/core-concepts/orders) — Order management and checkout
117
+ - [Multi-Store](/developer/multi-store/quickstart) — Running multiple stores
@@ -0,0 +1,135 @@
1
+ ---
2
+ title: Taxes
3
+ description: Tax categories, tax rates, zones, and how Spree calculates taxes at checkout
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ Spree uses Tax Categories and Tax Rates to calculate taxes for orders. Products are assigned to tax categories, and tax rates define the percentage charged within specific geographic [Zones](/developer/core-concepts/addresses#zones).
9
+
10
+ ```mermaid
11
+ erDiagram
12
+ TaxCategory ||--o{ TaxRate : "has many"
13
+ TaxCategory ||--o{ Product : "has many"
14
+ TaxRate }o--|| Zone : "applies in"
15
+ TaxRate ||--o{ Adjustment : "creates"
16
+ Zone ||--o{ ZoneMember : "has many"
17
+
18
+ TaxCategory {
19
+ string name
20
+ boolean is_default
21
+ string tax_code
22
+ }
23
+
24
+ TaxRate {
25
+ string name
26
+ decimal amount
27
+ boolean included_in_price
28
+ }
29
+
30
+ Zone {
31
+ string name
32
+ string kind
33
+ }
34
+ ```
35
+
36
+ **Key relationships:**
37
+ - **Tax Category** groups products for tax purposes (e.g., "Clothing", "Food", "Digital")
38
+ - **Tax Rate** defines the percentage and rules for a Tax Category within a [Zone](/developer/core-concepts/addresses#zones)
39
+ - **Zone** defines geographic regions (countries or states) where taxes apply
40
+ - **[Adjustments](/developer/core-concepts/adjustments)** are created on orders/line items to apply taxes
41
+
42
+ ## Tax Categories
43
+
44
+ Tax categories group products by how they're taxed. Common examples:
45
+
46
+ - **Clothing** — standard tax rate
47
+ - **Food** — reduced or exempt rate
48
+ - **Digital** — different rules per jurisdiction
49
+
50
+ Each product is assigned a tax category. One category can be set as the default for products that don't have an explicit assignment.
51
+
52
+ | Attribute | Description | Example |
53
+ |-----------|-------------|---------|
54
+ | `name` | Category name | `Clothing` |
55
+ | `is_default` | Whether this is the default category | `true` |
56
+ | `tax_code` | Code from your tax provider (e.g., Stripe, Avalara) | `1257L` |
57
+
58
+ ## Tax Rates
59
+
60
+ Tax rates define the percentage charged for a specific tax category within a geographic zone.
61
+
62
+ | Attribute | Description | Example |
63
+ |-----------|-------------|---------|
64
+ | `name` | Rate name | `California Sales Tax` |
65
+ | `amount` | Tax percentage as a decimal | `0.08` (8%) |
66
+ | `included_in_price` | Whether tax is included in the displayed price | `false` |
67
+ | `zone` | Geographic region where this rate applies | `US` |
68
+ | `tax_category` | Products this rate applies to | `Clothing` |
69
+
70
+ ## Tax Types
71
+
72
+ ### Sales Tax (tax-exclusive)
73
+
74
+ Common in the United States. The displayed price does **not** include tax — tax is added at checkout based on the shipping address.
75
+
76
+ **Example:** A $17.99 item with 5% sales tax:
77
+ - Displayed price: **$17.99**
78
+ - Tax at checkout: **$0.90**
79
+ - Order total: **$18.89**
80
+
81
+ ### Value Added Tax / VAT (tax-inclusive)
82
+
83
+ Common in Europe and many other countries. The displayed price **already includes** tax. When shipping outside the tax zone, the tax is removed from the price.
84
+
85
+ **Example:** A £17.99 item with 5% VAT included:
86
+ - Displayed price: **£17.99** (includes £0.86 VAT)
87
+ - If shipped outside VAT zone: price reduces to **£17.13**
88
+
89
+ > **INFO:** The `tax_inclusive` setting on [Markets](/developer/core-concepts/markets) controls whether prices are displayed with or without tax for each geographic region.
90
+
91
+ ## Default Tax Zone
92
+
93
+ Spree uses a default tax zone to estimate taxes before the customer enters a shipping address. This is important for stores with tax-inclusive pricing (VAT) — it determines which tax rate is assumed in the displayed price.
94
+
95
+ If the customer's shipping address is outside the default tax zone, the assumed tax is removed and the correct rate for their zone is applied.
96
+
97
+ ## Tax Calculation at Checkout
98
+
99
+ During checkout, taxes are calculated based on the shipping address:
100
+
101
+ 1. The customer's shipping address determines their [Zone](/developer/core-concepts/addresses#zones)
102
+ 2. Spree finds matching tax rates for that zone and the product's tax category
103
+ 3. Tax [Adjustments](/developer/core-concepts/adjustments) are created on line items
104
+ 4. The order total is updated
105
+
106
+ > **NOTE:** For complex tax requirements (interstate US sales, international VAT), consider using automated tax calculation. The [Stripe Tax integration](/integrations/payments/stripe) handles this automatically.
107
+
108
+ ## Managing Taxes
109
+
110
+ Tax categories and rates are managed in the Admin Panel under **Settings → Taxes**, or via the Admin API.
111
+
112
+ ### Common Configurations
113
+
114
+ **US store with state-level sales tax:**
115
+ - Create zones for each taxable state
116
+ - Create tax rates per zone (e.g., 8.25% for California, 6.25% for Texas)
117
+ - Set `included_in_price: false`
118
+
119
+ **EU store with VAT:**
120
+ - Create a zone for EU countries
121
+ - Create tax rates per country (e.g., 19% Germany, 20% France)
122
+ - Set `included_in_price: true`
123
+ - Set the EU zone as the default tax zone
124
+
125
+ **Digital products in the EU:**
126
+ - Create a "Digital" tax category
127
+ - Add tax rates for each EU country using the customer's country VAT rate
128
+ - Physical products use the seller's country VAT rate
129
+
130
+ ## Related Documentation
131
+
132
+ - [Markets](/developer/core-concepts/markets) — Tax-inclusive pricing per market
133
+ - [Addresses](/developer/core-concepts/addresses) — Zones and address-based taxation
134
+ - [Adjustments](/developer/core-concepts/adjustments) — Tax adjustments
135
+ - [Orders](/developer/core-concepts/orders) — How taxes affect order totals
@@ -0,0 +1,120 @@
1
+ ---
2
+ title: Translations
3
+ description: Translate product content and other resources into multiple languages
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ Spree supports two types of translations:
9
+
10
+ 1. **Resource Translations** — translatable content fields on models like Products, Taxons, and Stores (e.g., product name, description, slug)
11
+ 2. **UI Translations** — interface strings used in the admin panel (e.g., button labels, flash messages)
12
+
13
+ For configuring which locales and currencies are available in your store, see [Markets](/developer/core-concepts/markets). Markets control locale and currency assignment per geographic region.
14
+
15
+ ## Resource Translations
16
+
17
+ Resources with user-facing content fields have built-in support for translations. Each translatable resource has a corresponding translations table in the database — for example, product translations are stored in `spree_product_translations`.
18
+
19
+ ```mermaid
20
+ erDiagram
21
+ Product ||--o{ ProductTranslation : "has many"
22
+ Taxon ||--o{ TaxonTranslation : "has many"
23
+ Store ||--o{ StoreTranslation : "has many"
24
+
25
+ Product {
26
+ string id PK
27
+ string status
28
+ }
29
+
30
+ ProductTranslation {
31
+ string id PK
32
+ string product_id FK
33
+ string locale
34
+ string name
35
+ text description
36
+ string slug
37
+ string meta_title
38
+ string meta_description
39
+ }
40
+
41
+ TaxonTranslation {
42
+ string id PK
43
+ string taxon_id FK
44
+ string locale
45
+ string name
46
+ text description
47
+ string permalink
48
+ }
49
+ ```
50
+
51
+ ### Translatable Fields
52
+
53
+ | Resource | Translatable Fields |
54
+ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55
+ | Product | `name`, `description`, `slug`, `meta_description`, `meta_keywords`, `meta_title` |
56
+ | Taxon | `name`, `description`, `permalink` |
57
+ | Taxonomy | `name` |
58
+ | Option Type | `presentation` |
59
+ | Option Value | `presentation` |
60
+ | Property | `presentation` |
61
+ | Product Property | `value` |
62
+ | Store | `name`, `meta_description`, `meta_keywords`, `seo_title`, `facebook`, `twitter`, `instagram`, `customer_support_email`, `description`, `address`, `contact_phone` |
63
+
64
+ ### Store API
65
+
66
+ To retrieve translated content, pass the locale via the `X-Spree-Locale` header or the SDK `locale` option:
67
+
68
+
69
+ ```typescript SDK
70
+ // Fetch product in French
71
+ const product = await client.products.get('spree-tote', {
72
+ locale: 'fr',
73
+ })
74
+
75
+ product.name // "Sac Spree"
76
+ product.description // "Un sac fourre-tout élégant..."
77
+ product.slug // "sac-spree"
78
+
79
+ // List categories in German
80
+ const { data: categories } = await client.categories.list({}, {
81
+ locale: 'de',
82
+ })
83
+ ```
84
+
85
+ ```bash cURL
86
+ # Fetch product in French
87
+ curl 'https://api.mystore.com/api/v3/store/products/spree-tote' \
88
+ -H 'Authorization: Bearer spree_pk_xxx' \
89
+ -H 'X-Spree-Locale: fr'
90
+ ```
91
+
92
+
93
+ Slugs are also localized — a product can have different slugs per locale. See [Slugs](/developer/core-concepts/slugs#internationalization) for details.
94
+
95
+ ### Managing Translations
96
+
97
+ Translations are managed in the Admin Panel. When editing a product, taxon, or other translatable resource, switch the locale selector to enter content in each language.
98
+
99
+ Translations can also be managed via the Admin API.
100
+
101
+ ## UI Translations
102
+
103
+ Spree stores UI translation strings in a separate project: [Spree I18n](https://github.com/spree/spree_i18n). This is a community-maintained project with locale files for 43+ languages.
104
+
105
+ To install UI translations:
106
+
107
+ ```bash
108
+ bundle add spree_i18n
109
+ ```
110
+
111
+ Once installed, all translation files are available automatically — no need to copy any files.
112
+
113
+ > **INFO:** The full list of supported locales is available in the [Spree I18n GitHub repository](https://github.com/spree-contrib/spree_i18n/tree/main/config/locales).
114
+
115
+ ## Related Documentation
116
+
117
+ - [Markets](/developer/core-concepts/markets) — Locale and currency configuration per geographic region
118
+ - [Slugs](/developer/core-concepts/slugs) — Localized slugs and URL identifiers
119
+ - [Stores](/developer/core-concepts/stores) — Multi-store setup
120
+ - [Products](/developer/core-concepts/products) — Product translations