When customers make a purchase from your shop on Facebook or Instagram, the checkout process takes place on your own website. You'll need to build a checkout URL that will allow customers to complete their shops purchases seamlessly on your website.
Checkout URL receives products from cart.
You will need to provide a checkout URL that can receive cart information:
Once you build your checkout URL, you can test your checkout by adding products and promo codes. Make sure the products you’ve selected appear in your website’s checkout with the right quantity and price, and that your subtotal is accurate. If you’ve added a promo code, make sure it’s been applied. Meta will also automatically review your website’s checkout experience on a periodic basis to ensure it’s working properly.
An endpoint will need to exist on your website that Meta can use to direct users to check out on your website. This may be an existing page or a dedicated one you create for this experience.
Example: https://www.example.com/checkout
You will receive a comma-separated list of products in the products query string parameter. For each product, the ID and quantity are separated by a colon. Commas (%2C) and colons (%3A) are escaped according to RFC 3986.
Example: https://www.example.com/checkout?products=12345%3A3%2C23456%3A1
Parameter: products=12345%3A3%2C23456%3A1
Decoded: products=12345:3,23456:1
Product | Quantity |
---|---|
12345 | 3 |
23456 | 1 |
You will optionally receive a coupon to be applied in the coupon query string parameter. This coupon code should be validated and applied to the cart.
Example: https://www.example.com/checkout?products=12345%3A3%2C23456%3A1&coupon=SUMMERSALE20
Parameter: coupon=SUMMERSALE20
After validating the products, quantities and optional coupon, you can now display the checkout experience to the user.
Additional parameters are provided for tracking conversions (see full reference here). If you perform a redirect to a different URL, be sure to pass along these parameters to that URL.
If you store cart information in cookies or local storage, make sure that the cart is cleared on each call to the endpoint so that new items can be added each time. This ensures that your buyers don’t see products previously in their cart. You may add an additional parameter onto the endpoint to do this (for example: https://www.example.com/checkout?clear=true).
The products specified in the products parameter should be added to the cart with the given quantities. Please make sure that the product IDs used in your code are the same product IDs from the catalog. If the products are no longer available or out of stock, inform the user.
If a coupon code is provided, it should also be applied to the cart. If the coupon code is invalid or expired, inform the user.
After all the required items are added to the cart, display your checkout page. To ensure a frictionless user journey, please confirm that your checkout page:
Test your endpoint with various product and promotional code combinations. Also consider edge cases listed below and handle them appropriately:
Query Parameter | Description | Examples |
---|---|---|
| A comma-separated list of products. For each product, the ID and quantity are separated by a colon. Commas (%2C) and colons (%3A) are escaped according to RFC 3986. Your web server should provide an API similar to decodeURIComponent to parse these parameters. Products with comma (,) or colon (:) characters in their ID are not supported. |
** This example cart has the following two products:
|
| A single, optional coupon code to apply at checkout. This may include an email opt-in promo code. |
|
| A Facebook Click ID - automatically added to all outbound links from Facebook and Instagram. |
|
| The source app the buyer is using to checkout. Possible values include “facebook”, “instagram”, and “meta_shops”. These are for Facebook, Instagram and Commerce Manager respectively. |
|
| Identifies the traffic source. Included if the originating ad included this parameter. |
|
| Specifies the marketing channel or medium. Included if the originating ad included this parameter. |
|
| Identifies ad creative variations or placements. Included if the originating ad included this parameter. |
|
| Identifies ad creative variations or placements. Included if the originating ad included this parameter. |
|