OCAPI Cart Integration with Storefront #449
Replies: 3 comments
-
Hi @redz0701 - This depends on how the app is working.
Depending on the answers to those questions, there are a couple of options: Option 2:
When you are ready to send them to the site to finish checkout you can then call POST /sessions, which will return cookies for you, including an dwsecuretoken for that storefront session that you then open in a webView. |
Beta Was this translation helpful? Give feedback.
-
Hi,
@steven great answer, captures all relevant details.
I would recommend going via the route one, looking at your requirements, i
think you are not doing anything which is specific to the given customers
but the intention is to give customers a native user interface to browse
the products and the highlight here is the app to capture the sizes so that
products can be proposed.
Looking at this, option 1 suits you because to handle the option 2, you
would need to handle all host of things that you might want to avoid.
…On Sat, Aug 10, 2019, 4:55 AM Steven Collins ***@***.***> wrote:
Hi @redz0701 <https://github.com/redz0701> - This depends on how the app
is working.
- Are you having your users log in using their storefront accounts at
any point in time, or are they anonymous?
- How is the user being transferred from the app to the storefront, is
it a web view within the app, or is it trying to open the mobile browser?
- Are you gathering any additional information from the customer other
than than what products they want to purchase?
Depending on the answers to those questions, there are a couple of options:
*Option 1:*
If you are only gathering product information and do not need to pass any
other information over to the storefront, the best thing to do might be to
just have a controller on the SFCC side that would take an array of product
IDs and quantities and have it add it to any existing basket (in the event
that the user already has an active session on the website, or has chosen
to remain logged in there), or to create a new basket and add them.
*Option 2:*
If you are wanting to get a more in-depth experience, possibly even
setting the stage for in-app checkout in the future, then you could look at
something like:
- POST /customers/auth - either authenticate the user using their
website credentials, or create a guest session
- GET / customers/{customer_id}/baskets - check to see if a registered
customer already has a basket
- POST /baskets - Not necessary if a basket is returned for a
registered customer, should be done for a guest user
- POST /basket/{item_id} - This will add the products that you want to
the basket
When you are ready to send them to the site to finish checkout you can
then call POST /sessions, which will return cookies for you, including an
dwsecuretoken for that storefront session that you then open in a webView.
NOTE: For neither iOS or Android you cannot write cookies out to the
native browser, only to a UIWebView. This post has more information around
how to do that;
https://stackoverflow.com/questions/5954382/is-it-possible-to-set-a-cookie-manually-using-sharedhttpcookiestorage-for-a-uiwe
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/orgs/SalesforceCommerceCloud/teams/community/discussions/102/comments/1?email_source=notifications&email_token=AKECNZL44GWLAEKV6D4IWBTQDXTTHA5CNFSM4IKWMRDKYY3PNVWWK3TUL52HS4DFWNCGS43DOVZXG2LPNZIG643UKJSXA3DZVJRW63LNMVXHIX3JMTHAAAQ2YY>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKECNZPX7TGL7DCH5L6LCO3QDXTTHANCNFSM4IKWMRDA>
.
|
Beta Was this translation helpful? Give feedback.
-
Hi @astound-scollins, |
Beta Was this translation helpful? Give feedback.
-
We are currently working on a native mobile app to help consumers with fit. OCAPI is being used to integrate the app with SFCC.
Below is the current flow of the app, I have some questions on cart functionality with OCAPI.
How can we pass the cart details associated with the OCAPI basket to storefront site? Are there any identifiers we can use to pass the data?
Is there any optimal way to redirect users from their in-app cart to storefront cart to complete the checkout?
Any help is appreciated.
Thanks in Advance.
Beta Was this translation helpful? Give feedback.
All reactions