API Request: One-Click Upsell

 

Below is the tutorial on how to create an upsell referencing  and order that is already processed.

  Business Use Case

One click Upsell

API Post 1 : order/doAddProcessOrder
 
With this API method, you can add all the details for the new order and reference a previous order’s payment details. It will also use all the attributes of the original order (tracking variables, campaign, shipping and billing address, etc) unless you pass values to override the previous order.

  Important to note

You will also need to pass specific values in the offers array to tell Sublytics that is an upsell and what offer it was upsold from.  Avoid reporting discrepancies by passing these variables specifically. 

 
Here is a link on how to properly set up upsells in Sublytics.
 
Here is an example request of API Post 1 :
 
{
  "user_id": "1",
  "user_password": "password",
  "order_id": "171010”, // order_id to use from previous order
  "campaign_id": "1”, // Pass a different campaign_id if you want to override the original order
  "offers":[
      {
        "parent_order_id":171010, // order_id from previous order
        "parent_offer_id":152, // offer_id from previous order
        "offer_id":91, // offer_id of the upsell
        "order_offer_upsell":1, // pass this flag to specify that the offer is an upsell
        "order_offer_quantity":1
     }
   ]
}
 
Here is an example response of API Post 1 :
 
{
    "success": true,
    "message": "Order successful",
    "data": {
        "transaction": {
            "success": true,
            "response_code": 100,
            "response": "test transaction",
            "gateway_response_id": 3037,
            "gateway_response_gateway_id": 2708,
            "gateway_response_code": 100,
            "gateway_auth_code": "ABCD",
            "gateway_response_cvv": "Y",
            "gateway_response_avs": "Y",
            "gateway_response_text": "test transaction",
            "gateway_request_text": "test transaction",
            "processor_response_text": "",
            "date_request": "2021-01-29 20:11:38",
            "date_response": "2021-01-29 20:11:38",
            "merchant_id": "17",
            "merchant_descriptor": "",
            "gateway_response_description": "",
            "gateway_hard_decline": "",
            "transaction_id": 675901,
            "transaction_total": "0.50",
            "shipment_id": "331388",
            "customer_id": "122750",
            "order_id": 171025,
            "order": {
                "id": "171025",
                "customer_id": "122750",
                "campaign_id": "18",
                "order_notes": "Shipment #331388 was created",
                "created_by": "api@demo.sublytics.com",
                "modified_by": "api@demo.sublytics.com",
                "date_created": "2021-01-29 20:11:37",
                "date_ordered": "2021-01-29 20:11:38",
                "date_modified": "2021-01-29 20:11:38",
                "ip_address": "0",
                "is_test": "1",
                "order_discount": null,
                "order_pixel": null,
                "order_pixel_block": null,
                "tracking1": "test",
                "tracking2": "test 2 original",
                "tracking3": "",
                "tracking4": "",
                "tracking5": "",
                "tracking6": "",
                "tracking7": "",
                "tracking8": "",
                "tracking9": "",
                "tracking10": "",
                "tracking11": "",
                "tracking12": "",
                "tracking13": "",
                "tracking14": "",
                "tracking15": "",
                "tracking16": "",
                "tracking17": "",
                "tracking18": "",
                "tracking19": "",
                "tracking20": "",
                "user_agent": "Other|Desktop|0|0|0|0",
                "order_offers": [
                    {
                        "id": "235368",
                        "offer_id": "91",
                        "offer_name": "Beard Oil",
                        "order_offer_quantity": "1",
                        "order_offer_price": "0.50",
                        "is_recurring": "0",
                        "order_offer_upsell": "1",
                        "status_type_id": "Complete",
                        "connection_status_type_name": "Complete",
                        "discount_id": null,
                        "cancel_type_id": null,
                        "cancel_type": "--",
                        "cancel_by": null,
                        "date_cancel": "0000-00-00 00:00:00",
                        "date_reactivate": "0000-00-00 00:00:00",
                        "date_ordered": "2021-01-29 20:11:38",
                        "date_created": "2021-01-29 20:11:38",
                        "date_modified": "2021-01-29 20:11:38",
                        "order_offer_notes": "Order has reached its final billing cycle and changed status to Complete",
                        "is_test": "1"
                    }
                ]
            }
        },
        "redirect": "/customer/view/122750"
    }
}
 
Some possible reasons for errors :
 

ERROR: upsell offer id XX is not available for parent offer XXX :

This would mean that the offer_id you are passing in the request is not an available upsell for the parent_offer_id specified.  You can either add the offer_id to the parent offer, or flag the offer_id as a Global Upsell to allow it to be upsold across all offers. See more details on Upsells here

 
To fix this error: On the offer_id that is being attempted as an upsell, confirm the Upsell flag is checked. If this offer can be sold as an upsell across all offers, check Global Upsell as well:
 
Screen_Shot_2021-01-29_at_8.54.39_PM.png
 

ERROR: original offer id XXX does not exist on order XXX:

This would mean that the offer_id you are passing in the request is not on the order you are specifying.

 
Was this article helpful?
0 out of 0 found this helpful