Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function creates a shopping cart with which the system sends an order to the cPanel Store. Typically, the system will send shopping cart orders for SSL certificates to UAPI's Market::request_ssl_certificates function.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Market/create_shopping_cart?provider=cPStore&access_token=1a676e6f-99fc-11e6-9ab6-e60a769b73bc&url_after_checkout%3Dhttp%3A%2F%2Fwww.example.com%2Fthenextplace&item-1%3D%7B%22product_id%22%3A123456%2C%22order_item_id%22%3A1%2C%22description%22%3A%22Thing%201%22%2C%22price%22%3A9%7D%26item-2%3D%7B%22product_id%22%3A123457%2C%22order_item_id%22%3A2%2C%22description%22%3A%22Thing%202%22%2C%22price%22%3A8%7D

Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Send the shopping cart to the cPanel Store.
$cleanuponaislethree = $cpanel->uapi(
    'Market', 'create_shopping_cart',
    array(
         'provider'           => 'cPStore',
         'access_token'       => '1a676e6f-99fc-11e6-9ab6-e60a769b73bc',
         'url_after_checkout' => 'http://www.example.com/thenextplace',
         'item-1'             => '{"product_id":123456,"order_item_id":1,"description":"Thing 1","price":9}',
         'item-2'             => '{"product_id":123457,"order_item_id":2,"description":"Thing 2","price":8}'
    )
);

Note:

For more information, read our Guide to the LiveAPI System.

 

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Send the shopping cart to the cPanel Store.
my $cleanuponaislethree = $cpliveapi->uapi(
    'Market', 'create_shopping_cart',
    {
         'provider'           => 'cPStore',
         'access_token'       => '1a676e6f-99fc-11e6-9ab6-e60a769b73bc',
         'url_after_checkout' => 'http://www.example.com/thenextplace',
         'item-1'             => '{"product_id":123456,"order_item_id":1,"description":"Thing 1","price":9}',
         'item-2'             => '{"product_id":123457,"order_item_id":2,"description":"Thing 2","price":8}'
    }
);

Note:

For more information, read our Guide to the LiveAPI System.

 

 cPanel Template Toolkit
<!-- Send the shopping cart to the cPanel Store. -->
[% execute('Market', 'create_shopping_cart', {'provider'=>'cPStore','access_token'=>'1a676e6f-99fc-11e6-9ab6-e60a769b73bc','url_after_checkout'=>'http://www.example.com/thenextplace','item-1'=>'{"product_id":123456,"order_item_id":1,"description":"Thing 1","price":9}','item-2'=>{"product_id":123457,"order_item_id":2,"description":"Thing 2","price":8}' } ) %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 

 Command Line
uapi --user=username Market set_status_of_pending_queue_items provider=cPStore access_token=1a676e6f-99fc-11e6-9ab6-e60a769b73bc url_after_checkout=http:\/\/www.example.com\/thenextplace item-1='{"product_id":123456,"order_item_id":1,"description":"Thing 1","price":9}' item-2='{"product_id":123457,"order_item_id":2,"description":"Thing 2","price":8}'

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{  
   "data":{  
      "order_id":"8765309",
      "items":[  
         {
          "order_item_id":1,
          "description":"Thing 1",
          "price":9
         },
         {
          "order_item_id":2,
          "description":"Thing 2",
          "price":8
         },
      ]
   },
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  
   }
}

Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

   

Parameters

ParameterTypeDescriptionPossible valuesExample
providerstring

Required

The cPanel Market provider's name.

A valid string.cPStore
access_tokenstring

Required

The access token to connect to the provider.

A valid string.

1a676e6f-99fc-11e6-9ab6-e60a769b73bc
url_after_checkoutstring

Required

The location to which the provider directs the user after the checkout process is complete.

A valid string.http://www.example.com/thenextplace
itemJSON-encoded

Required

This parameter contains information about Items to add to the shopping cart.

Note:

To add multiple items to the shopping cart, duplicate or increment the parameter name. For example, to add three items to the shopping cart, use the order_item_id parameter multiple times or use the item-1, item-2, and item-3 parameters.

This parameter varies between providers. 

product_id

string

The product's ID.

The function requires this parameter as part of the item parameter.

A valid string.123456

item_parameter

Varies depending on the provider.

An item's parameter.

Note:

The parameter's name varies depending on the provider.

The function requires this parameter as part of the item parameter.

Varies depending on the provider.

 

 

Returns

ReturnTypeDescriptionPossible valuesExample
order_idstring

The order's ID.

A valid string.

8765309
itemsarray of hashes

An array of hashes that contains information about Items in the shopping cart.

The function returns these values in the order in which you called them.

This array of hashes returns values that vary between providers. 

item_return

Varies depending on the provider.

An array that lists order item IDs which do not exist in the cPanel Market pending queue for the user.

 

Varies depending on the provider.