[ERR] Implementing Deferred Purchase Options (Pre-Order) In Shopify App

[ERR] Implementing Deferred Purchase Options (Pre-Order) In Shopify App

John269
Tourist
6 0 5

Hello everyone!
I want to ask about the docs about implement deferred purchase options (Pre-Order). It seems that the docs for that don't provide enough information. This is the docs: https://shopify.dev/apps/purchase-options/deferred/modeling#building-deferred-purchase-options-in-yo...

 

I have followed all the steps, however I am still struggling with how to implement deferred purchase options (Pre-Order) in my app. I have used AJAX Cart API to add item with selling_plan to Cart but the API request returns the line_items without the selling plan attribute. It is supposed to return the line_items with the selling plan attributes.

When I proceed to checkout, it still charges the total amount, not the checkoutCharge that set in billingPolicy.

Below is my Cart AJAX API code I use to add the product with selling_plan to Cart 

 

fetch(window.Shopify.routes.root + "cart/add.js", {
  method: "POST",

  body: JSON.stringify({
    items: [
      {
        id: 43887580578069,
        quantity: 1,
        selling_plan: 688132129045,
      },
    ],
  }),
  headers: {
    "Content-type": "application/json; charset=UTF-8",
  },
})
  .then((response) => response.json())

  .then((json) => console.log(json))
  .catch((err) => {
    console.log("err: ", err);
  });

 

Also, I have "Only show this product with these purchase options" tick true on a product, but when I add that product to Cart it still display the default payment method with full charge instead of the checkoutCharge in billingPolicy of Selling Plan

 

This is the documentation link I followed which has the correct response:
https://shopify.dev/api/ajax/reference/cart

 

I would be greatly appreciated if someone can help me with this.
Thanks

Reply 1 (1)

kp9394
Shopify Partner
3 0 0

Maybe your store is not eligible for the subscription. If you use a subscription in your store then must enable Shopify Payment. But please use test mode.

For more details you can check below screenshot.



kp9394_0-1690979183093.png

Thanks