Third Party API Integration with Big Commerce Portal
Introduction
BigCommerce is an e-commerce platform that offers a variety of tools for building and managing online stores. If you run a company and want to sell products online, you'll need a platform that makes it easy to create products, manage your inventory, and process orders.
One of the most powerful features of BigCommerce is its API, which allows developers to access and manipulate data within a store.
In this blog post, we'll be focusing on the process of creating products, generating orders and closing them for a company using BigCommerce third party API.
To get started, we'll need to have a few things in place. First, we'll need to have a BigCommerce store set up with API credentials. This will give us access to the API and allow us to authenticate our requests.
API integration implemented in an ASP.NET Core project with version 6.0.
To generate an API token key in BigCommerce (to access APIs)
- Go to the BigCommerce website: https://www.bigcommerce.com/
- Log in/Sign up to your BigCommerce store's control panel.
- Go to the "Advanced Settings" section.
- Select “API Accounts.”
- Give your API account a descriptive name and select the "Legacy API" option.
- Click the "Save" button.
- If you are using Chrome, Firefox or Edge a text file containing the API token
- & Store hash key should have downloaded to your system.
- Store hash key will be displayed in below format
- Create ASP .Net Core project & replace the values in the project (appsettings.json file) with your own API credentials and store information, as it will be needed for making API requests.
Include the following functionality:
- Send item to BigCommerce store
- Retrieving a list of orders from the store & closing them.
Create Product
Purpose:
To allow developers to programmatically create products in a BigCommerce store.
Integrate with the project:
- Replace your json inside “wwwroot/ItemJson” .net core project folder. You can add additional fields to the JSON body as needed to include more details about the product the link is as follows: https://developer.bigcommerce.com/api-reference/366928572e59e-create-a-product
- “Create Product” function is use to send the API request, you will receive a response from BigCommerce indicating the success or failure of the request. If the request was successful, the response will include information about the newly created product.
- BigCommerce API reference:
Get All Orders
Purpose:
To retrieve a list of all orders placed on a store, including information such as the customer details, order items, shipping and billing addresses, payment details, and order status. This can be useful for to integrate with our own systems or third-party applications with BigCommerce.
Integrate with the project:
- To retrieve orders based on a dynamic order status in BigCommerce, you can modify the API request by passing like “Partially Shipped”,” Pending” or “Shipped” of any order status but you need to pass status id inside the “OrderStatusID=2” parameter.(Order id 2 is for “Shipped”). This value can be obtained from the appsettings.json file.
- Refer below code to save orders inside (e.g. “wwwroot/OrderJSON”) folder file:
- BigCommerce API reference:
Close Orders
Purpose:
To retrieve a list of all completed orders placed on a store and mark the generated orders as closed
Integrate with the project:
- To retrieve orders based on a dynamic order status in BigCommerce, you can modify the API request by passing like “Refunded”, “Cancelled” or “Completed” of any order status but you need to pass status id inside the “OrderStatusID=10” parameter (Order id 10 is for “Completed”). This value can be obtained from the appsettings.json file.
- Refer below code to update generated order status as “Refunded”, “Completed” or “Cancelled”.
- BigCommerce API reference:
***Note: The link to find order status IDs in the BigCommerce API documentation is: https://developer.bigcommerce.com/api-reference/d24b6b0f03eb7-get-all-order-statuses
Conclusion
In conclusion, the BigCommerce API provides a powerful and flexible way to create and manage orders within your system. By utilizing the Get All Order API endpoint, you can easily generate new orders with custom fields and product details in your system. Once the order is created, you can then use the Close Order API endpoint to update its status and any other relevant information and then the order marked as “completed”,”refunded” or “cancelled”.
Overall, the BigCommerce API offers a streamlined and efficient way to integrate order management into your system. The API's features, you can easily create a product, generate orders and close orders, providing a seamless experience for both you and your customers.
Posted by: Prajakta Maskare
Sr. Software Developer
Comments