protected function getReference(array $response)
    {
        $payments = Arr::get($response, 'payments');

        if (!$payments) {
            return Arr::get($response, 'preference_id');
        }

        $lastPayment = Arr::last($payments);

        return Arr::get($lastPayment, 'id');
    }