How can the quantity of purchased currency be retrieved from the Paypal API response in a PHP script?

To retrieve the quantity of purchased currency from the Paypal API response in a PHP script, you can parse the JSON response and access the necessary data using array notation. Specifically, you will need to navigate through the response array to locate the key that holds the information about the purchased currency quantity.

// Assuming $response contains the JSON response from the Paypal API
$responseArray = json_decode($response, true);

// Access the quantity of purchased currency
$quantity = $responseArray['purchased_currency']['quantity'];

echo "Quantity of purchased currency: " . $quantity;