-
Notifications
You must be signed in to change notification settings - Fork 52
DEVDOCS-6477 - OP Docs for Migration Customers #1085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
chris-nowicki
wants to merge
22
commits into
main
Choose a base branch
from
DEVDOCS-6477
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
88d6a6d
Initial Overview Update Commit
chris-nowicki c421cf7
move error handling to root migration folder
chris-nowicki 32f3315
udpate overview and rename catelog folder to products
chris-nowicki 4f725f9
finalized initial draft of migration overview
chris-nowicki 2a4688c
finalized initial draft of customer migration
chris-nowicki 1f76fef
formatting fix
chris-nowicki e8c7e0d
fix password reset example
chris-nowicki 4174a68
add segments and update to customer groups
chris-nowicki 8f199a1
rename error-handling.md to error-handling.mdx
chris-nowicki b4bd526
Merge branch 'main' into DEVDOCS-6477
chris-nowicki a9dc8da
Merge branch 'main' into DEVDOCS-6477
chris-nowicki 1c778ed
Merge branch 'main' into DEVDOCS-6477
chris-nowicki c7d9a33
fix: document structure based on james q feedback
chris-nowicki 4524491
fix: remove initial header as it was redundant
chris-nowicki abd1c3a
fix: add additional information for channels
chris-nowicki d526c8a
fix: added clarity to optional fields
chris-nowicki 6eeff1d
fix: minor introduction fix
chris-nowicki 00c8a76
add additional context to end of api rate limits section
chris-nowicki a88687e
updates per james q comments
chris-nowicki 24a59f5
Merge branch 'main' into DEVDOCS-6477
chris-nowicki eccadf9
Merge branch 'main' into DEVDOCS-6477
chris-nowicki 6aa7ccf
Merge branch 'main' into DEVDOCS-6477
chris-nowicki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,313 @@ | ||
| # Transferring Your Customers to BigCommerce | ||
|
|
||
| By the end of this guide, you'll understand how to migrate customers to BigCommerce using the [REST Management API](/docs/rest-management/customers). You'll learn how to create customers with the minimum required fields, handle API rate limits, and optionally include passwords, customer groups, addresses, and channel assignments. | ||
|
|
||
| ## Create a Customer | ||
|
|
||
| To create a customer, send a POST request to the `/v3/customers` API endpoint. This request, at minimum, requires 3 fields: | ||
|
|
||
| - `first_name` | ||
| - `last_name` | ||
| - `email` | ||
|
|
||
| **API endpoint:** `POST https://api.bigcommerce.com/stores/{store_hash}/v3/customers` | ||
|
|
||
| **Minimal request body:** | ||
|
|
||
| ```json | ||
| { | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]" | ||
| } | ||
| ``` | ||
|
|
||
| For complete API documentation, see [Create Customers API Reference](/docs/rest-management/customers#create-customers). | ||
|
|
||
| ## API Rate Limits | ||
|
|
||
| Each `POST request to the /v3/customers` endpoint allows you to create up to 10 customers and implement retry logic using the rate-limit headers. | ||
|
|
||
| ### Best Practices for API Rate Limits | ||
|
|
||
| 1. **Batch Requests**: Create up to 10 customers per API call to maximize efficiency | ||
| 2. **Monitor Rate Limits**: Check `X-Rate-Limit-Requests-Left` before making requests | ||
| 3. **Implement Retry Logic**: Use exponential backoff when receiving `429` responses | ||
chris-nowicki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 4. **Distribute Load**: Spread requests over time rather than making them in bursts | ||
|
|
||
| ### Example: Batch Customer Creation | ||
|
|
||
| <Tabs items={['Batch Payload (10 customers)', 'Rate Limit Handling Function']}> | ||
| <Tab> | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "John", | ||
| "last_name": "Smith", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "Alice", | ||
| "last_name": "Johnson", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "Bob", | ||
| "last_name": "Williams", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "Carol", | ||
| "last_name": "Brown", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "David", | ||
| "last_name": "Jones", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "Emma", | ||
| "last_name": "Garcia", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "Frank", | ||
| "last_name": "Miller", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "Grace", | ||
| "last_name": "Davis", | ||
| "email": "[email protected]" | ||
| }, | ||
| { | ||
| "first_name": "Henry", | ||
| "last_name": "Rodriguez", | ||
| "email": "[email protected]" | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| </Tab> | ||
| <Tab> | ||
|
|
||
| ```javascript | ||
| async function createCustomers(customerData) { | ||
| const response = await fetch( | ||
| 'https://api.bigcommerce.com/stores/{store_hash}/v3/customers', | ||
| { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'X-Auth-Token': 'your_access_token', | ||
| }, | ||
| body: JSON.stringify(customerData), | ||
| } | ||
| ) | ||
|
|
||
| // Handle rate limiting | ||
| if (response.status === 429) { | ||
| const resetTime = response.headers.get('X-Rate-Limit-Time-Reset-Ms') | ||
| const waitTime = resetTime ? parseInt(resetTime) : 1000 | ||
|
|
||
| console.log(`Rate limited. Waiting ${waitTime}ms before retry`) | ||
| await new Promise((resolve) => setTimeout(resolve, waitTime)) | ||
|
|
||
| // Retry the request | ||
| return createCustomers(customerData) | ||
| } | ||
|
|
||
| return response | ||
| } | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| For detailed information about rate limits and best practices, see: | ||
|
|
||
| - [API rate limits](/docs/start/best-practices/api-rate-limits) | ||
| - [API best practices](/docs/start/best-practices/api-rate-limits#best-practices) | ||
|
|
||
| ## Customer Creation Options | ||
|
|
||
| In addition to the required fields (`first_name`, `last_name`, `email`), there are optional fields you can include when creating customers based on your needs: | ||
|
|
||
| - Password Management | ||
| - Customer Groups | ||
| - Customer Addresses | ||
| - Channels | ||
|
|
||
| Let's cover each option in detail. | ||
|
|
||
| ### Password Management | ||
|
|
||
| Due to PCI compliance, you cannot migrate passwords. This means you can either create customers without passwords and send password reset emails after migration or set a password during creation. | ||
|
|
||
| #### Preferred: No password (password reset required) | ||
|
|
||
| Create customers without passwords and send password reset emails after migration: | ||
|
|
||
| ```json | ||
| { | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]" | ||
| } | ||
| ``` | ||
|
|
||
| After migration, send a password reset email to each customer. You can use your preferred email service to send a generic email to all users with instructions to reset their password using the storefront login page. | ||
|
|
||
| #### Alternative: Set password during creation | ||
|
|
||
| <Callout type='warning'> | ||
| If you set a password during creation, ensure each user gets a unique | ||
| password. Using the same password for multiple accounts creates a security | ||
| risk. We recommend sending password reset emails instead of setting passwords | ||
| during creation. | ||
| </Callout> | ||
|
|
||
| To set a temporary password, include the `authentication` object with `force_password_reset: true` and `new_password`: | ||
|
|
||
| ```json | ||
| { | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]", | ||
| "authentication": { | ||
| "force_password_reset": true, | ||
| "new_password": "string123" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Customer Groups | ||
|
|
||
| Customer groups allow you to organize customers and control product visibility, pricing, and checkout options. Each customer can belong to only one group. | ||
|
|
||
| **Key points for migration:** | ||
|
|
||
| - Customer groups must be created in the control panel before migration (cannot be created via API) | ||
| - Assign customers to groups using the `customer_group_id` field during creation | ||
| - Groups control which products customers can see and purchase | ||
|
|
||
| **Example Customer with customer group assignment payload:** | ||
|
|
||
| ```json | ||
| { | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]", | ||
| "customer_group_id": 1 | ||
| } | ||
| ``` | ||
|
|
||
| For detailed information about creating and managing customer groups, see [Customer Groups](https://support.bigcommerce.com/s/article/Customer-Groups?language=en_US#how) in the BigCommerce support documentation. | ||
|
|
||
| ### Customer Addresses | ||
|
|
||
| Customer addresses can be included during customer creation. Each address has specific required fields that must be provided. | ||
|
|
||
| **Required fields for addresses:** | ||
|
|
||
| - `address1` - Street address line 1 | ||
| - `city` - City name | ||
| - `country_code` - Two-letter country code (e.g., "US", "CA", "GB") | ||
| - `first_name` - First name for the address | ||
| - `last_name` - Last name for the address | ||
| - `postal_code` - ZIP/postal code | ||
| - `state_or_province` - State or province name | ||
|
|
||
| **Example Customer with minimal address payload:** | ||
|
|
||
| ```json | ||
| { | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]", | ||
| "addresses": [ | ||
| { | ||
| "address1": "123 Main St", | ||
| "city": "San Francisco", | ||
| "country_code": "US", | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "postal_code": "94105", | ||
| "state_or_province": "California" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ### Channels | ||
|
|
||
| Channels allow you to create different storefronts or customer experiences (multi-storefront, headless commerce, mobile apps, marketplaces, etc.). You can assign customers to specific channels to control which storefront they can access. | ||
|
|
||
| **Requirements:** | ||
|
|
||
| - Channels must be created before migration (can be created via the [Rest Management API](/docs/rest-management/channels#create-a-channel) or control panel) | ||
| - Customers without a channel assignment default to global access | ||
|
|
||
| **Example Customer with channel assignment and minimal payload:** | ||
|
|
||
| ```json | ||
| { | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]", | ||
| "channel_ids": [1, 2] | ||
| } | ||
| ``` | ||
|
|
||
| For detailed information about creating and managing channels, see [Getting Started with Channels](https://support.bigcommerce.com/s/article/Getting-Started-Channels?language=en_US) in the BigCommerce support documentation. | ||
|
|
||
| ## Customer Creation Example Payload | ||
|
|
||
| Here is a comprehensive example showing a customer created with: | ||
|
|
||
| - A temporary password (with forced reset) | ||
| - Assignment to customer group 1 | ||
| - A minimal address (required fields only) | ||
| - Assignment to channels 1 and 2 | ||
|
|
||
| ```json | ||
| { | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]", | ||
| "customer_group_id": 1, | ||
| "addresses": [ | ||
| { | ||
| "address1": "123 Main St", | ||
| "city": "San Francisco", | ||
| "country_code": "US", | ||
| "first_name": "Jane", | ||
| "last_name": "Doe", | ||
| "postal_code": "94105", | ||
| "state_or_province": "California" | ||
| } | ||
| ], | ||
| "authentication": { | ||
| "force_password_reset": true, | ||
| "new_password": "string123" | ||
| }, | ||
| "channel_ids": [1, 2] | ||
| } | ||
| ``` | ||
|
|
||
| ## Additional Resources | ||
|
|
||
| For more technical details and API documentation, see: | ||
|
|
||
| - [Create Customer API Reference](/docs/rest-management/customers#create-customers) | ||
| - [API rate limits](/docs/start/best-practices/api-rate-limits) | ||
| - [API best practices](/docs/start/best-practices/api-rate-limits#best-practices) | ||
| - [Getting Started with Channels](https://support.bigcommerce.com/s/article/Getting-Started-Channels?language=en_US) | ||
| - [Data migration services](https://www.bigcommerce.com/services/launch/#data-migration-services) | ||
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.