Skip to main content

Update pricing configuration

Overview

Use the updatePricingConfiguration method to update/edit an existing pricing configuration.

Requirements

You cannot modify:

  • The pricing configuration CODE.
  • The PricingSchema from DYNAMIC to FLAT or vice versa.
  • The intervals of an existing pricing configuration (MinQuantity and MaxQuantity). 

Parameters

Parameters Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

PricingConfiguration

Required (object)

 

Use this object to update/edit an existing pricing configuration for your account.

ProductCode

Required (string)

 

The unique product code that you control not the system-generated product identifier.

 

    Response

    bool(true)
    

    Request

    <?php
    
    require ('PATH_TO_AUTH');
    
    $ProductCode = 'YOUR_PRODUCT_CODE';
    
    $jsonRpcRequest = array (
        'jsonrpc' => '2.0',
        'id' => $i++,
        'method' => 'getPricingConfigurations',
        'params' => array($sessionID, $ProductCode)
    );
    
    $existingPricingConfig = callRPC((Object)$jsonRpcRequest, $host);
    var_dump ($existingPricingConfig );
    
    
    $existingPricingConfig[1]->Prices->Renewal[0]->Amount = 10;
    $existingPricingConfig[1]->Prices->Renewal[0]->Currency = 'USD';
    
    $newPriceConfig = $existingPricingConfig[1];
    
    $jsonRpcRequest = array (
        'jsonrpc' => '2.0',
        'id' => $i++,
        'method' => 'updatePricingConfiguration',
        'params' => array($sessionID, $newPriceConfig, $ProductCode) //Use product ID and not product code for API versions smaller than 2.5
    );
    
    var_dump (callRPC((Object)$jsonRpcRequest, $host));
    
    ?>
    

    Use test orders

    Overview

    Place a test order using catalog products defined in your Merchant Control Panel.

    Set the Payment details type to TEST in order to create an order with a test credit card or a 2Pay.js token generated with a test credit card in a test environment.
    For the full list of test credit card details, check this article.

    Parameters 

    Parameters Type/Description

    sessionID

    Required (string)

     

    Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

    Order

    Required (Object)

     

    Object designed to collect all data necessary for an order, including billing, product/subscription plan, and payment details.

     

    Response 

    Parameters Type/Description

    Order information

    Object

    Test order request with credit cards

    <?php
    
    require ('PATH_TO_AUTH');
    
    $Order = new stdClass();
    $Order->RefNo = NULL;
    $Order->Currency = 'usd';
    $Order->Country = 'US';
    $Order->Language = 'en';
    $Order->CustomerIP = '91.220.121.21';
    $Order->ExternalReference = NULL;
    $Order->Source = NULL;
    $Order->Affiliate = new stdClass();
    $Order->Affiliate->AffiliateCode = 'Partner123'
    $Order->Affiliate->AffiliateSource = 'MobilePlatform'
    $Order->CustomerReference = NULL;
    
    $Order->Items = array();
    $Order->Items[0] = new stdClass();
    $Order->Items[0]->Code = 'my_subscription_1';
    $Order->Items[0]->Quantity = 1;
    $Order->Items[0]->PriceOptions = NULL;
    $Order->Items[0]->SKU = NULL;
    $Order->Items[0]->Price = NULL;
    $Order->Items[0]->CrossSell = NULL;
    $Order->Items[0]->Trial = false;
    $Order->Items[0]->AdditionalFields = NULL;
    $Order->Items[0]->SubscriptionStartDate = NULL; //If empty or null, subscriptions become active when purchase is made.
    
    $Order->BillingDetails = new stdClass();
    $Order->BillingDetails->FirstName = 'John';
    $Order->BillingDetails->LastName = 'Doe';
    $Order->BillingDetails->CountryCode = 'us';
    $Order->BillingDetails->State = 'California';
    $Order->BillingDetails->City = 'LA';
    $Order->BillingDetails->Address1 = 'Address example';
    $Order->BillingDetails->Address2 = NULL;
    $Order->BillingDetails->Zip = '90210';
    $Order->BillingDetails->Email = 'cosmin.deftu@2checkout.com';
    $Order->BillingDetails->Phone = NULL;
    $Order->BillingDetails->Company = NULL;
    $Order->DeliveryDetails = NULL;
    
    $Order->PaymentDetails = new stdClass ();
    $Order->PaymentDetails->Type = 'TEST';
    $Order->PaymentDetails->Currency = 'usd';
    $Order->PaymentDetails->PaymentMethod = new stdClass ();
    $Order->PaymentDetails->CustomerIP = '10.10.10.10';
    $Order->PaymentDetails->PaymentMethod->RecurringEnabled = true;
    $Order->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";
    $Order->PaymentDetails->PaymentMethod->CardType = 'visa';
    $Order->PaymentDetails->PaymentMethod->ExpirationYear = '2019';
    $Order->PaymentDetails->PaymentMethod->ExpirationMonth = '12';
    $Order->PaymentDetails->PaymentMethod->HolderName = 'John';
    $Order->PaymentDetails->PaymentMethod->CCID = '123';
    $Order->PaymentDetails->PaymentMethod->Vendor3DSReturnURL = "http://yoursuccessurl.com"; // used for 3DS ordering
    $Order->PaymentDetails->PaymentMethod->Vendor3DSCancelURL = "http://yourcancelurl.com"; // used for 3DS ordering
    
    $Order->AdditionalFields = NULL;
    $Order->LocalTime = NULL;
    $Order->GiftDetails = NULL;
    
    try {
        $newOrder = $client->placeOrder($sessionID, $Order);
    }
    catch (SoapFault $e) {
        echo "newOrder: " . $e->getMessage();
        exit;
    }
    
    var_dump("newOrder", $newOrder);
    
    

    Test order request with 2Pay.js tokens

     <?php
    
    require ('PATH_TO_AUTH');
    
    $Order = new stdClass();
    $Order->RefNo = NULL;
    $Order->Currency = 'usd';
    $Order->Country = 'US';
    $Order->Language = 'en';
    $Order->CustomerIP = '91.220.121.21';
    $Order->ExternalReference = NULL;
    $Order->Source = NULL;
    $Order->Affiliate = new stdClass();
    $Order->Affiliate->AffiliateCode = 'Partner123'
    $Order->Affiliate->AffiliateSource = 'MobilePlatform'
    $Order->CustomerReference = NULL;
    
    $Order->Items = array();
    $Order->Items[0] = new stdClass();
    $Order->Items[0]->Code = 'my_subscription_1';
    $Order->Items[0]->Quantity = 1;
    $Order->Items[0]->PriceOptions = NULL;
    $Order->Items[0]->SKU = NULL;
    $Order->Items[0]->Price = NULL;
    $Order->Items[0]->CrossSell = NULL;
    $Order->Items[0]->Trial = false;
    $Order->Items[0]->AdditionalFields = NULL;
    $Order->Items[0]->SubscriptionStartDate = NULL; //If empty or null, subscriptions become active when purchase is made.
    
    $Order->BillingDetails = new stdClass();
    $Order->BillingDetails->FirstName = 'John';
    $Order->BillingDetails->LastName = 'Doe';
    $Order->BillingDetails->CountryCode = 'us';
    $Order->BillingDetails->State = 'California';
    $Order->BillingDetails->City = 'LA';
    $Order->BillingDetails->Address1 = 'Address example';
    $Order->BillingDetails->Address2 = NULL;
    $Order->BillingDetails->Zip = '90210';
    $Order->BillingDetails->Email = 'cosmin.deftu@2checkout.com';
    $Order->BillingDetails->Phone = NULL;
    $Order->BillingDetails->Company = NULL;
    $Order->DeliveryDetails = NULL;
    
    $Order->PaymentDetails = new stdClass ();
    $Order->PaymentDetails->Type = 'TEST';
    $Order->PaymentDetails->Currency = 'usd';
    $Order->PaymentDetails->PaymentMethod = new stdClass ();
    $Order->PaymentDetails->PaymentMethod->EesToken = “90007562-681b-4df5-9797-53faf8abbc92”;
    $Order->PaymentDetails->PaymentMethod->Vendor3DSReturnURL = "https://example.com";
    $Order->PaymentDetails->PaymentMethod->Vendor3DSCancelURL = "https://example.com";
    
    $Order->Promotions = NULL;
    $Order->AdditionalFields = NULL;
    $Order->LocalTime = NULL;
    $Order->GiftDetails = NULL;
    
    $jsonRpcRequest = array (
    'method' => 'placeOrder',
    'params' => array($sessionID, $Order),
    'id' => $i++,
    'jsonrpc' => '2.0'
    );
    
    $order = callRPC($jsonRpcRequest, $host);
    

    Subscription renewal

    Overview

    Use this section to handle the renewal of your subscriptions.

    You can retrieve information regarding the renewal status of a subscription, including the manual renewal link that a customer needs to access in order to renew.

    Enable or disable the recurring billing for a subscription using the API methods displayed below.

    A/B testing campaigns for shopping cart templates

    Overview

    Set up A/B testing campaigns for shopping cart templates to identify the best converting template.

    Requirements & limitations

    Parameters sent through buy links will overwrite campaigns variables. The A/B testing campaigns will not trigger if the buy link contains a parameter that overwrites an experiment variable.

    When generating buy links in the platform via the Generate Links section, you'll notice that selecting a specific order template from the additional options area adds an extra parameter in the URL such as: &ORDERSTYLE=nLW45ZS5kH4= 

      When links with ORDERSTYLE parameters are used, they override A/B testing campaign variables. While shoppers will be able to complete the purchase without any issues, their order will not be registered as a part of the Shopping Cart Templates A/B test.

      What you need to do is to make sure that the links used point directly to https://secure.2checkout.com/order/checkout.php.

      For example, if the link you generated for a product looks like this:

      https://secure.2checkout.com/order/checkout.php?PRODS=1234567&QTY=1&CART=1&ORDERSTYLE=nLW0npaphH4=, then remove&ORDERSTYLE=nLW0npaphH4= to make sure that customers using the link to order will provide data for the Shopping Cart Templates A/B test. In this case, you would need to use this link:

      https://secure.2checkout.com/order/checkout.php?PRODS=1234567&QTY=1&CART=1
      

      Important

      When the shopper places the order, the test is considered successful regardless of the order or payment status.

      Setup

      1. Go to the A/B Testing page and click the Overview tab.
      2. Click New campaign in the Shopping cart templates section. If you already have an unfinished campaign, click Edit.
      3. Fill in the details of the new campaign, such as the campaign name, maximum number of tests and the date when the campaign should end.
      4. Add the test variations by allocating traffic to each of them and selecting the desired cart template from the drop-down menu.
      5. Click Add variation.
      6. Repeat steps 4 and 5 until you have used the entire available traffic.
      7. Click Save campaign.
      8. Go back to the Overview tab and click Start Campaign when you want the campaign to begin.

      Retrieve pricing list information

      Overview

      Get the extended info about the pricing list available for a partner, including the products and their pricing options, based on the pricing list code.

      Requirements

      Parameters

      Parameter Type/Description
      sessionID Required (string)
        Session identifier, which is the output of the Login method. An exception will be thrown if the values are incorrect
      pricingListCode Required (string)
        The unique identifier of the pricing list.

      Response

      Parameter Type/Description
      PricingList Object

      Request

      <?php
      
      require ('PATH_TO_AUTH');  // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/02Authentication
      require ('PATH_TO_SET_PARTNER'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/Partner/00Set_partner
      
      $pricingListCode = 'EFBECC428A';
      
      $jsonRpcRequest = array (
      'jsonrpc' => '2.0',
      'id' => $i++,
      'method' => 'getPricingListInformation',
      'params' => array($sessionID, $pricingListCode)
      );
      
      var_dump (callRPC((Object)$jsonRpcRequest, $host));
      

      Error

      Error Description
      INVALID_PARTNER No partner is set.
      PARTNER_PRICING_LISTS_NOT_FOUND There are no pricing lists with provided code.

      Retrieve a customer

      Overview

      Use the getCustomerInformation method to retrieve the details of a customer entity from the 2Checkout system.

      Parameters

      Parameters

      Type/Description

      sessionID

      Required (string)

       

      Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

      2CheckoutCustomerReference

      Required (int)

       

      System-generated customer reference. Required unless you prefer to use ExternalCustomerReference.

      ExternalCustomerReference

      Optional (string)

       

      External customer reference that you control. Optional when you use 2CheckoutCustomerReference. If you include it, it needs to belong to the same customer as the 2CheckoutCustomerReference.

      Response

      Customer

      Object

      Request

      
      <?php
      $host   = "https://api.2checkout.com";
      $client = new SoapClient($host . "/soap/4.0/?wsdl", array(
          'location' => $host . "/soap/4.0/",
          "stream_context" => stream_context_create(array(
              'ssl' => array(
                  'verify_peer' => false,
                  'verify_peer_name' => false
              )
          ))
      ));
      
      function hmac($key, $data)
      {
          $b = 64; // byte length for md5
          if (strlen($key) > $b) {
              $key = pack("H*", md5($key));
          }
          
          $key    = str_pad($key, $b, chr(0x00));
          $ipad   = str_pad('', $b, chr(0x36));
          $opad   = str_pad('', $b, chr(0x5c));
          $k_ipad = $key ^ $ipad;
          $k_opad = $key ^ $opad;
          return md5($k_opad . pack("H*", md5($k_ipad . $data)));
      }
      $merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
      $key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
      $now          = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
      $string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
      $hash   = hmac($key, $string);
      try {
          $sessionID = $client->login($merchantCode, $now, $hash);
      }
      catch (SoapFault $e) {
          echo "Authentication: " . $e->getMessage();
          exit;
      }
      $customerReference = 298084139;
      $externalCustomerReference = 'Apitest123456'; //Optional, but if you include it it needs to belong to the same customer as the internal 2Checkout customer reference
      try {
          $customerInfo = $client->getCustomerInformation($sessionID, $customerReference, $externalCustomerReference);
      }
      catch (SoapFault $e) {
          echo "customerInfo: " . $e->getMessage();
          exit;
      }
      var_dump("customerInfo", $customerInfo);
      
      

       

      Retrieve customer

      Overview

      Use the getCustomerInformation method to retrieve the details of a customer entity from the 2Checkout system.

      Parameters

      Parameters Type/Description

      sessionID

      Required (string)

       

      Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

      CustomerReference

      Required (int)

       

      System-generated customer reference. Required unless you prefer to use ExternalCustomerReference.

      ExternalCustomerReference

      Optional (string)

       

      External customer reference that you control. Optional when you use CustomerReference. If you include it, it needs to belong to the same customer as the CustomerReference.

      Response

      Parameters Type/Description

      Customer

      Object

      Request

      <?php
      
      require ('PATH_TO_AUTH');
      
      $customerReference = CUSTOMER_REFERENCE;
      $externalCustomerReference = 'EXT_CUSTOMER_REFERENCE'; //Optional, but if you include it it needs to belong to the same customer as the internal 2Checkout customer reference
      
      
      try {
          $customerInfo = $client->getCustomerInformation($sessionID, $customerReference, $externalCustomerReference);
      }
      catch (SoapFault $e) {
          echo "customerInfo: " . $e->getMessage();
          exit;
      }
      var_dump("customerInfo", $customerInfo);
      
      

       

      Email notifications for proposal with Net terms

      Overview

      The Net terms (purchase order) flow allows the creation of a proposal for a set time period (default 30 days). The contract and delivery can be initiated immediately with later payment.

      Email types for proposal with Net terms

      When a new order is placed in the CPQ app through an API call, the 2Checkout system logs it and if the order contains the B2B flag in the sales_additional_informations table, then the events that will take place are as follows:

      1. The email type - PO_Upload_B2B - is sent via SellTo.

      • The content of the email contains the link to download the PDF document and the Account Manager e-mail where the signed PDF document needs to be sent.
      • A PO_Upload_B2B email type is added and will be visible in our system under the Customer email section, as well as in the Merchant Control Panel, under Shopper emails → Order tab.
      • A PO_Upload_B2B email type is displayed in the Merchant Control Panel only if the CPQ feature is enabled on the merchant’s account.

      2. In the CPQ app, the salesperson has a link per opportunity to the Purchase Order (PO) flow Upload page to upload the signed document.

      • When uploading the signed documents on the Upload page using the Choose file option, the salesperson can also insert an internal PO number in the additional text box. This will overwrite in the purchase_order table and will become the purchase order internal number.
      • Upon upload of the signed PO document, 2Checkout will review the order and when this is approved in our system, the PO order is automatically marked as approved.
        • A PO_Finalize_Payment_B2B email type is sent to BillTo.
        • A PO_Finalize_Payment_B2B email type will be added and will be visible in the 2Checkout system under the Customer email section, as well as in Merchant Control Panel, under Shopper emails → Order tab.
        • A PO_Finalize_Payment_B2B email type will be displayed in the Merchant Control Panel only if the CPQ feature is enabled on the merchant’s account.

      3. The Net X Terms flow sends a follow-up payment email type - PO_Status_Changed_B2B - to BillTo until the purchase order is paid.

      • PO_Status_Changed_B2B sends notifications for three scenarios:
        • Payment is due in 7 days
        • Payment is due in 1 day
        • Order canceled due to net payment terms expiration
      • A PO_Status_Changed_B2B email type will be added and will be visible in the 2Checkout system under the Shopper email section, as well as in Merchant Control Panel, under Shopper emails → Financial tab.
      • A PO_Status_Changed_B2B email type will be displayed in the Merchant Control Panel only if the CPQ feature is enabled on the merchant’s account.

       

       

       

      Additional fields

      Overview

      This object is returned directly or within a successful response from the following API requests:

        Retrieve an additional field                               Retrieve assigned additional fields                              Retrieve all additional fields    

      Additional fields object

      Parameters Object

      Label

      String

       

      Field text.

      Code

      String

       

      Field identifier. Alpha-numeric chars, underscores and dashes.

      Type

      String

       

      Field type:

      • LISTBOX
      • CHECKBOX
      • TEXT
      • HIDDEN

      ApplyTo

      Sting

       

      • ORDER
      • PRODUCT

      Values

      Array of values

       

      Custom values you control.

      ValidationRule

      String

       

      The validation rule restricting the type of information shoppers can enter in the additional field during the purchase process.

      Translations

      Array of objects

       

      Details below.

                      Label

      String

       

      Field text translated in the language of the Translations object.

                     Values

      Object

       

      Custom values you control translated in the language of the Translations object.

                     Language

      String

       

      ISO language code. (ISO 639-1 two-letter code).

       

      Subscription upgrade

      Overview

      The object below is returned directly or within a successful response from the following API requests:

      Retrieve upgrade options

      Subscription upgrade object

      Parameters Type/Description

      ProductInfo

      Object

                     

      Details below.

       

      ProductId

      Int

       

       

      Unique, system-generated product identifier belonging to the upgrade product.

       

      ProductCode

      String

       

       

      Unique product identifier that you control belonging to the upgrade product.

       

      ProductName

      String

       

       

      Product name

       

      ProductVersion

      String

       

       

      The product version number that you control.

       

      ProductEnabled

      Boolean

       

       

      Possible values:

      0 – You disabled this product.

      1 – You enabled this product.

       

      ProductType

      String

       

       

      REGULAR or BUNDLE

       

      Currency

      String

       

       

      The currency for prices. The currency ISO code used for the payment - ISO 4217.

       

      DefaultCurrency

      String

       

       

      The product's default currency which is set in the Control Panel. The currency ISO code to be used for the payment - ISO 4217.

       

      Price

      Double

       

       

      Product price. Can be null for flat pricing schemes. You need to call getPrice with Quantity, Currency and Price Options parameters to get a valid price.

       

      GiftOption

      String

       

       

      True or false depending on whether the product can be gifted or not.

       

      IdGroup

      Int

       

       

      Product Group ID number.

       

      GroupName

      String

       

       

      The name of the Product Group.

       

      ShortDescription

      String

       

       

      The product's short description.

       

      ProductImage

      String

       

       

      URLs to the product images uploaded into the Avangate platform.

       

      Languages

      Array of strings

       

       

      Array of ISO language codes for the product - ISO 639-1.

       

      PriceIntervals

      Array of objects

       

       

      Pricing intervals.

       

      PriceType

      String

       

       

      NET or GROSS

       

      PriceSchema

      String

       

       

      FLAT or DYNAMIC

      Quantity

      Int

       

      Number of units available for the upgrade order.

      PriceOptions

      Array of objects

       

      Details below.

       

      Id

      String

       

       

      Pricing options ID.

       

      Name

      String

       

       

      Pricing options group name.

       

      Description

      String

       

       

      The description of the Pricing options group

       

      Required

      Boolean

       

       

      True or False depending on whether you set the Pricing options group asrequired or not.

       

      Type

      String

       

       

      Pricing options group type:

      • COMBO
      • CHECKBOX
      • RADIO

      INTERVAL

       

      Options

      Array of objects

       

       

      Details below.

       

       

      Name

      String

       

       

       

      The name of the option inside the Pricing options group

       

       

      Value

      String

       

       

       

      The code of the option inside the Pricing options group

       

       

      Default

      Boolean

       

       

       

      True or false.

       

       

      Description

      String

       

       

       

      The description of the option inside the Pricing options group.

       

       

      MinValue

      Int

       

       

       

      Start value of a scale interval.

       

       

      MaxValue

      Int

       

       

       

      End value of a scale interval.

      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