Intro to Building Shopify Apps for B2B Merchants

B2B APIs

It’s no secret that B2B (business-to-business) is an area of growth for ecommerce. In fact,Gartner estimatesthat 80% of B2B sales interactions will be happening in digital channels by 2025—and that’s a huge opportunity for merchants.

To help merchants capitalize on that opportunity, we’re providing B2B capabilities built directly in our core product. Shopify Plus merchants and merchants usingCommerce Components by Shopifynow have a suite of tools available to sell both wholesale and DTC (direct-to-consumer) from the same store, and build advanced integrations.

Today, as announced atthe Shopify Winter ’23 Edition, we are introducing more resources for developers building for B2B, including updates to business customer primitives, and contextual pricing and publishing using the upcomingCatalogfeature. Using the new B2B APIs, developers can build apps and solutions that directly integrate with B2B features on Shopify and reach a new market of B2B merchants. In this article, learn about these new APIs and what they mean for you.

Catch up on the latest developer announcements from the Shopify Winter ’23 Edition

The Shopify Winter ’23 Edition was full of big announcements for developers who work with Shopify. Visit our roundup on the Shopify Partner Blog to get caught up on all the news.

Read article

Shopify’s B2B APIs

Let’s first review the suite of APIs available for developers building B2B solutions on Shopify.

1.公司的API

When a merchant engages in B2B transactions, they sell their goods and services directly to other companies. When a company is the customer, there are often multiple contacts, locations, and pre-negotiated payment terms to manage. All of these factors complicate the process of expanding a business into the B2B space.

The Business Customers API provides a set of B2B primitives such asCompany,CompanyLocations, andCompanyContacts. These can be used to represent information about who makes a B2B purchase. When selling to B2B customers, merchants need to save different information than they would when selling to DTC customers. For example, a company location must be added to attach important information like tax exemptions and payment terms to the company.

Now, developers can add metafields to extend theCompanyandCompanyLocationresources. This creates a flexible way for your app to add and store additional information. This information can be surfaced to merchants or used by your app to create unique business logic such as order value minimums and maximums.

B2B APIs: A flow chart showing the Company API and its relations
The Company API and relations.

2. Catalogs API [Unstable]

Announced atthe Shopify Winter ’23 Edition, aCatalogis a set of rules that determine the available products and their prices in different contexts.

As an example, let’s imagine a merchant who sells packaged food products wholesale in the US and Canada. This merchant may decide that based on regional tastes, some products don’t make sense to sell in the US or Canadian market. For this reason, a merchant would useCatalogto curate the product selection a customer sees when they log into their B2B store, based on their geographical location. Canadian customers will be able to see and purchase some products that US customers will not, and vice versa. WithCatalog, we can tailor the buying experience for each customer to ensure they only see the products and prices that are applicable to them.

This new feature can integrate with your wholesale apps and workflows to offer unique wholesale product offerings and loyalty programs, with curated product selections to customize B2B buyer experiences at scale. It is available in an unstable API version now and we’re planning to make it available in the 2023-04 API version. Start experimenting today andlet us knowhow we can make it better.

3. PriceLists API

You can associate aPriceListwith aCatalogto determine the prices that are shown to customers ordering for a specific B2B company location.PriceListcan have a relative price adjustment or a fixed price per product variant.

This allows app developers to create applications that can show different prices to different B2B buyers. For example, it is possible to usePriceListsto decrease the base price of the product by 5% andCatalogsto assign the discount to specific locations.

4. Publications API

The Publications API allows you to associate aPublicationwith aCatalogto determine which products are shown to B2B customers. If aPublicationisn't associated with aCatalog, then no products are available for the customer.

Apps can create and manage aPublication, allowing developers to build integrations with external systems and automatically sync what products specific customers can purchase.

B2B APIs: A flow chart showing the B2B primitives and their relations
The B2B primitives and their relationships.

5. Order and DraftOrder APIs

You may be familiar withOrderandDraftOrderobjects. AnOrderis a customer's request to purchase one or more products from a shop, while aDraftOrderis anOrderthat a merchant initiates and sends an invoice to a customer to accept and pay.

TheOrderandDraftOrderobjects have been updated to distinguish between DTC (direct-to-consumer) and B2B orders. AnOrdercan now return aPurchasingEntitythat represents the buyer (either a DTC customer or a B2B customer including a company and company location). Now, apps can pass in this crucial data if anOrderwas created in a B2B context.

6. Payment Terms API

Payment terms enable you to set the length of time that a company has to pay for their order. You can set payment terms for any company location that you create. After payment terms are set for a location, any B2B customer for that location can enter payment information for the order. Apps can use this API to create solutions to automatically sync B2B custom payment terms from external systems. Now apps are able to query the associatedOrderandDraftOrderfrom thePaymentTermsobject.

Building B2B apps for large merchants

The addition of these APIs opens up opportunities for developers to reach and capture more Shopify Plus and Commerce Components by Shopify merchants by extending their current apps and solutions, or building new ones. In this section, we look at some example use cases.

B2B apps for Shopify Checkout

B2B resources are not only exposed on the Shopify Admin API, but also on the Shopify Functions APIs.Shopify Functionsallow developers to customize the backend logic that powers parts of Shopify. Using the new B2B resources on theDeliveryandPayment Customization APIs, developers can build apps that filter, rename, reorder, and sort the delivery and payment options available to B2B customers. For example, you can build an app that uses Delivery Functions to modify the shipping options available for B2B customers, and aUI extensionto present an explanation of the change.

B2B APIs: A flowchart showing the B2B primitives available with Shopify Functions
The B2B primitives available with Shopify Functions.

忠诚为B2B应用程序

Apps for facilitating loyalty programs are popular for DTC merchants. Now, app developers can expand their user base by bringing this functionality to merchants offering B2B. Existing loyalty apps can use theCompanyandCompanyLocationresources and metafields to implement B2B loyalty programs. For example, you can build an app for tiering B2B buyers, and to associate unique perks such as no shipping fees for buyers with gold status.

Webhooks for B2B

New webhook events were added for B2B resources. Subscribe to thePAYMENT_SCHEDULES_DUEtopic to get notified when a payment is due according to the payment terms of the order or draft order. Apps can use these webhooks to create unique workflows and integrations.

Dig deeper into the developer products announced at Shopify Editions

加入我们即将Shopify Editions-focused AMA sessions on our Discord channel. Learn from industry experts, including Shopify CEO Tobi Lütke, ask questions, and connect with other like-minded individuals.

你可以回复任何AMA会议兴趣哟u on our Discord channel in the ‘Events’ category at the top left of the channel list. Join our Discord channel at the link below.

Join now

New opportunities with B2B

A world of opportunity exists when merchants connect with other businesses to sell wholesale. This represents billions of untapped revenue.

To learn more about building B2B apps for Shopify, review ourgetting started guidesanddeveloper documentation. Or, if you already have an app that manages and supportsPriceLists, review ourmigration guideso your app can benefit from the latest B2B features.

Topics:

Grow your business with the Shopify Partner Program

Learn more