Symfony 4: Removing the Mystery

The Beginners Symfony 4 tutorial is in progress. I have all but the final video recorded now. I ended up re-recording a number of sections in both of the recent video uploads:

Why?

One of the areas I found most confusing when first starting with Symfony was in the widespread use of Interfaces.

You may have encountered the following problem:

Let’s say you’re working under a tight deadline. You’re writing some Symfony Controller code and working with a form. It’s not going quite as smoothly as you’d like. You reckon something is going awry with the form submission.

Being the inquisitive developer, you remember the oft touted advice:

Read the source, Luke

The thing is, when you ctrl+click on $form->submit($request); you’re taken to… an interface.

This is good stuff.

Your life will be much easier if you code to an interface, rather than tie your methods to specific implementations.

However, with that deadline looming over your shoulder, such things are nice to know, but right now, just show me the code!

Finding An Implementation

When I first recorded this video I initially just said what the outcome of a call to the submit  method would be.

Watching back, I couldn’t help but think about that stuck, and stressed developer. Sat in a noisy office, headphones in, listening to music when you’d rather have peace and quiet.

Everyone around you seems to be goofing off whilst you’re struggling to think through this really important problem.

The last thing you need is to be met with this weird interface  thing. If only you could find the implementation then life would be a lot less stressful.

How can you find out what is really happening when you call $form->submit($request);?

And what happens when you find the implementation and even then the code is tricky to follow?

I know these feels.

That’s why when recording this video I worked hard to make sure you come out at the end with a good understanding of the code that makes this happen.

This is a beginners series for Symfony 4. This is the stuff that will make working with, and understanding Symfony that much easier.

I hope you enjoy it.


Site Stuff

There’s a ton of work going on behind the scenes at the moment.

Can I pay by PayPal?

This is one of the most frequently asked questions that I get.

Currently: no.

That sucks. I appreciate that.

The reasoning for this is that Stripe is super shiny and as a developer, they were high on my wish list of cool things to implement.

Also, from a code perspective Stripe is actually a joy to work with. They really are awesome.

But still, I get asked a lot for PayPal.

I’m adding PayPal.

It’s quite a big job, but I’m about 65% of the way through the implementation.

Here’s a sneak peak:

That’s the Stripe form using Stripe’s React elements.

PayPal functionality is provided through Braintree.

There’s a nice transition between the two options too, which came for free via Bootstrap 4 and I really like it.

I’ve been working on completely extracting the membership code.

Would you have any interest in seeing video tutorials on how to make your own Symfony bundles?

Leave a comment and let me know.

There’s some other cool features that this work enables, which I’ll share with you in a future update.

Until next time, have a great weekend and happy coding.

Chris

Stripe Webhooks List

I recently needed access to a list of Stripe’s available webhooks.

Stripe have a list, but I found my eyes became extremely fatigued when referring to their list. So I copy pasted, and restyled to something I prefer.

That is all 🙂

Account

account.updated
Occurs whenever an account status or property has changed.
account.application.deauthorized
Occurs whenever a user deauthorizes an application. Sent to the related application only.
account.external_account.created
Occurs whenever an external account is created.
account.external_account.deleted
Occurs whenever an external account is deleted.
account.external_account.updated
Occurs whenever an external account is updated.

Application Fee

application_fee.created
Occurs whenever an application fee is created on a charge.
application_fee.refunded
Occurs whenever an application fee is refunded, whether from refunding a charge or from refunding the application fee directly, including partial refunds.
application_fee.refund.updated
Occurs whenever an application fee refund is updated.

Balance

balance.available
Occurs whenever your Stripe balance has been updated (e.g., when a charge is available to be paid out). By default, Stripe automatically transfers funds in your balance to your bank account on a daily basis.

Bitcoin

bitcoin.receiver.created
Occurs whenever a receiver has been created.
bitcoin.receiver.filled
Occurs whenever a receiver is filled (i.e., when it has received enough bitcoin to process a payment of the same amount).
bitcoin.receiver.updated
Occurs whenever a receiver is updated.
bitcoin.receiver.transaction.created
Occurs whenever bitcoin is pushed to a receiver.

Charge

charge.captured
Occurs whenever a previously uncaptured charge is captured.
charge.failed
Occurs whenever a failed charge attempt occurs.
charge.pending
Occurs whenever a pending charge is created.
charge.refunded
Occurs whenever a charge is refunded, including partial refunds.
charge.succeeded
Occurs whenever a new charge is created and is successful.
charge.updated
Occurs whenever a charge description or metadata is updated.
charge.dispute.closed
Occurs when a dispute is closed and the dispute status changes to charge_refunded, lost, warning_closed, or won.
charge.dispute.created
Occurs whenever a customer disputes a charge with their bank.
charge.dispute.funds_reinstated
Occurs when funds are reinstated to your account after a dispute is won.
charge.dispute.funds_withdrawn
Occurs when funds are removed from your account due to a dispute.
charge.dispute.updated
Occurs when the dispute is updated (usually with evidence).
charge.refund.updated
Occurs whenever a refund is updated on selected payment methods.

Coupon

coupon.created
Occurs whenever a coupon is created.
coupon.deleted
Occurs whenever a coupon is deleted.
coupon.updated
Occurs whenever a coupon is updated.

Customer

customer.created
Occurs whenever a new customer is created.
customer.deleted
Occurs whenever a customer is deleted.
customer.updated
Occurs whenever any property of a customer changes.
customer.discount.created
Occurs whenever a coupon is attached to a customer.
customer.discount.deleted
Occurs whenever a coupon is removed from a customer.
customer.discount.updated
Occurs whenever a customer is switched from one coupon to another.
customer.source.created
Occurs whenever a new source is created for a customer.
customer.source.deleted
Occurs whenever a source is removed from a customer.
customer.source.updated
Occurs whenever a source’s details are changed.
customer.subscription.created
Occurs whenever a customer is signed up for a new plan.
customer.subscription.deleted
Occurs whenever a customer’s subscription ends.
customer.subscription.trial_will_end
Occurs three days before the trial period of a subscription is scheduled to end.
customer.subscription.updated
Occurs whenever a subscription changes (e.g., switching from one plan to another or changing the status from trial to active).

Invoice

invoice.created
Occurs whenever a new invoice is created. See Using Webhooks with Subscriptions to learn how webhooks can be used with, and affect, this event.
invoice.payment_failed
Occurs whenever an invoice payment attempt fails, either due to a declined payment or the lack of a stored payment method.
invoice.payment_succeeded
Occurs whenever an invoice payment attempt succeeds.
invoice.upcoming
Occurs X number of days before a subscription is scheduled to create an invoice that is charged automatically, where X is determined by your subscriptions settings.
invoice.updated
Occurs whenever an invoice changes (e.g., the invoice amount).
invoiceitem.created
Occurs whenever an invoice item is created.
invoiceitem.deleted
Occurs whenever an invoice item is deleted.
invoiceitem.updated
Occurs whenever an invoice item is updated.

Order

order.created
Occurs whenever an order is created.
order.payment_failed
Occurs whenever an order payment attempt fails.
order.payment_succeeded
Occurs whenever an order payment attempt succeeds.
order.updated
Occurs whenever an order is updated.
order_return.created
Occurs whenever an order return is created.

Payout

payout.canceled
Occurs whenever a payout is canceled.
payout.created
Occurs whenever a payout is created.
payout.failed
Occurs whenever a payout attempt fails.
payout.paid
Occurs whenever a payout is expected to be available in the destination account. If the payout fails, a payout.failed notification is additionally sent at a later time.
payout.updated
Occurs whenever the metadata of a payout is updated.

Plan

plan.created
Occurs whenever a plan is created.
plan.deleted
Occurs whenever a plan is deleted.
plan.updated
Occurs whenever a plan is updated.

Product

product.created
Occurs whenever a product is created.
product.deleted
Occurs whenever a product is deleted.
product.updated
Occurs whenever a product is updated.

Recipient

recipient.created
Occurs whenever a recipient is created.
recipient.deleted
Occurs whenever a recipient is deleted.
recipient.updated
Occurs whenever a recipient is updated.

Review

review.closed
Occurs whenever a review is closed. The review’s reason field indicates why (e.g., approved, refunded, refunded_as_fraud, disputed.
review.opened
Occurs whenever a review is opened.

SKU

sku.created
Occurs whenever a SKU is created.
sku.deleted
Occurs whenever a SKU is deleted.
sku.updated
Occurs whenever a SKU is updated.

Source

source.canceled
Occurs whenever a source is canceled.
source.chargeable
Occurs whenever a source transitions to chargeable.
source.failed
Occurs whenever a source fails.
source.transaction.created
Occurs whenever a source transaction is created.

Transfer

transfer.created
Occurs whenever a transfer is created.
transfer.reversed
Occurs whenever a transfer is reversed, including partial reversals.
transfer.updated
Occurs whenever the description or metadata of a transfer is updated.

Misc

ping
May be sent by Stripe at any time to see if a provided webhook URL is working.