-
Notifications
You must be signed in to change notification settings - Fork 850
Migration guide for v7
remi-stripe edited this page Sep 11, 2019
·
2 revisions
Version 7 of the Stripe PHP library contains a large number of changes. This guide will help you update your Stripe integration so that it keeps working as expected after you upgrade to v7.
The library no longer supports PHP 5.4 and 5.5. The minimum required version is now PHP 5.6.
Removed class | Replacement class | Notes |
---|---|---|
FileUpload |
File |
- |
IssuerFraudWarning |
Radar\EarlyFraudWarning |
- |
Removed method | Replacement method | Notes |
---|---|---|
*.__toArray() |
*.toArray() |
The method no longer takes any parameters, it will always convert recursively |
*.__toJson() |
*.toJson() |
- |
ApplicationFee.refund() |
ApplicationFee::createRefund() |
- |
Charge.closeDispute() |
Dispute::close() |
ID: $charge->dispute
|
Charge.markAsFraudulent() |
Charge::update() |
Parameters: ["fraud_details" => ["user_report" => "fraudulent"]]
|
Charge.markAsSafe() |
Charge::update() |
Parameters: ["fraud_details" => ["user_report" => "safe"]]
|
Charge.refund() |
Refund::create() |
- |
Charge.updateDispute() |
Dispute.update() |
ID: $charge->dispute
|
Customer.addInvoiceItem() |
InvoiceItem::create() |
Parameters: ["customer" => $customer->id, ...]
|
Customer.cancelSubscription() |
Subscription::cancel() |
ID: $customer->subscriptions->data[0]->id
|
Customer.charges() |
Charge::all() |
Parameters: ["customer" => $customer->id, ...]
|
Customer.invoiceItems() |
InvoiceItem::all() |
Parameters: ["customer" => $customer->id, ...]
|
Customer.invoices() |
Invoice::all() |
Parameters: ["customer" => $customer->id, ...]
|
Customer.updateSubscription() |
Subscription::update() |
ID: $customer->subscriptions->data[0]->id
|
Recipient.transfers() |
Transfer::all() |
Parameters: ["recipient" => $recipient->id, ...]
|
Source.delete() |
Source.detach() |
- |
Transfer.reverse() |
Transfer::createReversal() |
- |
UsageRecord::create() |
SubscriptionItem::createUsageRecord() |
- |
All exception classes have been renamed:
Old name | New name | Notes |
---|---|---|
Error\Api |
Exception\UnknownApiErrorException |
- |
Error\ApiConnection |
Exception\ApiConnectionException |
- |
Error\Authentication |
Exception\AuthenticationException |
- |
Error\Base |
Exception\ApiErrorException |
(see below) |
Error\Card |
Exception\CardException |
- |
Error\Idempotency |
Exception\IdempotencyException |
- |
Error\InvalidRequest |
Exception\InvalidRequestException |
- |
Error\Permission |
Exception\PermissionException |
- |
Error\RateLimit |
Exception\RateLimitException |
- |
Error\SignatureVerification |
Exception\SignatureVerificationException |
(see below) |
Error\OAuth\InvalidClient |
Exception\OAuth\InvalidClientException |
- |
Error\OAuth\InvalidGrant |
Exception\OAuth\InvalidGrantException |
- |
Error\OAuth\InvalidRequest |
Exception\OAuth\InvalidRequestException |
- |
Error\OAuth\InvalidScope |
Exception\OAuth\InvalidScopeException |
- |
Error\OAuth\OAuthBase |
Exception\OAuth\OAuthErrorException |
(see below) |
Error\OAuth\UnsupportedGrantType |
Exception\OAuth\UnsupportedGrantTypeException |
- |
Error\OAuth\UnsupportedResponseType |
Exception\OAuth\UnsupportedResponseTypeException |
- |
Other notable changes:
- all exceptions thrown by the Stripe PHP library now implement the
Exception\ExceptionInterface
interface - the exception classes no longer override the default exception constructor method. If you want to construct exceptions manually (for test purposes), you can use the
::factory()
static methods. -
Exception\SignatureVerificationException
no longer derives fromException\ApiErrorException
- the
OAuthBase.getErrorCode()
method is renamed toOAuthErrorException.getStripeCode()