Language

2Checkout Documentation

Retrieve

The Twocheckout_Coupon class provides methods to create, retrieve, update and delete coupons and will return an Array or JSON response depending on your format specification.

Method

retrieve

Use to retrieve a coupon.

Arguments

  • Array containing list_coupons parameters or just a coupon code. Parameters -> API List Coupons
    • Returns

      Returns an Array or JSON depending on your format specification.

      Example Usage:

      Twocheckout::username('APIuser1817037');
      Twocheckout::password('APIpass1817037');
      
      $args = array(
          'coupon_code' => '123test'
      );
      
      $coupon = Twocheckout_Coupon::retrieve($args);
      

      Example Response:

      Array
      (
          [coupon] => Array
              (
                  [coupon_code] => 123TEST
                  [date_expire] => 2020-07-31
                  [minimum_purchase] => 2.00
                  [percentage_off] => 
                  [product] => Array
                      (
                          [0] => Array
                              (
                                  [product_id] => 0
                                  [product_url] => https://www.2checkout.com/api/products/detail_product?product_id=0
                              )
      
                      )
      
                  [type] => sale
                  [value_off] => 1.00
              )
      
          [response_code] => OK
          [response_message] => Coupon detail retrieved successfully.
      )