Skip to content

Commit

Permalink
Merge pull request #1542 from stripe/sdk-release/next-major
Browse files Browse the repository at this point in the history
stripe-php v11 release
  • Loading branch information
richardm-stripe committed Aug 16, 2023
2 parents b4ab319 + 22a5dc5 commit 2f6758f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions lib/ApiRequestor.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ private static function _defaultHeaders($apiKey, $clientInfo = null)
'X-Stripe-Client-User-Agent' => \json_encode($ua),
'User-Agent' => $uaString,
'Authorization' => 'Bearer ' . $apiKey,
'Stripe-Version' => Stripe::getApiVersion(),
];
}

Expand Down Expand Up @@ -393,9 +394,6 @@ function ($key) use ($params) {
$absUrl = $this->_apiBase . $url;
$params = self::_encodeObjects($params);
$defaultHeaders = $this->_defaultHeaders($myApiKey, $clientUAInfo);
if (Stripe::$apiVersion) {
$defaultHeaders['Stripe-Version'] = Stripe::$apiVersion;
}

if (Stripe::$accountId) {
$defaultHeaders['Stripe-Account'] = Stripe::$accountId;
Expand Down
1 change: 1 addition & 0 deletions lib/BaseStripeClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class BaseStripeClient implements StripeClientInterface, StripeStreamingClientIn
'api_key' => null,
'client_id' => null,
'stripe_account' => null,
// Note, even if null, ApiRequestor will default this to Stripe::$apiVersion
'stripe_version' => null,
'api_base' => self::DEFAULT_API_BASE,
'connect_base' => self::DEFAULT_CONNECT_BASE,
Expand Down
3 changes: 0 additions & 3 deletions lib/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ class Invoice extends ApiResource
const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically';
const BILLING_SEND_INVOICE = 'send_invoice';

/** @deprecated */
const STATUS_DELETED = 'deleted';

/**
* @param null|array $params
* @param null|array|string $opts
Expand Down
7 changes: 3 additions & 4 deletions lib/Stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class Stripe
/** @var string The base URL for the Stripe API uploads endpoint. */
public static $apiUploadBase = 'https://files.stripe.com';

/** @var null|string The version of the Stripe API to use for requests. */
public static $apiVersion = null;
/** @var string The version of the Stripe API to use for requests. */
public static $apiVersion = \Stripe\Util\ApiVersion::CURRENT;

/** @var null|string The account ID for connected accounts requests. */
public static $accountId = null;
Expand Down Expand Up @@ -119,8 +119,7 @@ public static function setClientId($clientId)
}

/**
* @return string The API version used for requests. null if we're using the
* latest version.
* @return string the API version used for requests
*/
public static function getApiVersion()
{
Expand Down
5 changes: 5 additions & 0 deletions tests/Stripe/ApiRequestorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public function testDefaultHeaders()
'Stripe/v1 PhpBindings/' . Stripe::VERSION . ' MyTestApp/1.2.34 (https://mytestapp.example)'
);

static::assertSame(
$headers['Stripe-Version'],
Stripe::getApiVersion()
);

static::assertSame($headers['Authorization'], 'Bearer ' . $apiKey);
}

Expand Down
2 changes: 0 additions & 2 deletions tests/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ protected function setUpConfig()
Stripe::$apiUploadBase = \defined('MOCK_URL') ? MOCK_URL : 'http://localhost:12111';
Stripe::setApiKey('sk_test_123');
Stripe::setClientId('ca_123');
Stripe::setApiVersion(null);
Stripe::setAccountId(null);

// Set up the HTTP client mocker
Expand All @@ -63,7 +62,6 @@ protected function tearDownConfig()
Stripe::setEnableTelemetry(false);
Stripe::setApiKey($this->origApiKey);
Stripe::setClientId($this->origClientId);
Stripe::setApiVersion($this->origApiVersion);
Stripe::setAccountId($this->origAccountId);
}

Expand Down

0 comments on commit 2f6758f

Please sign in to comment.