Recently Jerry is working on an integration project about creating orders in Wechat platform by consuming SAP Commerce Cloud Restful API.

Consultants who didn't touch SAP Commerce before(such as Jerry ) might get confused once they saw the search result by key word "commerce" in https://help.sap.com:

Several products with similar name are listed in search result.

  • SAP Commerce:SAP commerce solution based on On-Premises deployment approach

  • SAP Commerce Cloud on SAP Infrastructure & SAP Commerce Cloud on Public Cloud: as their names give a very clear hint: both are SAP Commerce solution based on cloud, and differentiated by the underlying cloud infrastructure the solution are running. SAP Commerce Cloud on SAP Infrastructure are sometimes called Commerce Cloud Version One and CCV1 for short, while the latter called CCV2.

There is a nice blog Two clouds in practice: a comparison of SAP Commerce Cloud v1 and v2in medium comparing both.

Back to my task, it's helpful if we play around in Commerce Cloud storefront UI to create a order manually to get ourselves familar with the process.

Log in to storefront and browse the site:

And identify a favourite product and add it to cart by pressing button "ADD TO CART":

Press CHECK OUT to proceed:

Now we get a cart ID:

Maintain shipping address:

Maintain payment details:

Once Place Order button is clicked, the order is successfully created with an automatically populated order ID:

In summary, the process of order manual creation in SAP Commerce Cloud consists of five steps:

(1) create a Shopping Cart

(2) add products into the cart

(3) maintain shipping address to the cart

(4) maintain payment details to the cart

(5) execution place order action on the cart to get order created

Now we should figure out for each step, what exactly APIs should be called.

Go to https://api.sap.com, search by keyword "Commerce Cloud", and it's easy to find the supported API list there.

Jerry has written a simple nodejs application to demonstrate how to consume such APIs to create orders in SAP Commerce Cloud. The whole source code is uploaded to my github.

Execute the application, and we can observe the successflly created order with its ID in callback function in line 20:

Search the ID in Commerce Cloud backoffice UI to check the details of created order.


As introduced before, it's necessary to go through five steps to have an order generated. And in Jerry's project there are totally seven "step.js" implementation files, why?

For the additional two step.js, one is for access token retrieve and the other for cart delivery mode set operation. Access token will be appended to the header fields of all the subsequent API calls for authorization purpose. And the cart delivery mode will be set implicitly if performed in storefront UI via browser whereas an explicit API call is necessary in our case. As a result totally seven HTTP roundtrip is needed in API consumption case.

The access token fetch is implemented by following OAuth protocol: send the OAuth Client ID and secret to SAP Commerce Cloud OAuth endpoint to get the issued access token.

First we have to create a new OAuth Client in SAP Commerce Cloud backoffice:

Then in file "step1_get_token.js", send a HTTP POST to Commerce Cloud Authentication endpoint to request access token:

For privacy reason I didn't upload urlconfig.js to github which contains the dedicated url of my own Commerce Cloud API endpoint. Instead I upload the template file: urlconfigTemplate.js. Just replace the place holder marked with "<>" with your actual value there, rename the template file back to urlconfig.js. After that you can create orders in your own Commerce Cloud tenant.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

Step by Step to create orders by consuming SAP Commerce Cloud Restful API的更多相关文章

  1. Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1)

    Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1) AP ...

  2. [转]Bootstrap 3.0.0 with ASP.NET Web Forms – Step by Step – Without NuGet Package

    本文转自:http://www.mytecbits.com/microsoft/dot-net/bootstrap-3-0-0-with-asp-net-web-forms In my earlier ...

  3. Step by step Process of creating APD

    Step by step Process of creating APD: Business Scenario: Here we are going to create an APD on top o ...

  4. Tomcat Clustering - A Step By Step Guide --转载

    Tomcat Clustering - A Step By Step Guide Apache Tomcat is a great performer on its own, but if you'r ...

  5. [ZZ] Understanding 3D rendering step by step with 3DMark11 - BeHardware >> Graphics cards

    http://www.behardware.com/art/lire/845/ --> Understanding 3D rendering step by step with 3DMark11 ...

  6. Step by Step Recipe for Securing Kafka with Kerberos

    Short Description: Step by Step Recipe for Securing Kafka with Kerberos. Article I found it is a lit ...

  7. PyTorch in Action: A Step by Step Tutorial

    PyTorch in Action: A Step by Step Tutorial   PyTorch in Action: A Step by Step Tutorial Installation ...

  8. 课程五(Sequence Models),第一 周(Recurrent Neural Networks) —— 1.Programming assignments:Building a recurrent neural network - step by step

    Building your Recurrent Neural Network - Step by Step Welcome to Course 5's first assignment! In thi ...

  9. 课程四(Convolutional Neural Networks),第一周(Foundations of Convolutional Neural Networks) —— 2.Programming assignments:Convolutional Model: step by step

    Convolutional Neural Networks: Step by Step Welcome to Course 4's first assignment! In this assignme ...

随机推荐

  1. 关于Django中的数据库操作API之distinct去重的一个误传

    转载自http://www.360doc.com/content/18/0731/18/58287567_774731201.shtml django提供的数据库操作API中的distinct()函数 ...

  2. python练习:寒冰猴子狐狸,猫狗咬架

    python练习:寒冰猴子狐狸,猫狗咬架 一,寒冰猴子狐狸 class Person: def __init__(self, na, gen, age, fig): self.name = na se ...

  3. linux学习(5):linux 性能瓶颈排查

    作为开发人员,肯定遇到过以下场景,应用突然卡住了,或者异常退出,cpu占用过高等各种异常情况,一般遇到这些异常情况,该如何去查找具体原因呢? linux和jdk提供了一些命令和工具来查看内存.cpu. ...

  4. linux学习(3):linux常用命令大全

    Linux常用命令大全(非常全!!!) 最近都在和Linux打交道,感觉还不错.我觉得Linux相比windows比较麻烦的就是很多东西都要用命令来控制,当然,这也是很多人喜欢linux的原因,比较短 ...

  5. vue elementUi tree 懒加载使用详情

    背景:vue下使用elementUI 文档:http://element-cn.eleme.io/#/zh-CN/component/tree#tree-shu-xing-kong-jian 需求:只 ...

  6. implement a list using Rust

    Rust果然比較複雜,在經歷了n次compile fail,終于寫成了一個 list 難點: 對Rc<>的用法不熟悉.對borrow checker不夠熟悉 有些寫法可能還不是最短的 us ...

  7. [转]C++ 使用 curl 进行 http 请求(GET、POST、Download)的封装

    原文连接:https://www.cnblogs.com/oftenlin/p/9478067.html CommonTools.h   /* * CommonTools.h * * Created ...

  8. flink入门(一)——基本原理与应用场景

    一.简介 1.简介 flink是一个开源的分布式流处理框架 优势:高性能处理.高度灵活window操作.有状态计算的Exactly-once等 详情简介,参考官网:https://flink.apac ...

  9. Harbor密码重置 密码修改 admin密码重置

    Harbor密码重置harbor现在是使用postgresql 数据库了.不再支持mysql,网上有N多重置Mysql密码的,可以略过了.我密码错了默认的Harbor12345 修改为: RedHat ...

  10. Altera FPGA 远程升级有关的几个IP的使用

    在做在线远程升级的时候,一般需要两步:1.将数据写到外挂的flash中.2重新启动FPGA配置. 不过要做到远程升级,一般需要在原始程序中就考虑到加入远程升级模块,remote updata IP, ...