brainerce 1.14.0 → 1.15.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.
- package/README.md +38 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2207,6 +2207,44 @@ export default function CheckoutSuccessPage() {
|
|
|
2207
2207
|
|
|
2208
2208
|
---
|
|
2209
2209
|
|
|
2210
|
+
#### Sandbox / Test Mode
|
|
2211
|
+
|
|
2212
|
+
When `sandboxPaymentsEnabled` is turned on for a vibe-coded connection, `getPaymentProviders()` includes a sandbox provider that allows placing test orders without real payment.
|
|
2213
|
+
|
|
2214
|
+
```typescript
|
|
2215
|
+
const { providers } = await client.getPaymentProviders();
|
|
2216
|
+
const sandboxProvider = providers.find((p) => p.provider === 'sandbox');
|
|
2217
|
+
|
|
2218
|
+
if (sandboxProvider) {
|
|
2219
|
+
// Sandbox is available — testMode will be true
|
|
2220
|
+
console.log(sandboxProvider.testMode); // true
|
|
2221
|
+
console.log(sandboxProvider.name); // "Sandbox (Test Orders)"
|
|
2222
|
+
}
|
|
2223
|
+
```
|
|
2224
|
+
|
|
2225
|
+
When you create a payment intent with the sandbox provider, it returns `renderType: 'sandbox'`:
|
|
2226
|
+
|
|
2227
|
+
```typescript
|
|
2228
|
+
const intent = await client.createPaymentIntent(checkoutId);
|
|
2229
|
+
|
|
2230
|
+
if (intent.clientSdk?.renderType === 'sandbox') {
|
|
2231
|
+
// Show a "Complete Test Order" button instead of real payment UI
|
|
2232
|
+
// No real charges — call completeGuestCheckout() to finalize
|
|
2233
|
+
await client.completeGuestCheckout(checkoutId);
|
|
2234
|
+
// Redirect to order confirmation
|
|
2235
|
+
window.location.href = `/order-confirmation?checkout_id=${checkoutId}`;
|
|
2236
|
+
}
|
|
2237
|
+
```
|
|
2238
|
+
|
|
2239
|
+
**Important notes:**
|
|
2240
|
+
|
|
2241
|
+
- Sandbox orders are marked `isTestOrder: true` in the database
|
|
2242
|
+
- Sandbox orders are automatically set to `financialStatus: 'paid'`
|
|
2243
|
+
- Test orders do not affect store analytics
|
|
2244
|
+
- The embedded `PaymentStep` template handles sandbox rendering automatically
|
|
2245
|
+
|
|
2246
|
+
---
|
|
2247
|
+
|
|
2210
2248
|
### Customer Authentication
|
|
2211
2249
|
|
|
2212
2250
|
#### Register Customer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|