Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-4975

Stripe Payments: Update API library to newer version

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.8.0
    • Fix Version/s: 5.9.0-b1
    • Component/s: Gateways
    • Labels:
      None

      Description

      Look into updating Stripe Payments to update the API library to use the latest version of their API.

        Activity

        Hide
        jonathan Jonathan Reissmueller added a comment - - edited

        We'll want to explicitly target an api version. The code below targets the currently compatible version but we can update the gateway to handle a more recent version and update to target it.

        In components/gateways/merchant/stripe_payments/stripe_payments.php change

            /**
             * Loads the API if not already loaded
             */
            private function loadApi()
            {
                Loader::load(dirname(__FILE__) . DS . 'vendor' . DS . 'stripe' . DS . 'stripe-php' . DS . 'init.php');
                Stripe\Stripe::setApiKey((isset($this->meta['secret_key']) ? $this->meta['secret_key'] : null));
        
                // Include identifying information about this being a gateway for Blesta
                Stripe\Stripe::setAppInfo('Blesta ' . $this->getName(), $this->getVersion(), 'https://blesta.com');
            }
        

        To

            /**
             * Loads the API if not already loaded
             */
            private function loadApi()
            {
                Loader::load(dirname(__FILE__) . DS . 'vendor' . DS . 'stripe' . DS . 'stripe-php' . DS . 'init.php');
                Stripe\Stripe::setApiKey((isset($this->meta['secret_key']) ? $this->meta['secret_key'] : null));
        
                // Include identifying information about this being a gateway for Blesta
                Stripe\Stripe::setAppInfo('Blesta ' . $this->getName(), $this->getVersion(), 'https://blesta.com');
        
                // Set API version
                Stripe\Stripe::setApiVersion('2022-08-01');
            }
        
        Show
        jonathan Jonathan Reissmueller added a comment - - edited We'll want to explicitly target an api version. The code below targets the currently compatible version but we can update the gateway to handle a more recent version and update to target it. In components/gateways/merchant/stripe_payments/stripe_payments.php change /** * Loads the API if not already loaded */ private function loadApi() { Loader::load(dirname(__FILE__) . DS . 'vendor' . DS . 'stripe' . DS . 'stripe-php' . DS . 'init.php'); Stripe\Stripe::setApiKey((isset($ this ->meta['secret_key']) ? $ this ->meta['secret_key'] : null )); // Include identifying information about this being a gateway for Blesta Stripe\Stripe::setAppInfo('Blesta ' . $ this ->getName(), $ this ->getVersion(), 'https: //blesta.com'); } To /** * Loads the API if not already loaded */ private function loadApi() { Loader::load(dirname(__FILE__) . DS . 'vendor' . DS . 'stripe' . DS . 'stripe-php' . DS . 'init.php'); Stripe\Stripe::setApiKey((isset($ this ->meta['secret_key']) ? $ this ->meta['secret_key'] : null )); // Include identifying information about this being a gateway for Blesta Stripe\Stripe::setAppInfo('Blesta ' . $ this ->getName(), $ this ->getVersion(), 'https: //blesta.com'); // Set API version Stripe\Stripe::setApiVersion('2022-08-01'); }

          People

          • Assignee:
            jonathan Jonathan Reissmueller
            Reporter:
            admin Paul Phillips
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              15/Dec/23

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 1 hour, 41 minutes
              1h 41m

                Agile