Calling SAP Order Service from CloudCraze
During one of our recent projects, the customer requested that the check-out flow should call an external order service on SAP prior to saving the order to Cloudcraze. If the call to the SAP Order API fails, we want to show user errors and prevent the order from proceeding.
Unfortunately, the Cloud Craze Order API hook didn't support outbound web service calls
Hence, we customized the Checkout page and made call to custom remote action. By utilizing this creative work-around we were able to fulfill our customers requirement.
To make SAP order API call from Salesforce:
White list the endpoint:
User name and passwords are stored in Named credentials
We wrote custom Apex class to make call to SAP Order API, and exposed as Remote Action
Now on Check out page, we make call to sapOrderRemoteAction and based on success or failure, we issue the actual CloudCraze order call.