SFCC Postman Collection OCAPI Order
The SFCC Postman Collection OCAPI Order contains a set of requests that can be run using the Postman Collection runner to test the ordering process with your Salesforce Commerce Cloud instance.
Using the collection requires the creation of a CSV file which contains the iteration data that will be used for the variables in the collections requests. Additionally there are variables used for OCAPI authentication which can be set in a variable type of your choosing. Details on using the postman collection runner can be found here.
The collection can be used to mock Subscribe Pro for testing and debugging. The collection follows the same sequence of API calls that the Subscribe Pro order generation process uses. This can help diagnose and troubleshoot connection and order creation issues.
NOTE: This collection will not make any changes to data stored in Subscribe Pro, such as updating the Last or Next Order Dates, and will not trigger any emails from Subscribe Pro. However, if Salesforce Commerce Cloud is configured to send an email to the customer upon a successful or failed order, the customer will still receive that email.
Variables to set in the Environment
The variables below need to be set in the environment once imported. Defaults (in parantheses) are set for a few, but should be replaced to match your site.
- SFCC_URL
- SFCC_OCAPI_Client_ID
- SFCC_OCAPI_Client_Password
- SFCC_OCAPI_Username
- SFCC_OCAPI_Password
- SITE_ID (RefArch)
- locale (en-US)
- currency (USD)
- payment_method_id (CREDIT_CARD)
List of variables to be set in the CSV
The variables below are used in various requests in the collection, and need to be set in the CSV file used when running the collection. Download and complete the example CSV File.
- customer_email
- customer_no
- card_type
- card_last_four
- customer_payment_instrument_id
- billing_first
- billing_last
- billing_street1
- billing_street2
- billing_city
- billing_region
- billing_postcode
- billing_country
- billing_phone
- shipping_first
- shipping_last
- shipping_street1
- shipping_street2
- shipping_city
- shipping_region
- shipping_postcode
- shipping_country
- shipping_phone
- shipping_method_id
- product_id
- product_qty
- subscription_id
- subscription_interval
Steps
-
Using the
Run in Postman
button you can Fork/Import the collection and environment to your own Postman Workspace. -
The environment will also be imported into your Postman Workspace.
- Download and populate the CSV file with information relevant to your store.
- From the collection folder click the collection runner button.
- Click the Data Select File button to load your CSV file into the runner.
- Once your file has been loaded into the collection runner you need to make sure that any data columns that have leading 0s are properly handled by postman. To do so click the Preview button.
- Set any number columns with leading 0s to String type as seen below.
- Close the preview, and make sure that only the calls you want to include in the run are selected. Exclude
delete
for normal runs. The delete request can be used to delete the basket if something goes wrong during the collection run.
Note If you are running more than one subscription order in your CSV you should also not run the
oauth2
request as part of the run process. That should be run just before triggering the run.
- Your order should be successful.