Shopping Cart API
Use shopping cart API to personalize and finalize the cart.
POST
/v1/shopping-carts/personalize
Type Description Format
CustomerId required string ID of the customer.
Minimum length: 1
Maximum length: 100
Pattern: ^[A-Za-z0-9\-]{1,100}$
FundSources required object List of source of funds. The allowed values are
  • Promotion
  • Wallet
Cart required object A Customer Cart.
A successful request returns HTTP 200 OK status code and a JSON response body that represents the personalized shopping cart.
Type Description
Cart object A personalized customer cart..
                        
    curl -X POST https://api.stack.promo/v1/shopping-carts/personalize \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Basic <credentials>'
    -d  '{
        "customerId": "5d3659629e8c412da5eeef1b28cca0fc",
        "fundSources" : ["Promotion", "Wallet"],
        "cart": {
            "currencyCode" : "AUD",
            "lineItems": [
                {
                  "category": "Personal Care",
                  "sku": "sku-405895",
                  "description": "Shampoo, Soap and Hand soap",
                  "quantity": 1,
                  "unitAmount" : 4.02,
                  "lineAmount": 4.02
                },
                {
                  "sku": "sku-736516",  
                  "quantity": 1,
                  "unitAmount" : 4.02,
                  "lineAmount": 4.02
                },
                {
                  "sku": "sku-405899",
                  "quantity": 2,
                  "unitAmount" : 1.95,
                  "lineAmount": 3.9
                }
            ],
            "totalAmount" : 11.94
        }
    }'
                        
                        
                            
                               
    {
        "cart": {
            "transactionId": "df99f040f42940db96133828afddfe10",
            "currencyCode": "AUD",
            "lineItems": [
                {
                    "category": "Personal Care",
                    "sku": "sku-405895",
                    "description": "Shampoo, Soap and Hand soap",
                    "quantity": 1,
                    "unitAmount": 4.02,
                    "lineAmount": 4.02
                },
                {
                    "category": null,
                    "sku": "sku-736516",
                    "description": null,
                    "quantity": 1,
                    "unitAmount": 4.02,
                    "lineAmount": 4.02
                },
                {
                    "category": null,
                    "sku": "sku-405899",
                    "description": null,
                    "quantity": 2,
                    "unitAmount": 1.95,
                    "lineAmount": 3.9
                }
            ],
            "promotion": {
                "id": "c9305025cb81418f8f6367b50c312610",
                "description": "Get $10 on us",
                "memo": "Cash applied to this order.",
                "promotionAmountType": "Cash",
                "promotionAmount": -10.0,
                "amountWithPromotion": 1.94
            },
            "summary": [
                {
                    "fundSource": "Promotion",
                    "amountType": "Cash",
                    "description": "Get $10 on us",
                    "memo": "Cash applied to this order.",
                    "amount": -10.0
                }
            ],
            "totalAmount": 11.94,
            "totalAmountDue": 1.94
        }
    }
                            
                        
POST
/v1/shopping-carts/{id}/finalize
Type Description
Id required string ID of the transaction.
A successful request returns HTTP 204 No Content status code with an empty object in the JSON response body.
                        
    curl -X POST https://api.stack.promo/v1/shopping-carts/df99f040f42940db96133828afddfe10/finalize \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Basic <credentials>'
                        
                        
                        
Type Description Format
CurrencyCode required string Three-character ISO-4217 currency code that identifies the currency.
Minimum length: 3
Maximum length: 3
Pattern: ^[A-Z]{3}$
LineItems required object Array of LineItems.
TotalAmount required decimal Total amount of the cart.
Minimum amount: 0.00
Type Description Format
Category string Category of the line item.
Minimum length: 1
Maximum length: 20
Pattern: ^[A-Za-z0-9_,\.\-\s]{1,20}$
Sku string Sku of the line item.
Minimum length: 1
Maximum length: 20
Pattern: ^[A-Za-z0-9_,\.\-\s]{1,20}$
Description string Description of the line item.
Minimum length: 1
Maximum length: 250
Pattern: ^[A-Za-z0-9_,\$\.\-\s]{1,250}$
Quantity required integer Quantity of the line item.
Minimum amount: 0
Maximum amount: 10,000,000
UnitAmount required decimal Unit amount of the line item.
Minimum amount: 0.00
Maximum amount: 10,000,000.00
LineAmount required decimal Total amount of the line item.
Minimum amount: 0.00
Type Description
TransactionId string Transaction ID of the personalized customer cart.
CurrencyCode string Three-character ISO-4217 currency code that identifies the currency. Same as incoming cart value.
LineItems object Array of personalized line items.
Promotion string Promotion applied to total amount.
Summary object Array of summary line.
TotalAmount decimal Total amount of the cart. Same as incoming cart value.
TotalAmountDue decimal Total amount due after applying promotions and wallet balance.
Type Description
Category string Category of the line item. Same as incoming line item value.
Sku string Sku of the line item. Same as incoming line item value.
Description string Description of the line item. Same as incoming line item value.
Quantity integer Quantity of the line item. Same as incoming line item value.
UnitAmount decimal Unit amount of the line item. Same as incoming line item value.
LineAmount decimal Total amount of the line item. Same as incoming line item value.
Promotion string Promotion applied to total amount.
Type Description
Id string ID of the promotion.
Description string Description of the promotion.
PromotionAmountType string Indicates whether promotion amount is cash or points.
PromotionAmount decimal Promotion Amount.
AmountWithPromotion decimal Indicates amount due after applying the promotion.
Memo string Notes.
Type Description
FundSource string Source of funds. Possible values are promotion or wallet.
AmountType string Type of promotion amount. Possible values are cash or points.
Description string Description of the promotion.
Memo string Additional information on the promotion.
Amount decimal Total payout.