问题
I am working on an e-commerce website similar to E-bay or Amazon, where sellers can list their products.
I have also created a Shopify Sales Channel for my e-commerce website, which can import products from Shopify. A Shopify store installs the Sales Channel App and their products will be imported to my e-commerce website.
All of this is working fine... now I want to build the last step, which is buy the product. A buyer comes to my e-commerce website and wants to buy a product which has been imported from certain Shopify store. I want to enable the buyer to create an order from my e-commerce website.
According to Shopify documentation:
By default, your app can provide checkout links to Shopify's web checkout for each product. This lets your platform use Shopify's web checkout instead of building your own native checkout form. You can direct customers to a checkout link by using the
web_url
parameter of the Checkout API.
This is what I want... I want to allow a buyer in my e-commerce website to create an order and redirect him to Shopify for payment... buy how can I actually implement this? Would I be able to implement this using Order API? And how could I redirect the user to Shopify store for payment?
If redirecting user to Shopify store for payment is not an option, then do I need to implement the payment process within my e-commerce using the Checkout API? Would anyone be able to give some details about this?
回答1:
Use DraftOrder API to create an order. Once created it has the invoice_url
attribute which can be used to pay and complete that order.
来源:https://stackoverflow.com/questions/61039791/how-to-create-an-order-from-sales-channel-and-redirect-the-user-to-shopify-store