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!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
27.
Failing Awesomely When Payments Fail
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
}
}
5 Comments
Hello, with the actual Stripe version, there is several changements.
<u><b>Exception </b></u>:
\Stripe\Error\Card=>\Stripe\Exception\CardExceptionIn addition, there are certain attributes that no longer exist. And I can't seem to find an alternative.
$stripeSubscription->prorate = false;The "<b>prorate</b>" attribute doesn't exist today.$invoice->closed = true;The "<b>closed</b>" attribute doesn't exist today.Is there an alternative to these two attributes? No matter how much I look in the doc, I don't see anything similar
EDIT :
For the "<b>closed</b>" attribute : https://stripe.com/docs/billing/migration/invoice-states
They say that now you have to use the attribute "<b>status</b>" (and in our case, pass its value to "<b>void</b>". We can see an <b>Invoice object</b> example : https://stripe.com/docs/api/invoices/object
At first I tried stupidly:
$invoice->status = "void", but it returned an error in my logs :request.CRITICAL: Uncaught PHP Exception Stripe\Exception\InvalidRequestException: "Received unknown parameter: status"I did not understand but after 30 minutes I found: https://stripe.com/docs/api/invoices/void
We have to do :
$invoice->voidInvoice();Now it works.
However, weird thing, I have no error in the logs compared to the attribute "prorate" for subscriptions. Yet it should not exist?
Hi again Kiuega!
Thanks for sharing your questions and discoveries again :). About the last point:
<blockquote>However, weird thing, I have no error in the logs compared to the attribute "prorate" for subscriptions. Yet it should not exist?
</blockquote>
It looks to me that the
prorateattribute hasn't been removed - it's just deprecated. https://stripe.com/docs/api/subscriptions/update#update_subscription-prorateThe docs say:
<blockquote>prorate optional DEPRECATED
...
Use proration_behavior=create_prorations as a replacement for prorate=true and proration_behavior=none for prorate=false.
</blockquote>
So it looks like prorate still works - but you can use the other
proration_behaviorproperty to use the latest way.Let me know if the whole thing is working!
Cheers!
Okay I see! I will come back to this later. I am currently working on a set of files that would allow us to manage the whole Stripe aspect from our application. Namely products, subscriptions, coupons, everything you need. Because I haven't found anything that already does the same thing and it can be really cool to be able to integrate this into any project! I don't know how you do it at home.
Currently I'm on the coupons part, it's longer than I thought
https://zupimages.net/up/20...
The 27 chapter is not correctly named when downloading
Hey Anton,
Ah, I see, the wrong number! I just renamed it, so now it should be "27-plan-change-payment-failure". Thank you for letting us know about it!
Cheers!
"Houston: no signs of life"
Start the conversation!