Skip to main content

Update special price promotion

Update special price promotion

Last updated: 12-Nov-2020
Rate this article:

Overview

Use the UpdateSpecialPricePromotion method to modify promotion at a special price.

Request parameters  

Parameters Type Required Description
promotionCode String Required Code of the promotion that you want to update.
sessionID String Required Unique identifier of the session.
existingPromotion String Required Details of the existing promotion.
PriceMatrix Array of Objects Required Only for this type of promotion. It is generated by the getPriceMatrix call and used to set promotion special prices.

Request sample

<?php
require ('PATH_TO_AUTH');

// Retrieve promotion details

$promotionCode = 'PROMOTION_CODE'; // code of the promotion that you want to update

try {
    $Promotion = $client->getPromotion($sessionID, $promotionCode);
}
catch (SoapFault $e) {
    echo "Promotion: " . $e->getMessage();
    exit;
}

var_dump("Promotion", $Promotion);

// Keep the promotion you want to update in $existingPromotion
try{
    $existingPromotion = $client->getPromotion($sessionID, $promotionCode);
}

catch (SoapFault $e) {
    echo "Existing Promotion: " . $e->getMessage();
    exit;
}

// Set the fields to update

$priceMatrixDefinition1 = new stdClass;
$priceMatrixDefinition1->ProductCode = "test";
$priceMatrixDefinition1->PricingConfigurationCode = "738C6A2049";
$priceMatrixDefinition1->OptionHash = "708e43960c4edc42f14cf388bcb24bde";

$option1 = new stdClass;
$option1->GroupName = "Units";
$option1->OptionText = "1 - maximum";

$price1 = new stdClass;
$price1->Value = 20;
$price1->Currency = "USD";
$price2 = new stdClass;
$price2->Value = 15;
$price2->Currency = "EUR";

$priceMatrixDefinition1->Options = [$option1];
$priceMatrixDefinition1->Prices = [$price1, $price2];

$existingPromotion->DefaultCurrency = 'USD';
$existingPromotion->PriceMatrix = [
    $priceMatrixDefinition1
];
// Update the promotion
try {
    $updatedPromotion = $client->updatePromotion($sessionID, $existingPromotion);
}

catch (SoapFault $e) {
    echo "UpdatedPromotion: " . $e->getMessage();
    exit;
}

var_dump("UpdatedPromotion", $updatedPromotion);

?>

Response

{
   "@encodingStyle": "http://schemas.xmlsoap.org/soap/encoding/",
   "Body": {
      "addPromotionResponse": {
         "addPromotionReturn": {
            "@type": "ns2:Promotion",
            "Code": {
               "@type": "xsd:string",
               "#text": "6GR7JU369E"
            },
            "Name": {
               "@type": "xsd:string",
               "#text": "Promo percentage REST"
            },
            "Description": {
               "@type": "xsd:string",
               "#text": "Promo description1"
            },
            "StartDate": {
               "@type": "xsd:string",
               "#text": "2019-11-30"
            },
            "EndDate": {
               "@type": "xsd:string",
               "#text": "2100-12-31"
            },
            "MaximumOrdersNumber": {
               "@type": "xsd:int",
               "#text": "-1"
            },
            "MaximumQuantity": {
               "@type": "xsd:int",
               "#text": "1"
            },
            "InstantDiscount": {
               "@type": "xsd:boolean",
               "#text": "false"
            },
            "Coupon": {
               "@type": "ns2:PromotionCouponSingleOrMultiple",
               "Type": {
                  "@type": "xsd:string",
                  "#text": "MULTIPLE"
               },
               "Codes": {
                  "@arrayType": "xsd:string[2]",
                  "@type": "ns2:StringArray",
                  "item": [
                     {
                        "@type": "xsd:string",
                        "#text": "code1"
                     },
                     {
                        "@type": "xsd:string",
                        "#text": "code2"
                     }
                  ]
               }
            },
            "Enabled": {
               "@type": "xsd:boolean",
               "#text": "true"
            },
            "ChannelType": {
               "@nil": "true"
            },
            "Type": {
               "@type": "xsd:string",
               "#text": "SPECIAL_PRICE"
            },
            "Discount": {
               "@nil": "true"
            },
            "Products": {
               "@arrayType": "ns2:PromotionProduct[1]",
               "@type": "ns2:PromotionProductsArray",
               "item": {
                  "@type": "ns2:PromotionProduct",
                  "Code": {
                     "@type": "xsd:string",
                     "#text": "test"
                  },
                  "PricingOptionCodes": {
                     "@nil": "true"
                  },
                  "PricingConfigurationCode": {
                     "@nil": "true"
                  }
               }
            },
            "PriceThreshold": {
               "@nil": "true"
            },
            "Translations": {
               "@arrayType": "ns2:PromotionTranslation[1]",
               "@type": "ns2:PromotionTranslationsArray",
               "item": {
                  "@type": "ns2:PromotionTranslation",
                  "Name": {
                     "@type": "xsd:string",
                     "#text": "Promo percentage REST"
                  },
                  "Language": {
                     "@type": "xsd:string",
                     "#text": "EN"
                  }
               }
            },
            "Sources": {
               "@arrayType": "xsd:string[0]",
               "@type": "ns2:SourcesArray"
            },
            "PublishToAffiliatesNetwork": {
               "@nil": "true"
            },
            "ApplyRecurring": {
               "@type": "xsd:string",
               "#text": "NONE"
            },
            "RecurringChargesNumber": {
               "@type": "xsd:int",
               "#text": "0"
            },
            "DefaultCurrency": {
               "@type": "xsd:string",
               "#text": "EUR"
            },
            "PriceMatrix": {
               "@arrayType": "ns2:PromotionPriceMatrix[1]",
               "@type": "ns2:PromotionPriceMatrixArray",
               "item": {
                  "@type": "ns2:PromotionPriceMatrix",
                  "ProductCode": {
                     "@type": "xsd:string",
                     "#text": "test"
                  },
                  "PricingConfigurationCode": {
                     "@type": "xsd:string",
                     "#text": "738C6A2049"
                  },
                  "OptionHash": {
                     "@type": "xsd:string",
                     "#text": "708e43960c4edc42f14cf388bcb24bde"
                  },
                  "Options": {
                     "@arrayType": "ns2:PromotionPriceMatrixOptions[1]",
                     "@type": "ns2:PromotionPriceMatrixOptionsArray",
                     "item": {
                        "@type": "ns2:PromotionPriceMatrixOptions",
                        "GroupName": {
                           "@type": "xsd:string",
                           "#text": "Units"
                        },
                        "OptionText": {
                           "@type": "xsd:string",
                           "#text": "1 - maximum"
                        }
                     }
                  },
                  "Prices": {
                     "@arrayType": "ns2:PromotionPriceMatrixPrices[12]",
                     "@type": "ns2:PromotionPriceMatrixPricesArray",
                     "item": [
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "31.156"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "CAD"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "20"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "EUR"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "40"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "USD"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "1587.5251590698"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "ARS"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "18541.12858627"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "CLP"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "18.1324"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "GBP"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "2447.2"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "JPY"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "499.518"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "MXN"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "97.536"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "RON"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "1846.05"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "RUB"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "601.82854437393"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "UAH"
                           }
                        },
                        {
                           "@type": "ns2:PromotionPriceMatrixPrices",
                           "Value": {
                              "@type": "xsd:double",
                              "#text": "384.374"
                           },
                           "Currency": {
                              "@type": "xsd:string",
                              "#text": "ZAR"
                           }
                        }
                     ]
                  }
               }
            }
         }
      }
   }
} 
Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo