Course 1: How to win friends & develop in PHP
Arrays Level 3: We put Arrays in your Arrays!
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

Imagine our website provides paid access to content and allows users to subscribe. We integrated a payment system called Stripe that helps with it. When a new user subscribes, we send an API request to Stripe and it returns a response that contains all the necessary info about the user's subscription. The structure of the data looks like this:

$subscriptionData = array(
    "id" => "sub_1NiGuB2eZ",
    "object" => "subscription",
    "items" => array(
        "object" => "list",
        "data" => array(
            array(
                "id" => "si_OVHTBQE",
                "object" => "subscription_item",
                "price" => array(
                    "id" => "plan_OUwcmF6",
                    "object" => "price",
                    "amount" => 24.99,
                    "currency" => "USD",
                ),
            ),
        ),
    ),
);

Now we want to print the amount the user just paid on the page. How can we do it?

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.