Chapters
35 Chapters
|
3:22:53
|
This course is archived!
This tutorial uses an older version of Symfony of the stripe-php SDK. The majority of the concepts are still valid, though there *are* differences. We've done our best to add notes & comments that describe these changes.
Login to bookmark this video
-
Course Code
Subscribe to download the code!Compatible PHP versions: >=5.5.9, <7.4
Subscribe to download the code!Compatible PHP versions: >=5.5.9, <7.4
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
07.
Canceling a Subscription
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
This tutorial uses an older version of Symfony of the stripe-php SDK. The majority of the concepts are still valid, though there *are* differences. We've done our best to add notes & comments that describe these changes.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"php": ">=5.5.9, <7.4",
"symfony/symfony": "3.1.*", // v3.1.10
"doctrine/orm": "^2.5", // v2.7.2
"doctrine/doctrine-bundle": "^1.6", // 1.6.8
"doctrine/doctrine-cache-bundle": "^1.2", // 1.3.0
"symfony/swiftmailer-bundle": "^2.3", // v2.6.2
"symfony/monolog-bundle": "^2.8", // v2.12.1
"symfony/polyfill-apcu": "^1.0", // v1.3.0
"sensio/distribution-bundle": "^5.0", // v5.0.22
"sensio/framework-extra-bundle": "^3.0.2", // v3.0.26
"incenteev/composer-parameter-handler": "^2.0", // v2.1.2
"friendsofsymfony/user-bundle": "~2.0.1", // v2.0.1
"stof/doctrine-extensions-bundle": "^1.2", // v1.2.2
"stripe/stripe-php": "^3.15", // v3.23.0
"doctrine/doctrine-migrations-bundle": "^1.1", // v1.2.1
"phpunit/phpunit": "^5.5", // 5.7.20
"composer/package-versions-deprecated": "^1.11" // 1.11.99
},
"require-dev": {
"sensio/generator-bundle": "^3.0", // v3.1.4
"symfony/phpunit-bridge": "^3.0", // v3.3.0
"hautelook/alice-bundle": "^1.3", // v1.4.1
"doctrine/data-fixtures": "^1.2" // v1.2.2
}
}
9 Comments
It's no longer possible to use the 'cancel_at_period_end' method to cancel a subscription. I'm still looking for this in the official Stripe documentation. So far, the only thing I've found is how to delete the subscription, without waiting until the end of the subscription period before truly deleting it form Stripe.
Using the 'up to date' method in this guide provokes this error:
`{
"error": {
}
}`
You can directly cancel it like this:
$stripeSubscription = \Stripe\Subscription::retrieve($currentSubscription->getStripeSubscriptionId());<br />$stripeSubscription->cancel();Hey Carlos M.!
Yep, this part has changed since the tutorial was created. It looks like you found the answer :). The
cancel_at_period_endnow is a key you pass when you update a subscription - you can see an example in this comment: https://symfonycasts.com/screencast/stripe-level2/reactivate-subscription#comment-4765234516Let me know if that helps! There are various changes to the Stripe API since this tutorial - we're working on updating the tutorial or deprecating it fully (even though many things still work). If you hit any other problems, let us know (and check the comments - sometimes there are some details posted there!).
Cheers!
Again, I wouldn't deprecate the full tutorial, just update it. I understand the video, or parts of it, will have to be done again. However the quality of the tutorial is very high and just needs an update.
I've been able to follow it and migrate from my failing implementation of Stripe with Payum bundle, which doesn't easily allow working with subscriptions. The whole migration has been done in a day and a half. And just 2 errors in the tutorial. Simply update it :)
Yes! Updating the Subscription with the 'cancel_at_period_end' field set to true worked great! Now Stripe shows it'll cancel the subscription at the end of the period :)
Woohoo! Thanks for confirming that!
> The whole migration has been done in a day and a half. And just 2 errors in the tutorial
Ok, that is AWESOME. Payment changes should always take longer than that ;). Thanks again.
Cheers!
Changes since API version 2018-05-21:
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.
Hey Mohammed
Thanks for notifying us about those changes, we will add a note about that
Cheers!
"Houston: no signs of life"
Start the conversation!