Set Up a Checkout URL

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.

What You Need to Provide

You will need to provide a checkout URL that can receive cart information:

  • Product IDs
  • Quantities
  • Coupons

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.

How to Build Your Checkout URL

Step 1. Create a checkout URL endpoint

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

Step 2. Handle products

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

ProductQuantity

12345

3

23456

1

Step 3. Handle coupons

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

Step 4. Display checkout

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.

Best Practices to Build Your Compatible Checkout URL

1. Clear the cart (if needed)

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).

2. Add products to the cart

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.

3. Apply the coupon code

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.

4. Render the checkout page

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:

  • Has guest checkout enabled (ideally it does not require signup or a login to checkout)
  • Accepts products that match the content IDs in your Meta catalog
  • Displays selected products, quantities and final price
  • Displays applied discounts and promotions
  • Displays the cart subtotal
  • Does not require email opt-in again (if offered in shop)
  • Includes express payment methods for fast checkout (for example: PayPal, Apple Pay, etc.)

5. Test your endpoint and handle errors

Test your endpoint with various product and promotional code combinations. Also consider edge cases listed below and handle them appropriately:

  • Product is out of stock or invalid inventory (cart rules)
  • UTM parameters will be passed in the URL, so be sure to incorporate any tracking mechanisms that you have on the checkout page to be handled for this use case
  • Load time for these endpoints fits your standard SLA practices
  • Promotional code is applied automatically and the discount is reflected on the page
  • Ensure that the code handles URL decoding properly
  • Ensure the experience is mobile-optimized
  • Verify that the new endpoint is part of your approved security policies

Full List of URL Parameters

Query ParameterDescriptionExamples

products

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.

products=12345%3A3%2C23456%3A1

** This example cart has the following two products:

  1. product ID 12345 with quantity 3 and
  2. product ID 23456 with quantity 1

coupon

A single, optional coupon code to apply at checkout. This may include an email opt-in promo code.

coupon=SUMMERSALE20

fbclid

A Facebook Click ID - automatically added to all outbound links from Facebook and Instagram.

fbclid=1234567890abcdef

cart_origin

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.

cart_origin=instagram

utm_source

Identifies the traffic source. Included if the originating ad included this parameter.

utm_source=facebook

utm_medium

Specifies the marketing channel or medium. Included if the originating ad included this parameter.

utm_medium=paid

utm_campaign

Identifies ad creative variations or placements. Included if the originating ad included this parameter.

utm_campaign=2025-spring-sale

utm_content

Identifies ad creative variations or placements. Included if the originating ad included this parameter.

utm_content=carousel