Let's check out the API docs to see what that gives us. Oh yes, it has
a current_period_end property, which is a UNIX timestamp. Bingo!

Setting the billingPeriodEndsAt

In SubscriptionHelper, before we activate the subscription, add a new $periodEnd
variable. To convert the timestamp to a \DateTime object, say
$periodEnd = \DateTime::createFromFormat('U') - for UNIX timestamp -
$stripeSubscription->current_period_end:

Rendering the Next Billing Date

To celebrate, open the account.html.twig template. For "Next Billing At", add
if app.user.subscription - so if they have a subscription - then print
app.user.subscription.billingPeriodEndsAt|date('F jS') to format the date
nicely:

57 lines app/Resources/views/profile/account.html.twig

... lines 1 - 2

{% block body %}

<divclass="nav-space">

<divclass="container">

... lines 6 - 11

<divclass="row">

<divclass="col-xs-6">

<tableclass="table">

<tbody>

... lines 16 - 25

<tr>

<th>Next Billing at:</th>

<td>

{% if app.user.subscription %}

{{ app.user.subscription.billingPeriodEndsAt|date('F jS') }}

{% else %}

n/a

{% endif %}

</td>

</tr>

... lines 36 - 45

</tbody>

</table>

</div>

... lines 49 - 51

</div>

</div>

</div>

{% endblock %}

... lines 56 - 57

OK team! Refresh that page! The "Next Billing At" is... wrong! August 9th! That's
today! But no worries, that's just because the field is blank in the database, so
it's using today. To really test if this is working, we need to checkout with a
new subscription.

Now, in real life, you probably won't allow your users to buy multiple subscriptions.
Afterall, we're only storing info in the database about one Subscription, per user.
But, for testing, it's really handy to be able to checkout over and over again.

The checkout worked! Click "Account". Yes! There is the correct date: September
9th, one month from today. And the VISA card ends in 4242.

Alright: the informational part of the account page is done. But, the user still
needs to be able to do some pretty important stuff, like cancelling their subscription -
yes, this does happen, it's nothing personal - and updating their credit card.
Let's get to it.