Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stripe API Version Incompatbility] 2018-08-23 no longer allows at_period_end to be set when cancelling #551

Closed
bkuhl opened this issue Aug 25, 2018 · 6 comments

Comments

@bkuhl
Copy link

bkuhl commented Aug 25, 2018

Problem

Upgrading to use 2018-08-23 of the stripe API creates errors when trying to cancel a subscription:

DELETE /user/billing/cancel/xxxxxx
Received unknown parameter: at_period_end

Reference

https://stripe.com/docs/upgrades#2018-08-23

  • You can no longer set at_period_end in the subscription DELETE endpoints. The DELETE endpoint is reserved for immediate canceling going forward. Use cancel_at_period_end on the subscription update endpoints instead.
@grund3g
Copy link

grund3g commented Aug 28, 2018

I can confirm this! Upgraded to the 2018-08-23 version today and getting the same error:

message: "Received unknown parameter: at_period_end"
file: "/vendor/stripe/stripe-php/lib/ApiRequestor.php"
line: 124

@kjdion84
Copy link

Same here. Can't cancel subs because this is thrown.

C:\wamp64\www\projects\childlocator\vendor\stripe\stripe-php\lib\ApiRequestor.php
        throw $error;
    }
 
    private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData)
    {
        $msg = isset($errorData['message']) ? $errorData['message'] : null;
        $param = isset($errorData['param']) ? $errorData['param'] : null;
        $code = isset($errorData['code']) ? $errorData['code'] : null;
 
        switch ($rcode) {
            case 400:
                // 'rate_limit' code is deprecated, but left here for backwards compatibility
                // for API versions earlier than 2015-09-08
                if ($code == 'rate_limit') {
                    return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders);
                }
 
                // intentional fall-through
            case 404:
                return new Error\InvalidRequest($msg, $param, $rcode, $rbody, $resp, $rheaders);
            case 401:
                return new Error\Authentication($msg, $rcode, $rbody, $resp, $rheaders);
            case 402:
                return new Error\Card($msg, $param, $code, $rcode, $rbody, $resp, $rheaders);
            case 403:
                return new Error\Permission($msg, $rcode, $rbody, $resp, $rheaders);
            case 429:
                return new Error\RateLimit($msg, $param, $rcode, $rbody, $resp, $rheaders);
            default:
                return new Error\Api($msg, $rcode, $rbody, $resp, $rheaders);
        }
    }
 
    private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorCode)
    {
        $description = isset($resp['error_description']) ? $resp['error_description'] : $errorCode;
 
        switch ($errorCode) {
            case 'invalid_client':
                return new Error\OAuth\InvalidClient($errorCode, $description, $rcode, $rbody, $resp, $rheaders);
Arguments
"Received unknown parameter: at_period_end"

@February30th
Copy link
Contributor

Already fixed on version 7.1.3, care to update

@driesvints
Copy link
Member

This should be fixed in the latest version.

@hmzlam
Copy link

hmzlam commented Nov 22, 2018

no it's not fixed , always the same problem with
update(['cancel_at_period_end' => true]);

@bkuhl
Copy link
Author

bkuhl commented Nov 22, 2018

It's fixed for my app, so maybe you didn't update correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants