Sell anything on your social platform
November 08, 2023
4 mins read
Building and scaling eCommerce to sell any products is often a costly and ambitious goal for most social platforms without massive clout like TikTok or marketplace infrastructures like Meta.
Building the rudimentary order processing and cart technology is not hard. What is difficult - is acquiring merchants, orchestrating order placement, payment processing, building a consistent user experience, and consolidating data across platforms. Social platforms end up spending millions to solve the series of issues.
This guide shows you how you can skip all of that work.
One of the challenges involves acquiring merchants in order to fetch their up-to-date product data for your inventory, place orders programmatically to make sure they are fulfilled, and to get affiliate commissions on sales. For instance, a creator recommends 4 products for a winter skincare routine in a video. The products are from 4 different merchants, some listed on Amazon, some Shopify. To enable users purchase them all in one go, you must tackle:
User information validation (shipping address, billing address, phone validation, etc.)
Fraudulent payment issues
3DS payment verifications
Issues with third-party logistics (3PL)
This is where Rye’s Sell Anything API comes to play - an integration that solves for the above problems (and many more). This includes the ability for you to list and sell any products listed on Amazon or Shopify without having to build 1:1 merchant relationships. Our users simply plug into our APIs to build a complete end-to-end eCommerce experience in 7 steps. These are the fundamental blocks extensible to marketplace and gifting platforms as well.
This tutorial enables you to add products into your platform’s own inventory, for users to select and add products to cart, submit the cart order, and for you to keep track of orders (using web-hooks).
We will be:
ApolloClientas our GQL client for making the API calls
Step 0: Initialize GQL (graph query language) client via API key headers
Step 1: Add products you want to sell to Rye’s inventory
Some products on Amazon or Shopify may not be logged in the Rye inventory. Products can be added to our inventory by the
Input: The URL for the product
Output: The ID of the product
Step 2: Fetch product data from Rye’s inventory
Now that the product is in Rye’s inventory, you can fetch product information via the
productByID query. This allows you to showcase products and display accurate, up-to-date information, and allows users to make informed purchasing decisions.
The product ID
The marketplace of the product (Amazon or Shopify)
All the requested product data
The code snippet below only fetches specific product data including title, vendor, variants, and price. Update the
FetchProductData query below to fetch more fields as required (list of fields here).
Step 3: Create a cart with an item for user
Create a cart with an item via the
Rye offers the ability to add multiple products to your cart from multiple different stores!
The cart ID
An array of objects which have the quantity and the product ID
Step 4: Update buyer identity for the cart
Now that you have a cart which is ready to be checked out, the next step is to get the users details and shipping address. A shipping address is required for us to get shipping methods in the next step.
To associate a cart with a buyer identity, we use the
updateCartBuyerIdentity mutation. This mutation deals with the gnarly address validation issues, ensuring that you will only be able to enter valid information to proceed.
The cart ID
User shipping address information
Step 5: Select a shipping method for the cart
Now that the cart has been associated with a buyer, Rye fetches all the possible shipping options. If a cart has products from more than 1 store, Rye sends possible shipping options for each store.
To select a shipping option for a store, we can use the
Please ensure to select shipping options for each store in your cart.
The cart ID
An array of objects which have the shipping ID and the store name
Step 6: Payment + submit cart
Now that we have a cart with items, an associated buyer identity, and a selected shipping method, we are ready to checkout!
To submit the cart, Rye provides two approaches:
We are using Rye Pay for simplicity.
The cart ID
Billing address information
CC details (in the Spreedly fields)
Order submission status
Step 7: Post-checkout experience
Once an order has been submitted, Rye sends you the following web-hooks/push-notifications to ensure that you have complete visibility in the progress of the order:
Order submission started
Order submission succeeded
Order placed / Order failed
Tracking webhooks (For individual shipments)
Order cancel started
Order cancel succeeded
Order cancel failed
For more details on web-hooks available: https://docs.rye.com/docs/webhook-updates
To configure your web-hooks:
Head over to https://console.rye.com/account
Enter a valid callback endpoint for your backend under the "Webhook section", and click save!
In 7 simple steps, you have built an end-to-end eComm experience for your social platform using Rye APIs.
The best part? These APIs are GQL queries and mutations that can be configured for any codebase and tech-stack, giving power back to developers. Our APIs are free to use. So keep testing and iterating on what we’ve built so far!
We love building the future of eComm and hearing your big ideas. Get in touch to see how we can help you scale your platform together.